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.uif.component.Component;
19 import org.kuali.rice.krad.uif.element.Message;
20 import org.kuali.rice.krad.uif.util.ComponentFactory;
21
22 import java.util.List;
23
24
25
26
27
28
29 public class MessageView extends FormView {
30 private static final long serialVersionUID = 5578210247236389466L;
31
32 private Message message;
33
34 public MessageView() {
35 super();
36
37 super.setSinglePageView(true);
38 }
39
40
41
42
43
44
45
46
47
48
49 public void performInitialization(View view, Object model) {
50 super.performInitialization(view, model);
51
52 List<Component> newItems = (List<Component>) getPage().getItems();
53 newItems.add(message);
54 getPage().setItems(newItems);
55 }
56
57
58
59
60 @Override
61 public List<Component> getComponentsForLifecycle() {
62 List<Component> components = super.getComponentsForLifecycle();
63
64 components.add(message);
65
66 return components;
67 }
68
69
70
71
72
73
74 public Message getMessage() {
75 return message;
76 }
77
78
79
80
81
82
83 public void setMessage(Message message) {
84 this.message = message;
85 }
86
87
88
89
90
91
92 public void setMessageText(String messageText) {
93 if (this.message == null) {
94 this.message = ComponentFactory.getMessage();
95 }
96
97 this.message.setMessageText(messageText);
98 }
99
100
101
102
103 @Override
104 protected <T> void copyProperties(T component) {
105 super.copyProperties(component);
106 MessageView messageViewCopy = (MessageView) component;
107
108 if(this.message != null) {
109 messageViewCopy.setMessage((Message)this.getMessage().copy());
110 }
111 }
112 }