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