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 java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.commons.lang.StringUtils;
22 import org.kuali.rice.krad.datadictionary.parse.BeanTag;
23 import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
24 import org.kuali.rice.krad.datadictionary.parse.BeanTags;
25 import org.kuali.rice.krad.uif.component.Component;
26 import org.kuali.rice.krad.uif.component.ListAware;
27 import org.kuali.rice.krad.uif.container.Group;
28 import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleRestriction;
29 import org.kuali.rice.krad.uif.util.LifecycleElement;
30
31
32
33
34
35
36
37
38
39
40 @BeanTags({@BeanTag(name = "dropdownToggleMenu-bean", parent = "Uif-DropdownToggleMenu"),
41 @BeanTag(name = "sidebarToggleMenu-bean", parent = "Uif-SidebarToggleMenu")})
42 public class ToggleMenu extends ContentElementBase implements ListAware {
43 private static final long serialVersionUID = -1759659012620124641L;
44
45 private String toggleText;
46 private Message toggleMessage;
47
48 private String toggleCaretClass;
49 private String iconClass;
50 private boolean renderToggleButton;
51 private boolean renderedInList;
52
53 private List<Component> menuItems;
54 private Group menuGroup;
55
56 public ToggleMenu() {
57 super();
58 }
59
60
61
62
63 @Override
64 public void performInitialization(Object model) {
65 super.performInitialization(model);
66
67 if ((this.menuItems != null) && !this.menuItems.isEmpty()) {
68 this.menuGroup.setItems(menuItems);
69 }
70 }
71
72
73
74
75 @Override
76 public void performApplyModel(Object model, LifecycleElement parent) {
77 super.performApplyModel(model, parent);
78
79 if (StringUtils.isNotBlank(toggleText) && StringUtils.isBlank(toggleMessage.getMessageText())) {
80 toggleMessage.setMessageText(toggleText);
81 }
82 }
83
84
85
86
87
88
89
90
91
92
93
94
95
96 @BeanTagAttribute(name = "toggleText")
97 public String getToggleText() {
98 return toggleText;
99 }
100
101
102
103
104 public void setToggleText(String toggleText) {
105 this.toggleText = toggleText;
106 }
107
108
109
110
111
112
113
114 @BeanTagAttribute(name = "toggleMessage")
115 public Message getToggleMessage() {
116 return toggleMessage;
117 }
118
119
120
121
122 public void setToggleMessage(Message toggleMessage) {
123 this.toggleMessage = toggleMessage;
124 }
125
126
127
128
129
130
131 @BeanTagAttribute(name = "toggleCaretClass")
132 public String getToggleCaretClass() {
133 return toggleCaretClass;
134 }
135
136
137
138
139 public void setToggleCaretClass(String toggleCaretClass) {
140 this.toggleCaretClass = toggleCaretClass;
141 }
142
143
144
145
146
147
148 @BeanTagAttribute(name = "iconClass")
149 public String getIconClass() {
150 return iconClass;
151 }
152
153
154
155
156 public void setIconClass(String iconClass) {
157 this.iconClass = iconClass;
158 }
159
160
161
162
163
164
165 @BeanTagAttribute(name = "renderToggleButton")
166 public boolean isRenderToggleButton() {
167 return renderToggleButton;
168 }
169
170
171
172
173 public void setRenderToggleButton(boolean renderToggleButton) {
174 this.renderToggleButton = renderToggleButton;
175 }
176
177
178
179
180 @BeanTagAttribute(name = "renderedInList")
181 public boolean isRenderedInList() {
182 return renderedInList;
183 }
184
185
186
187
188 public void setRenderedInList(boolean renderedInList) {
189 this.renderedInList = renderedInList;
190 }
191
192
193
194
195
196
197
198
199
200
201
202 @ViewLifecycleRestriction
203 @BeanTagAttribute(name = "menuItems", type = BeanTagAttribute.AttributeType.LISTBEAN)
204 public List<Component> getMenuItems() {
205 return menuItems;
206 }
207
208
209
210
211 public void setMenuItems(List<Component> menuItems) {
212 this.menuItems = menuItems;
213 }
214
215
216
217
218
219
220
221
222
223
224 @BeanTagAttribute(name = "menuGroup", type = BeanTagAttribute.AttributeType.SINGLEBEAN)
225 public Group getMenuGroup() {
226 return menuGroup;
227 }
228
229
230
231
232 public void setMenuGroup(Group menuGroup) {
233 this.menuGroup = menuGroup;
234 }
235 }