1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.view;
17
18 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
20 import org.kuali.rice.krad.uif.component.Component;
21 import org.kuali.rice.krad.uif.element.Message;
22 import org.kuali.rice.krad.uif.util.ComponentFactory;
23
24 import java.util.List;
25
26
27
28
29
30
31 @BeanTag(name = "messageView", parent="Uif-MessageView")
32 public class MessageView extends FormView {
33 private static final long serialVersionUID = 5578210247236389466L;
34
35 private Message message;
36
37 public MessageView() {
38 super();
39
40 super.setSinglePageView(true);
41 }
42
43
44
45
46
47
48
49
50
51
52 public void performInitialization(Object model) {
53 super.performInitialization(model);
54
55 List<Component> newItems = (List<Component>) getPage().getItems();
56 newItems.add(message);
57 getPage().setItems(newItems);
58 }
59
60
61
62
63
64
65 @BeanTagAttribute(type = BeanTagAttribute.AttributeType.DIRECTORBYTYPE)
66 public Message getMessage() {
67 return message;
68 }
69
70
71
72
73
74
75 public void setMessage(Message message) {
76 this.message = message;
77 }
78
79
80
81
82
83
84 @BeanTagAttribute
85 public String getMessageText() {
86 if (this.message != null) {
87 return this.message.getMessageText();
88 }
89
90 return null;
91 }
92
93
94
95
96 public void setMessageText(String messageText) {
97 if (this.message == null) {
98 this.message = ComponentFactory.getMessage();
99 }
100
101 this.message.setMessageText(messageText);
102 }
103 }