1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.uif.element;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
20 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
21 import org.kuali.rice.krad.uif.CssConstants;
22 import org.kuali.rice.krad.uif.UifConstants;
23 import org.kuali.rice.krad.uif.component.Component;
24 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle;
25 import org.kuali.rice.krad.uif.util.LifecycleElement;
26 import org.kuali.rice.krad.uif.view.View;
27
28
29
30
31
32
33
34
35
36
37 @BeanTag(name = "viewHeader", parent = "Uif-ViewHeader")
38 public class ViewHeader extends Header {
39 private static final long serialVersionUID = -974112303431464467L;
40
41 private Message areaTitleMessage;
42 private Message supportTitleMessage;
43 private Message metadataMessage;
44 private boolean sticky;
45
46
47
48
49
50
51
52 @Override
53 public void performFinalize(Object model, LifecycleElement parent) {
54 super.performFinalize(model, parent);
55
56 View view = ViewLifecycle.getView();
57 if (supportTitleMessage != null &&
58 view.getCurrentPage() != null && view.getCurrentPage().getHeader() != null &&
59 view.isUnifiedHeader()) {
60 Header pageHeader = view.getCurrentPage().getHeader();
61
62
63 pageHeader.addStyleClass(CssConstants.Classes.HIDE_HEADER_TEXT_STYLE_CLASS);
64
65 Message pageHeaderMessage = pageHeader.getRichHeaderMessage();
66
67 if (pageHeaderMessage != null && StringUtils.isBlank(supportTitleMessage.getMessageText())) {
68 pageHeaderMessage.addStyleClass(CssConstants.Classes.SUPPORT_TITLE_STYLE_CLASS);
69
70
71 supportTitleMessage = pageHeaderMessage;
72 } else if (StringUtils.isNotBlank(pageHeader.getHeaderText()) && StringUtils.isBlank(
73 supportTitleMessage.getMessageText())) {
74
75 supportTitleMessage.setMessageText(pageHeader.getHeaderText().trim());
76 }
77 }
78
79
80 this.getCssClasses().addAll(0, view.getContentContainerCssClasses());
81
82
83 if (this.isSticky()) {
84 this.addDataAttribute(UifConstants.DataAttributes.STICKY, "true");
85 }
86 }
87
88
89
90
91
92
93
94 @BeanTagAttribute
95 public String getAreaTitleText() {
96 return areaTitleMessage.getMessageText();
97 }
98
99
100
101
102
103
104 public void setAreaTitleText(String areaTitle) {
105 areaTitleMessage.setMessageText(areaTitle);
106 }
107
108
109
110
111
112
113 @BeanTagAttribute
114 public Message getAreaTitleMessage() {
115 return areaTitleMessage;
116 }
117
118
119
120
121
122
123 public void setAreaTitleMessage(Message areaTitleMessage) {
124 this.areaTitleMessage = areaTitleMessage;
125 }
126
127
128
129
130
131
132
133
134
135 @BeanTagAttribute
136 public String getSupportTitleText() {
137 return supportTitleMessage.getMessageText();
138 }
139
140
141
142
143
144
145 public void setSupportTitleText(String supportTitle) {
146 supportTitleMessage.setMessageText(supportTitle);
147 }
148
149
150
151
152
153
154
155
156
157
158 @BeanTagAttribute
159 public Message getSupportTitleMessage() {
160 return supportTitleMessage;
161 }
162
163
164
165
166
167
168 public void setSupportTitleMessage(Message supportTitleMessage) {
169 this.supportTitleMessage = supportTitleMessage;
170 }
171
172
173
174
175
176
177
178 @BeanTagAttribute
179 public String getMetadataText() {
180 return metadataMessage.getMessageText();
181 }
182
183
184
185
186
187
188 public void setMetadataText(String metadataText) {
189 metadataMessage.setMessageText(metadataText);
190 }
191
192
193
194
195
196
197
198 @BeanTagAttribute
199 public Message getMetadataMessage() {
200 return metadataMessage;
201 }
202
203
204
205
206
207
208 public void setMetadataMessage(Message metadataMessage) {
209 this.metadataMessage = metadataMessage;
210 }
211
212
213
214
215
216
217 @BeanTagAttribute
218 public boolean isSticky() {
219 return sticky;
220 }
221
222
223
224
225
226
227 public void setSticky(boolean sticky) {
228 this.sticky = sticky;
229 }
230 }