1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 package edu.internet2.middleware.grouper.ui.tags;
31
32 import java.io.IOException;
33
34 import javax.servlet.jsp.JspException;
35 import javax.servlet.jsp.tagext.SimpleTagSupport;
36
37 import org.apache.commons.lang.StringUtils;
38
39 import edu.internet2.middleware.grouper.ui.util.GrouperUiUtils;
40
41
42
43
44
45
46
47
48 public class GrouperComboboxTag extends SimpleTagSupport {
49
50
51 private String id;
52
53
54 private int width = -1;
55
56
57 private String filterOperation;
58
59
60 private String comboDefaultText;
61
62
63 private String comboDefaultValue;
64
65
66 private String additionalFormElementNames;
67
68
69
70
71
72 public void setAdditionalFormElementNames(String additionalFormElementNames1) {
73 this.additionalFormElementNames = additionalFormElementNames1;
74 }
75
76
77
78
79
80 public void setComboDefaultText(String comboDefaultText1) {
81 this.comboDefaultText = comboDefaultText1;
82 }
83
84
85
86
87
88 public void setComboDefaultValue(String comboDefaultValue1) {
89 this.comboDefaultValue = comboDefaultValue1;
90 }
91
92
93
94
95 @Override
96 public void doTag() throws JspException, IOException {
97
98 StringBuilder result = new StringBuilder();
99
100
101
102
103
104
105
106
107
108
109 if (!StringUtils.contains(this.filterOperation, "/")) {
110 this.filterOperation = "../app/" + this.filterOperation;
111 }
112
113 result.append("<div id=\"").append(this.id + "Div").append("\"");
114 if (this.width != -1) {
115
116 result.append(" style=\"").append(this.width).append("\"");
117 }
118 result.append("></div>\n");
119 result.append("<script type=\"text/javascript\"> \n");
120 result.append("guiRegisterDhtmlxCombo('").append(this.id).append("Div', '")
121 .append(this.id).append("', ")
122 .append(this.width == -1 ? null : this.width).append(", true, \"");
123 result.append(this.filterOperation).append("\", ");
124 if (StringUtils.isBlank(this.comboDefaultText)) {
125 result.append("null");
126 } else {
127 result.append("'").append(GrouperUiUtils.escapeJavascript(this.comboDefaultText, true)).append("'");
128 }
129 result.append(", ");
130 if (StringUtils.isBlank(this.comboDefaultValue)) {
131 result.append("null");
132 } else {
133 result.append("'").append(GrouperUiUtils.escapeJavascript(this.comboDefaultValue, true)).append("'");
134 }
135 result.append(", ");
136 if (StringUtils.isBlank(this.additionalFormElementNames)) {
137 result.append("null");
138 } else {
139 result.append("'").append(GrouperUiUtils.escapeJavascript(this.additionalFormElementNames, true)).append("'");
140 }
141 result.append(");\n");
142
143
144 result.append("</script>\n");
145
146 this.getJspContext().getOut().print(result.toString());
147 }
148
149
150
151
152
153 public void setId(String id1) {
154 this.id = id1;
155 }
156
157
158
159
160
161 public void setWidth(int width1) {
162 this.width = width1;
163 }
164
165
166
167
168
169 public void setFilterOperation(String filterOperation1) {
170 this.filterOperation = filterOperation1;
171 }
172
173 }