1
14
15 package com.liferay.taglib.aui;
16
17 import com.liferay.portal.kernel.util.Validator;
18 import com.liferay.taglib.util.IncludeTag;
19 import com.liferay.util.TextFormatter;
20
21 import javax.servlet.http.HttpServletRequest;
22
23
30 public class SelectTag extends IncludeTag {
31
32 public void setBean(Object bean) {
33 _bean = bean;
34 }
35
36 public void setChangesContext(boolean changesContext) {
37 _changesContext = changesContext;
38 }
39
40 public void setCssClass(String cssClass) {
41 _cssClass = cssClass;
42 }
43
44 public void setDisabled(boolean disabled) {
45 _disabled = disabled;
46 }
47
48 public void setFirst(boolean first) {
49 _first = first;
50 }
51
52 public void setHelpMessage(String helpMessage) {
53 _helpMessage = helpMessage;
54 }
55
56 public void setId(String id) {
57 _id = id;
58 }
59
60 public void setInlineField(boolean inlineField) {
61 _inlineField = inlineField;
62 }
63
64 public void setInlineLabel(String inlineLabel) {
65 _inlineLabel = inlineLabel;
66 }
67
68 public void setLabel(String label) {
69 _label = label;
70 }
71
72 public void setLast(boolean last) {
73 _last = last;
74 }
75
76 public void setListType(String listType) {
77 _listType = listType;
78 }
79
80 public void setName(String name) {
81 _name = name;
82 }
83
84 public void setPrefix(String prefix) {
85 _prefix = prefix;
86 }
87
88 public void setShowEmptyOption(boolean showEmptyOption) {
89 _showEmptyOption = showEmptyOption;
90 }
91
92 public void setTitle(String title) {
93 _title = title;
94 }
95
96 public void setSuffix(String suffix) {
97 _suffix = suffix;
98 }
99
100 protected void cleanUp() {
101 _bean = null;
102 _changesContext = false;
103 _cssClass = null;
104 _first = false;
105 _helpMessage = null;
106 _inlineField = false;
107 _inlineLabel = null;
108 _id = null;
109 _label = null;
110 _last = false;
111 _listType = null;
112 _name = null;
113 _prefix = null;
114 _showEmptyOption = false;
115 _suffix = null;
116 _title = null;
117 }
118
119 protected String getEndPage() {
120 return _END_PAGE;
121 }
122
123 protected String getStartPage() {
124 return _START_PAGE;
125 }
126
127 protected boolean isCleanUpSetAttributes() {
128 return _CLEAN_UP_SET_ATTRIBUTES;
129 }
130
131 protected void setAttributes(HttpServletRequest request) {
132 Object bean = _bean;
133
134 if (bean == null) {
135 bean = pageContext.getAttribute("aui:model-context:bean");
136 }
137
138 String id = _id;
139
140 if (Validator.isNull(id)) {
141 id = _name;
142 }
143
144 String label = _label;
145
146 if (label == null) {
147 label = TextFormatter.format(_name, TextFormatter.K);
148 }
149
150 request.setAttribute("aui:select:bean", bean);
151 request.setAttribute(
152 "aui:select:changesContext", String.valueOf(_changesContext));
153 request.setAttribute("aui:select:cssClass", _cssClass);
154 request.setAttribute("aui:select:disabled", String.valueOf(_disabled));
155 request.setAttribute(
156 "aui:select:dynamicAttributes", getDynamicAttributes());
157 request.setAttribute("aui:select:first", String.valueOf(_first));
158 request.setAttribute("aui:select:helpMessage", _helpMessage);
159 request.setAttribute(
160 "aui:select:inlineField", String.valueOf(_inlineField));
161 request.setAttribute("aui:select:inlineLabel", _inlineLabel);
162 request.setAttribute("aui:select:id", id);
163 request.setAttribute("aui:select:label", label);
164 request.setAttribute("aui:select:last", String.valueOf(_last));
165 request.setAttribute("aui:select:listType", _listType);
166 request.setAttribute("aui:select:name", _name);
167 request.setAttribute("aui:select:prefix", _prefix);
168 request.setAttribute(
169 "aui:select:showEmptyOption", String.valueOf(_showEmptyOption));
170 request.setAttribute("aui:select:suffix", _suffix);
171 request.setAttribute("aui:select:title", _title);
172 }
173
174 private static final boolean _CLEAN_UP_SET_ATTRIBUTES = true;
175
176 private static final String _END_PAGE = "/html/taglib/aui/select/end.jsp";
177
178 private static final String _START_PAGE =
179 "/html/taglib/aui/select/start.jsp";
180
181 private Object _bean;
182 private boolean _changesContext;
183 private String _cssClass;
184 private boolean _disabled;
185 private boolean _first;
186 private String _helpMessage;
187 private String _id;
188 private boolean _inlineField;
189 private String _inlineLabel;
190 private String _label;
191 private boolean _last;
192 private String _listType;
193 private String _name;
194 private String _prefix;
195 private boolean _showEmptyOption;
196 private String _suffix;
197 private String _title;
198
199 }