comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 3384:a6b7f0585761

Merge point/line label styles flys-client/trunk@5133 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Christian Lins <christian.lins@intevation.de>
date Thu, 26 Jul 2012 10:05:50 +0000
parents b31b0d249d21
children dbcd14c27c8d
comparison
equal deleted inserted replaced
3383:dc48bc58102f 3384:a6b7f0585761
15 import com.smartgwt.client.widgets.form.fields.CheckboxItem; 15 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
16 import com.smartgwt.client.widgets.form.fields.ColorPickerItem; 16 import com.smartgwt.client.widgets.form.fields.ColorPickerItem;
17 import com.smartgwt.client.widgets.form.fields.FormItem; 17 import com.smartgwt.client.widgets.form.fields.FormItem;
18 import com.smartgwt.client.widgets.form.fields.SelectItem; 18 import com.smartgwt.client.widgets.form.fields.SelectItem;
19 import com.smartgwt.client.widgets.form.fields.StaticTextItem; 19 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
20 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
21 import com.smartgwt.client.widgets.form.fields.events.BlurEvent; 20 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
22 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; 21 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
22 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
23 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; 23 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
24 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
24 import com.smartgwt.client.widgets.layout.HLayout; 25 import com.smartgwt.client.widgets.layout.HLayout;
25 import com.smartgwt.client.widgets.layout.VLayout; 26 import com.smartgwt.client.widgets.layout.VLayout;
26 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
27 27
28 import de.intevation.flys.client.client.Config; 28 import de.intevation.flys.client.client.Config;
29 import de.intevation.flys.client.client.FLYSConstants; 29 import de.intevation.flys.client.client.FLYSConstants;
30 import de.intevation.flys.client.client.services.CollectionItemAttributeService; 30 import de.intevation.flys.client.client.services.CollectionItemAttributeService;
31 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync; 31 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync;
32 import de.intevation.flys.client.client.services.ThemeListingService; 32 import de.intevation.flys.client.client.services.ThemeListingService;
33 import de.intevation.flys.client.client.services.ThemeListingServiceAsync; 33 import de.intevation.flys.client.client.services.ThemeListingServiceAsync;
34 import de.intevation.flys.client.client.utils.DoubleValidator;
34 import de.intevation.flys.client.shared.model.Collection; 35 import de.intevation.flys.client.shared.model.Collection;
35 import de.intevation.flys.client.shared.model.CollectionItemAttribute; 36 import de.intevation.flys.client.shared.model.CollectionItemAttribute;
36 import de.intevation.flys.client.shared.model.FacetRecord; 37 import de.intevation.flys.client.shared.model.FacetRecord;
37 import de.intevation.flys.client.shared.model.Style; 38 import de.intevation.flys.client.shared.model.Style;
38 import de.intevation.flys.client.shared.model.StyleSetting; 39 import de.intevation.flys.client.shared.model.StyleSetting;
39 import de.intevation.flys.client.shared.model.Theme; 40 import de.intevation.flys.client.shared.model.Theme;
40 41
41 import de.intevation.flys.client.client.utils.DoubleValidator;
42
43 import java.util.Arrays; 42 import java.util.Arrays;
44 import java.util.Iterator; 43 import java.util.Iterator;
45 import java.util.LinkedHashMap; 44 import java.util.LinkedHashMap;
46 import java.util.Map; 45 import java.util.Map;
47 import java.util.Set; 46 import java.util.Set;
48 47
49 /** 48 /**
49 * Editor window for styles.
50 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> 50 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
51 */ 51 */
52 public class StyleEditorWindow 52 public class StyleEditorWindow
53 extends Window 53 extends Window
54 implements ClickHandler 54 implements ClickHandler
70 70
71 /** Main layout. */ 71 /** Main layout. */
72 protected VLayout layout; 72 protected VLayout layout;
73 73
74 /** The form that contains all the input widgets. */ 74 /** The form that contains all the input widgets. */
75 DynamicForm df; 75 protected DynamicForm df;
76 76
77 protected VLayout properties; 77 protected VLayout properties;
78 78
79 protected Canvas container; 79 protected Canvas container;
80 80
297 "textcolor", 297 "textcolor",
298 "textorientation", 298 "textorientation",
299 "backgroundcolor", 299 "backgroundcolor",
300 "showbackground", 300 "showbackground",
301 "showlinelabel", 301 "showlinelabel",
302 "linelabelfont", 302 "labelfontface",
303 "linelabelcolor", 303 "labelfontcolor",
304 "linelabelsize", 304 "labelfontsize",
305 "linelabelstyle", 305 "labelfontstyle",
306 "linelabelshowbg", 306 "labelshowbg",
307 "linelabelbgcolor", 307 "labelbgcolor",
308 "showpointlabel",
308 "bandwidthcolor", 309 "bandwidthcolor",
309 "bandwidth"}; 310 "bandwidth"};
310 311
311 for (String settingName: sets) { 312 for (String settingName: sets) {
312 StyleSetting set = style.getSetting(settingName); 313 StyleSetting set = style.getSetting(settingName);
364 if(type.equals("int")) { 365 if(type.equals("int")) {
365 f = new SelectItem(name, MSG.getString(name)); 366 f = new SelectItem(name, MSG.getString(name));
366 if (name.equals("linesize")) { 367 if (name.equals("linesize")) {
367 f = createLineSizeUI(f); 368 f = createLineSizeUI(f);
368 } 369 }
369 else if (name.equals("textsize") || name.equals("linelabelsize")) { 370 else if (name.equals("labelfontsize")) {
370 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); 371 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
371 valueMap.put("3", "3"); 372 valueMap.put("3", "3");
372 valueMap.put("5", "5"); 373 valueMap.put("5", "5");
373 valueMap.put("8", "8"); 374 valueMap.put("8", "8");
374 valueMap.put("10", "10"); 375 valueMap.put("10", "10");
439 440
440 f.setValidators(fpv); 441 f.setValidators(fpv);
441 f.setValidateOnChange(true); 442 f.setValidateOnChange(true);
442 f.setTitle(MSG.getString(name)); 443 f.setTitle(MSG.getString(name));
443 f.addBlurHandler(new BlurHandler() { 444 f.addBlurHandler(new BlurHandler() {
445 @Override
444 public void onBlur(BlurEvent e) { 446 public void onBlur(BlurEvent e) {
445 DoubleValidator validator = new DoubleValidator(); 447 DoubleValidator validator = new DoubleValidator();
446 Map errors = e.getForm().getErrors(); 448 Map<?, ?> errors = e.getForm().getErrors();
447 if(validator.validate(e.getItem(), errors)) { 449 if(validator.validate(e.getItem(), errors)) {
448 e.getForm().setErrors(errors, true); 450 e.getForm().setErrors(errors, true);
449 } 451 }
450 else { 452 else {
451 e.getForm().setErrors(errors, true); 453 e.getForm().setErrors(errors, true);

http://dive4elements.wald.intevation.org