Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 1341:e26088566e8a
Use images for line type and line size selection.
flys-client/trunk@2991 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Mon, 17 Oct 2011 15:17:28 +0000 |
parents | d935fd42ae0e |
children | 92074508a387 |
comparison
equal
deleted
inserted
replaced
1340:290d5687f202 | 1341:e26088566e8a |
---|---|
1 package de.intevation.flys.client.client.ui; | 1 package de.intevation.flys.client.client.ui; |
2 | |
3 import java.util.LinkedHashMap; | |
2 | 4 |
3 import com.google.gwt.core.client.GWT; | 5 import com.google.gwt.core.client.GWT; |
4 import com.google.gwt.user.client.rpc.AsyncCallback; | 6 import com.google.gwt.user.client.rpc.AsyncCallback; |
5 | 7 |
6 import com.smartgwt.client.widgets.Window; | 8 import com.smartgwt.client.widgets.Window; |
10 import com.smartgwt.client.widgets.form.DynamicForm; | 12 import com.smartgwt.client.widgets.form.DynamicForm; |
11 import com.smartgwt.client.widgets.form.fields.FormItem; | 13 import com.smartgwt.client.widgets.form.fields.FormItem; |
12 import com.smartgwt.client.widgets.form.fields.CheckboxItem; | 14 import com.smartgwt.client.widgets.form.fields.CheckboxItem; |
13 import com.smartgwt.client.widgets.form.fields.SpinnerItem; | 15 import com.smartgwt.client.widgets.form.fields.SpinnerItem; |
14 import com.smartgwt.client.widgets.form.fields.ColorPickerItem; | 16 import com.smartgwt.client.widgets.form.fields.ColorPickerItem; |
15 import com.smartgwt.client.widgets.form.fields.ComboBoxItem; | 17 import com.smartgwt.client.widgets.form.fields.SelectItem; |
16 import com.smartgwt.client.widgets.form.fields.StaticTextItem; | 18 import com.smartgwt.client.widgets.form.fields.StaticTextItem; |
17 | 19 |
18 import com.smartgwt.client.widgets.events.ClickEvent; | 20 import com.smartgwt.client.widgets.events.ClickEvent; |
19 import com.smartgwt.client.widgets.events.ClickHandler; | 21 import com.smartgwt.client.widgets.events.ClickHandler; |
20 import com.smartgwt.client.widgets.form.events.ItemChangedEvent; | 22 import com.smartgwt.client.widgets.form.events.ItemChangedEvent; |
160 { | 162 { |
161 DynamicForm df = new DynamicForm(); | 163 DynamicForm df = new DynamicForm(); |
162 | 164 |
163 FormItem f; | 165 FormItem f; |
164 if(type.equals("int")) { | 166 if(type.equals("int")) { |
165 SpinnerItem s = new SpinnerItem(name, dname); | 167 f = new SelectItem(name, dname); |
166 s.setMin(1); | 168 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); |
167 s.setMax(10); | 169 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-"); |
168 s.setValue(value); | 170 f.setImageURLSuffix("px.png"); |
169 f = s; | 171 f.setValueIconHeight(20); |
172 f.setValueIconWidth(80); | |
173 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | |
174 valueMap.put("1", ""); | |
175 valueMap.put("2", ""); | |
176 valueMap.put("3", ""); | |
177 valueMap.put("4", ""); | |
178 valueMap.put("5", ""); | |
179 valueMap.put("6", ""); | |
180 valueMap.put("7", ""); | |
181 valueMap.put("8", ""); | |
182 valueIcons.put("1", "1"); | |
183 valueIcons.put("2", "2"); | |
184 valueIcons.put("3", "3"); | |
185 valueIcons.put("4", "4"); | |
186 valueIcons.put("5", "5"); | |
187 valueIcons.put("6", "6"); | |
188 valueIcons.put("7", "7"); | |
189 valueIcons.put("8", "8"); | |
190 f.setValueIcons(valueIcons); | |
191 f.setValueMap(valueMap); | |
192 f.setValue(value); | |
170 } | 193 } |
171 else if (type.equals("boolean")) { | 194 else if (type.equals("boolean")) { |
172 CheckboxItem c = new CheckboxItem(name, dname); | 195 CheckboxItem c = new CheckboxItem(name, dname); |
173 if(value.equals("true")) { | 196 if(value.equals("true")) { |
174 c.setValue(true); | 197 c.setValue(true); |
183 ColorPickerItem c = new ColorPickerItem(name, dname); | 206 ColorPickerItem c = new ColorPickerItem(name, dname); |
184 c.setValue(rgbToHtml(value)); | 207 c.setValue(rgbToHtml(value)); |
185 f = c; | 208 f = c; |
186 } | 209 } |
187 else if (type.equals("Dash")) { | 210 else if (type.equals("Dash")) { |
188 f = new ComboBoxItem(name, dname); | 211 f = new SelectItem(name, dname); |
189 f.setValueMap("10", "10,5", "20,10", "30,10", "20,5,15,5"); | 212 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>(); |
213 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-dash-"); | |
214 f.setImageURLSuffix(".png"); | |
215 f.setValueIconHeight(20); | |
216 f.setValueIconWidth(80); | |
217 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); | |
218 valueMap.put("10", ""); | |
219 valueMap.put("10,5", ""); | |
220 valueMap.put("20,10", ""); | |
221 valueMap.put("30,10", ""); | |
222 valueMap.put("20,5,15,5", ""); | |
223 valueIcons.put("10", "10"); | |
224 valueIcons.put("10,5", "10-5"); | |
225 valueIcons.put("20,10", "20-10"); | |
226 valueIcons.put("30,10", "30-10"); | |
227 valueIcons.put("20,5,15,5", "20-5-15-5"); | |
228 f.setValueIcons(valueIcons); | |
229 f.setValueMap(valueMap); | |
190 f.setValue(value); | 230 f.setValue(value); |
191 } | 231 } |
192 else { | 232 else { |
193 f = new FormItem(); | 233 f = new FormItem(); |
194 } | 234 } |