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.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.uif.component.Component;
20 import org.kuali.rice.krad.uif.element.Message;
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 String messageText;
33 private Message message;
34
35 public MessageView() {
36 super();
37
38 super.setSinglePageView(true);
39 }
40
41
42
43
44
45
46
47
48
49
50 public void performInitialization(View view, Object model) {
51 super.performInitialization(view, model);
52
53 if (StringUtils.isNotBlank(messageText) && StringUtils.isBlank(message.getMessageText())) {
54 message.setMessageText(messageText);
55 }
56
57 List<Component> newItems = (List<Component>) getPage().getItems();
58 newItems.add(message);
59 getPage().setItems(newItems);
60 }
61
62
63
64
65 @Override
66 public List<Component> getComponentsForLifecycle() {
67 List<Component> components = super.getComponentsForLifecycle();
68
69 components.add(message);
70
71 return components;
72 }
73
74
75
76
77
78
79 public String getMessageText() {
80 return messageText;
81 }
82
83
84
85
86
87
88 public void setMessageText(String messageText) {
89 this.messageText = messageText;
90 }
91
92
93
94
95
96
97 public Message getMessage() {
98 return message;
99 }
100
101
102
103
104
105
106 public void setMessage(Message message) {
107 this.message = message;
108 }
109 }