annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java @ 5861:172338b1407f

GWT client: Added copyright header.
author Sascha L. Teichmann <teichmann@intevation.de>
date Sun, 28 Apr 2013 14:30:15 +0200
parents 5aa05a7a34b7
children ea9eef426962
rev   line source
5861
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
2 * Software engineering by Intevation GmbH
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
3 *
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
6 * documentation coming with Dive4Elements River for details.
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
7 */
172338b1407f GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5838
diff changeset
8
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
9 package org.dive4elements.river.client.client.ui;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import com.google.gwt.core.client.GWT;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import com.google.gwt.user.client.rpc.AsyncCallback;
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
13
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
14 import com.smartgwt.client.types.Alignment;
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
15 import com.smartgwt.client.util.SC;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
16 import com.smartgwt.client.widgets.Button;
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
17 import com.smartgwt.client.widgets.Canvas;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
18 import com.smartgwt.client.widgets.Window;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.events.ClickEvent;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import com.smartgwt.client.widgets.events.ClickHandler;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
21 import com.smartgwt.client.widgets.form.DynamicForm;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
24 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
25 import com.smartgwt.client.widgets.form.fields.ColorPickerItem;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
26 import com.smartgwt.client.widgets.form.fields.FormItem;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
27 import com.smartgwt.client.widgets.form.fields.SelectItem;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
28 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
29 import com.smartgwt.client.widgets.form.fields.events.BlurEvent;
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
30 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
31 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
32 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
33 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
34 import com.smartgwt.client.widgets.layout.HLayout;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
35 import com.smartgwt.client.widgets.layout.VLayout;
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
36
5835
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
37 import org.dive4elements.river.client.client.Config;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
38 import org.dive4elements.river.client.client.FLYSConstants;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
39 import org.dive4elements.river.client.client.services.CollectionItemAttributeService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
40 import org.dive4elements.river.client.client.services.CollectionItemAttributeServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
41 import org.dive4elements.river.client.client.services.ThemeListingService;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
42 import org.dive4elements.river.client.client.services.ThemeListingServiceAsync;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
43 import org.dive4elements.river.client.client.utils.DoubleValidator;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
44 import org.dive4elements.river.client.shared.model.Collection;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
45 import org.dive4elements.river.client.shared.model.CollectionItemAttribute;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
46 import org.dive4elements.river.client.shared.model.FacetRecord;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
47 import org.dive4elements.river.client.shared.model.Style;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
48 import org.dive4elements.river.client.shared.model.StyleSetting;
821a02bbfb4e Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5834
diff changeset
49 import org.dive4elements.river.client.shared.model.Theme;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
51 import java.util.Arrays;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
52 import java.util.Iterator;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
53 import java.util.LinkedHashMap;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
54 import java.util.Map;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
55 import java.util.Set;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 /**
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
58 * Editor window for styles.
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 */
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 public class StyleEditorWindow
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 extends Window
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 implements ClickHandler
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 /** The interface that provides i18n messages. */
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
68 /** The collection. */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 protected Collection collection;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
71 /** The parent ThemePanel. */
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
72 protected ThemePanel panel;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
74 /** The attributes. */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75 protected CollectionItemAttribute attributes;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 /** The selected facet. */
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 protected FacetRecord facet;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
80 /** Main layout. */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 protected VLayout layout;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
83 /** The form that contains all the input widgets. */
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
84 protected DynamicForm df;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
85
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
86 protected VLayout properties;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
87
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
88 protected Canvas container;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
89
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
90 protected Map<String, Style> styleGroups;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
91
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
92 protected Style current;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
93
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
94 protected SelectItem styleChooser;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
95
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 /** The service used to set collection item attributes. */
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 protected CollectionItemAttributeServiceAsync itemAttributeService =
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 GWT.create(CollectionItemAttributeService.class);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
100 /** The service used to request a list of themes. */
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
101 protected ThemeListingServiceAsync themeListingService =
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
102 GWT.create(ThemeListingService.class);
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
103
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
104
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
105 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
106 * Setup editor dialog.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
107 * @param collection The collection the current theme belongs to.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
108 * @param attributes The collection attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
109 * @param facet The selected facet.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
110 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 public StyleEditorWindow (
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 Collection collection,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 CollectionItemAttribute attributes,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114 FacetRecord facet)
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 this.collection = collection;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 this.attributes = attributes;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 this.facet = facet;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 this.layout = new VLayout();
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
120 this.properties = new VLayout();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
121 this.container = new Canvas();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
122 this.styleChooser = new SelectItem("style", "Style");
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
123
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
124 styleChooser.setTitleStyle("color:#000;");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
125 styleChooser.setTitleAlign(Alignment.LEFT);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
126 styleChooser.setValue("aktuell");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
127 styleChooser.addChangedHandler(new ChangedHandler() {
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
128 @Override
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
129 public void onChanged(ChangedEvent ce) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
130 String value = ce.getValue().toString();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
131 Style s = null;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
132 if (value.equals("aktuell")) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
133 s = current;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
134 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
135 else if (styleGroups.containsKey(value)) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
136 s = styleGroups.get(value);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
137 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
138
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
139 if (s != null) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
140 setNewStyle(s);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
141 properties.removeMember(container);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
142 container = createPropertyGrid(s);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
143 properties.addMember(container);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
144 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
145 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
146 });
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
147
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
148 DynamicForm f = new DynamicForm();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
149 f.setFields(styleChooser);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
150 f.setColWidths("40%", "60%");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
151
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
152 layout.addMember(f);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 init();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 initPanels();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
158 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
159 * Initialize the window and set the layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
160 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 protected void init() {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 setTitle(MSG.properties());
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 setCanDragReposition(true);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 setCanDragResize(true);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
165 layout.setMargin(10);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
166
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
167 layout.setWidth100();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
168 layout.setHeight100();
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
169
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
170 Config config = Config.getInstance();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
171 String locale = config.getLocale();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
172
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
173 Theme theme = facet.getTheme();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
174 Style style = attributes.getStyle(theme.getFacet(), theme.getIndex());
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
175 if(style == null) {
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
176 GWT.log("StyleEditorWindow.init(): style == null");
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
177 return;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
178 }
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
179 String name = style.getName();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
180 this.current = style;
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
181
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
182 themeListingService.list(
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
183 locale,
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
184 name,
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
185 new AsyncCallback<Map<String, Style> >() {
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
186 @Override
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
187 public void onFailure(Throwable caught) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
188 GWT.log("No listloaded.");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
189 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
190 @Override
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
191 public void onSuccess(Map<String, Style> list) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
192 GWT.log("Successfully loaded list.");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
193
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
194 styleGroups = list;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
195 Set<String> keys = list.keySet();
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
196 LinkedHashMap<String, String> valueMap =
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
197 new LinkedHashMap<String, String>();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
198 valueMap.put("aktuell", "Aktuell");
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
199 Iterator<String> iter = keys.iterator();
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
200 while (iter.hasNext()) {
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
201 String s = iter.next().toString();
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
202 Style tmp = styleGroups.get(s);
2543
d632a6526ad9 Set the facet and the index to valid values.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2540
diff changeset
203 tmp.setFacet(current.getFacet());
d632a6526ad9 Set the facet and the index to valid values.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2540
diff changeset
204 tmp.setIndex(current.getIndex());
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
205 valueMap.put(s, s);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
206 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
207 styleChooser.setValueMap(valueMap);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
208 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
209 });
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
210 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
211
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
212
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
213 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
214 * Initialize the static window content like buttons and main layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
215 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
216 protected void initPanels() {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
217 HLayout buttons = new HLayout();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
218 Button accept = new Button(MSG.label_ok());
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
219 Button cancel = new Button(MSG.label_cancel());
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
220 cancel.addClickHandler(this);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 accept.addClickHandler(new ClickHandler() {
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
222 @Override
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 public void onClick(ClickEvent e) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
224 // TODO Fix this, for whatever reason it doesnt work
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
225 // (always valid).
4697
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
226 if (df == null) {
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
227 return;
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
228 }
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
229 if (!df.hasErrors() && df.validate()) {
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
230 saveStyle();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
231 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
232 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
233 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
234
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
235 buttons.addMember(accept);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
236 buttons.addMember(cancel);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
237 buttons.setAlign(Alignment.CENTER);
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
238 buttons.setHeight(30);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
240 Theme theme = facet.getTheme();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
241 Style style = attributes.getStyle(theme.getFacet(), theme.getIndex());
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
242
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
243 container = createPropertyGrid(style);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
244 properties.addMember(container);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
245 layout.addMember(properties);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246 layout.addMember(buttons);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
247 addItem(layout);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
248 setWidth(400);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
249 setHeight(410);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
253 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
254 * Setter for the parent panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
255 * @param panel The panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
256 */
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
257 public void setThemePanel (ThemePanel panel) {
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
258 this.panel = panel;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
260
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
261
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
262 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
263 * this method is called when the user aborts theming.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
264 * @param event The event.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
265 */
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
266 @Override
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
267 public void onClick(ClickEvent event) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
268 this.hide();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
269 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
270
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
271
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
272 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
273 * This method creates the property grid for available styling attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
274 * @return The layout containing the UI elements.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
275 */
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
276 protected VLayout createPropertyGrid(Style style) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
277 VLayout vl = new VLayout();
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
278
1337
9bf72f84728d Show theme name in static text field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1336
diff changeset
279 StaticTextItem name = new StaticTextItem("name", "Name");
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
280 name.setValue(facet.getName());
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
281 name.setTitleStyle("color:#000;");
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
282 name.setTitleAlign(Alignment.LEFT);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
283 name.setDisabled(true);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
284 name.setShowDisabled(false);
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
285
1450
bb91cdf8407b Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
286 DynamicForm form = new DynamicForm();
bb91cdf8407b Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
287 form.setFields(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
288 form.setColWidths("40%", "60%");
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
289
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
290
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
291 vl.addMember(form);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
292
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
293 if (style == null) {
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
294 SC.warn("No style found.");
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
295 return vl;
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
296 }
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
297
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
298 // Done via array to keep the order.
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
299 String[] sets = {"showlines",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
300 "showpoints",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
301 "linetype",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
302 "linesize",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
303 "linecolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
304 "font",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
305 "textstyle",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
306 "textsize",
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
307 "pointcolor",
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
308 "pointsize",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
309 "showpointlabel",
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
310 "textcolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
311 "backgroundcolor",
2499
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
312 "showbackground",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
313 "showlinelabel",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
314 "labelfontface",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
315 "labelfontcolor",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
316 "labelfontsize",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
317 "labelfontstyle",
3703
4e32de1b6a9e Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents: 3702
diff changeset
318 "textorientation",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
319 "labelshowbg",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
320 "labelbgcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
321 "bandwidth",
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
322 "bandwidthcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
323 "transparency",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
324 "showminimum",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
325 "showmaximum"};
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
326
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
327 for (String settingName: sets) {
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
328 StyleSetting set = style.getSetting(settingName);
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
329
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
330 if (set == null || set.isHidden()) {
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
331 continue;
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
332 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
333
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
334 DynamicForm property = createPropertyUI(
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
335 set.getDisplayName(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
336 set.getName(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
337 set.getType(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
338 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
339 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
340 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
341 }
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
342 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
343
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
344 // Add settings not in whitelist above.
1450
bb91cdf8407b Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
345 for (StyleSetting set: style.getSettings()) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
346
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
347 if (Arrays.asList(sets).contains(set.getName()) ||
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
348 set == null ||
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
349 set.isHidden()
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
350 ) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
351 continue;
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
352 }
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
353
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
354 DynamicForm property = createPropertyUI(
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
355 set.getDisplayName(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
356 set.getName(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
357 set.getType(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
358 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
359 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
360 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
361 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
362 }
1450
bb91cdf8407b Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1425
diff changeset
363
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
364 return vl;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
365 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
366
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
367
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
368 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
369 * Create a property form.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
370 * @param dname The display name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
371 * @param name The property name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
372 * @param type The property type.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
373 * @param value The current value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
374 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
375 * @return The dynamic form for the attribute property.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
376 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
377 protected DynamicForm createPropertyUI(
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
378 String dname,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
379 String name,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
380 String type,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
381 String value)
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
382 {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
383 df = new DynamicForm();
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
384 df.setColWidths("40%", "60%");
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
385
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
386 FormItem f;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
387 if(type.equals("int")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
388 f = new SelectItem(name, MSG.getString(name));
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
389 if (name.equals("linesize")) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
390 f = createLineSizeUI(f);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
391 f.setValue(value);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
392 }
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
393 else if (name.equals("labelfontsize")) {
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
394 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
395 valueMap.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
396 valueMap.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
397 valueMap.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
398 valueMap.put("10", "10");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
399 valueMap.put("12", "12");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
400 valueMap.put("14", "14");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
401 valueMap.put("18", "18");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
402 valueMap.put("24", "24");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
403 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
404 f.setValue(value);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
405 }
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
406 else if (name.equals("bandwidth")) {
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
407 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
408 valueMap.put("0", "0");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
409 valueMap.put("1", "1");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
410 valueMap.put("2", "2");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
411 valueMap.put("3", "3");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
412 valueMap.put("4", "4");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
413 valueMap.put("5", "5");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
414 valueMap.put("6", "6");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
415 valueMap.put("7", "7");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
416 valueMap.put("8", "8");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
417 valueMap.put("9", "9");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
418 valueMap.put("10", "10");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
419 valueMap.put("11", "11");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
420 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
421 f.setValue(value);
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
422 }
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
423 else if (name.equals("pointsize")) {
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
424 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
425 valueMap.put("1", "1");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
426 valueMap.put("2", "2");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
427 valueMap.put("3", "3");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
428 valueMap.put("4", "4");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
429 valueMap.put("5", "5");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
430 valueMap.put("6", "6");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
431 valueMap.put("7", "7");
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
432 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
433 f.setValue(value);
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
434 }
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
435 else if (name.equals("numclasses")) {
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
436 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
437 valueMap.put("5", "5");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
438 valueMap.put("6", "6");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
439 valueMap.put("7", "7");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
440 valueMap.put("8", "8");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
441 valueMap.put("9", "9");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
442 valueMap.put("10", "10");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
443 valueMap.put("12", "12");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
444 valueMap.put("14", "14");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
445 valueMap.put("16", "16");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
446 valueMap.put("18", "18");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
447 valueMap.put("20", "20");
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
448 f.setValueMap(valueMap);
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
449 f.setValue(value);
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
450 // FIXME: Make that work again
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
451 return null;
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
452 }
4687
b3d7d5289b7f Display all 'tranparency' attributes.
Raimund Renkert <rrenkert@intevation.de>
parents: 4666
diff changeset
453 else if (name.contains("transparency")) {
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
454 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
455 for (int n = 10; n < 100; n += 10) {
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
456 valueMap.put(Integer.toString(n), n + "%");
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
457 }
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
458 f.setValueMap(valueMap);
3702
394e1a9915ec Transparency combobox appearence fix for #840.
Christian Lins <christian.lins@intevation.de>
parents: 3700
diff changeset
459 f.setValue(value);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
460 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
461 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
462 else if (type.equals("boolean")) {
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
463 if(name.equals("textorientation")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
464 f = new SelectItem(name, MSG.getString(name));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
465 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
3703
4e32de1b6a9e Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents: 3702
diff changeset
466 valueMap.put("true", MSG.getString("horizontal"));
4e32de1b6a9e Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents: 3702
diff changeset
467 valueMap.put("false", MSG.getString("vertical"));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
468 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
469 f.setValue(value);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
470 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
471 else {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
472 CheckboxItem c = new CheckboxItem(name, MSG.getString(name));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
473 if(value.equals("true")) {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
474 c.setValue(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
475 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
476 else {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
477 c.setValue(false);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
478 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
479 c.setLabelAsTitle(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
480 f = c;
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
481 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
482 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
483 else if (type.equals("Color")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
484 ColorPickerItem c = new ColorPickerItem(name, MSG.getString(name));
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
485 c.setValue(rgbToHtml(value));
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
486 f = c;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
487 }
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
488 else if (type.equals("double")) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
489 f = new FormItem(name);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
490 IsFloatValidator fpv = new IsFloatValidator();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
491
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
492 f.setValidators(fpv);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
493 f.setValidateOnChange(true);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
494 f.setTitle(MSG.getString(name));
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
495 f.addBlurHandler(new BlurHandler() {
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
496 @Override
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
497 public void onBlur(BlurEvent e) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
498 DoubleValidator validator = new DoubleValidator();
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
499 Map<?, ?> errors = e.getForm().getErrors();
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
500 if(validator.validate(e.getItem(), errors)) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
501 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
502 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
503 else {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
504 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
505 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
506 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
507 });
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
508 f.setValue(value);
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
509 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
510 else if (type.equals("Dash")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
511 f = new SelectItem(name, MSG.getString(name));
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
512 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
513 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-dash-");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
514 f.setImageURLSuffix(".png");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
515 f.setValueIconHeight(20);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
516 f.setValueIconWidth(80);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
517 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
518 valueMap.put("10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
519 valueMap.put("10,5", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
520 valueMap.put("20,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
521 valueMap.put("30,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
522 valueMap.put("20,5,15,5", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
523 valueIcons.put("10", "10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
524 valueIcons.put("10,5", "10-5");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
525 valueIcons.put("20,10", "20-10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
526 valueIcons.put("30,10", "30-10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
527 valueIcons.put("20,5,15,5", "20-5-15-5");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
528 f.setValueIcons(valueIcons);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
529 f.setValueMap(valueMap);
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
530 f.setValue(value);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
531 }
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
532 else if (type.equals("Font")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
533 f = new SelectItem(name, MSG.getString(name));
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
534 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
535 valueMap.put("arial", "<span style='font-family:arial'>Arial</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
536 valueMap.put("courier", "<span style='font-family:courier'>Courier</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
537 valueMap.put("verdana", "<span style='font-family:verdana'>Verdana</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
538 valueMap.put("times", "<span style='font-family:times'>Times</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
539 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
540 f.setValue(value);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
541 }
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
542 else if (type.equals("Style")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
543 f = new SelectItem(name, MSG.getString(name));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
544 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
545 valueMap.put("standard", "<span style='font-style:normal'>Normal</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
546 valueMap.put("bold", "<span style='font-weight:bold'>Bold</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
547 valueMap.put("italic", "<span style='font-style:italic'>Italic</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
548 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
549 f.setValue(value);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
550 }
2458
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
551 else if (type.equals("Symbol")) {
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
552 //create an empty element as long as this property can not be
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
553 //changed.
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
554 f = new StaticTextItem("");
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
555 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
556 else {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
557 f = new FormItem();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
558 }
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
559 f.setTitleStyle("color:#000;");
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
560 f.setTitleAlign(Alignment.LEFT);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
561 df.setFields(f);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
562 df.addItemChangedHandler(new ItemChangedHandler() {
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
563 @Override
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
564 public void onItemChanged(ItemChangedEvent e) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
565 String name = e.getItem().getName();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
566 String newValue = e.getNewValue().toString();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
567 setNewValue(name, newValue);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
568 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
569 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
570
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
571 return df;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
572 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
573
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
574
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
575 protected FormItem createLineSizeUI(FormItem f) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
576 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
577 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
578 f.setImageURLSuffix("px.png");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
579 f.setValueIconHeight(20);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
580 f.setValueIconWidth(80);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
581 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
582 valueMap.put("1", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
583 valueMap.put("2", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
584 valueMap.put("3", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
585 valueMap.put("4", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
586 valueMap.put("5", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
587 valueMap.put("6", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
588 valueMap.put("7", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
589 valueMap.put("8", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
590 valueIcons.put("1", "1");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
591 valueIcons.put("2", "2");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
592 valueIcons.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
593 valueIcons.put("4", "4");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
594 valueIcons.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
595 valueIcons.put("6", "6");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
596 valueIcons.put("7", "7");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
597 valueIcons.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
598 f.setValueIcons(valueIcons);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
599 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
600 return f;
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
601 }
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
602
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
603
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
604 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
605 * Static method to convert a color from RGB to HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
606 * @param rgb String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
607 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
608 * @return String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
609 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
610 protected static String rgbToHtml(String rgb) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
611 String[] parts = rgb.split(",");
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
612 int values[] = new int[parts.length];
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
613 for (int i = 0; i < parts.length; i++) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
614 parts[i] = parts[i].trim();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
615 try {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
616 values[i] = Integer.parseInt(parts[i]);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
617 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
618 catch(NumberFormatException nfe) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
619 return "#000000";
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
620 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
621 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
622 String hex = "#";
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
623 for (int i = 0; i < values.length; i++) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
624 if (values[i] < 16) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
625 hex += "0";
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
626 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
627 hex += Integer.toHexString(values[i]);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
628 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
629 return hex;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
630 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
631
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
632
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
633 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
634 * Static method to convert a color from HTML to RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
635 * @param html String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
636 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
637 * @return String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
638 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
639 protected static String htmlToRgb(String html) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
640 if (!html.startsWith("#")) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
641 return "0, 0, 0";
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
642 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
643
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
644 int r = Integer.valueOf(html.substring(1, 3), 16);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
645 int g = Integer.valueOf(html.substring(3, 5), 16);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
646 int b = Integer.valueOf(html.substring(5, 7), 16);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
647
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
648 return r + ", " + g + ", " + b;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
649 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
650
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
651
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
652 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
653 * Saves the current style attributes and requests a redraw.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
654 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
655 protected void saveStyle () {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
656 GWT.log("StyleEditorWindow.saveStyle()");
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
657 Config config = Config.getInstance();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
658 String locale = config.getLocale();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
659
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
660 itemAttributeService.setCollectionItemAttribute(
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
661 this.collection,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
662 attributes.getArtifact(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
663 locale,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
664 attributes,
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
665 new AsyncCallback<Void>() {
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
666 @Override
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
667 public void onFailure (Throwable caught) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
668 GWT.log("Could not set Collection item attributes.");
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
669 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
670 @Override
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
671 public void onSuccess(Void v) {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
672 GWT.log("Successfully saved collection item attributes.");
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
673 panel.requestRedraw();
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
674 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
675 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
676
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
677
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
678 this.hide();
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
679 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
680
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
681
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
682 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
683 * Sets a new value for an attribute.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
684 * @param name Attribute name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
685 * @param value The new value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
686 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
687 protected final void setNewValue(String name, String value) {
1326
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
688 Theme t = facet.getTheme();
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
689 Style s = attributes.getStyle(t.getFacet(), t.getIndex());
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
690 StyleSetting set = s.getSetting(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
691 String type = set.getType();
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
692
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
693 if(name.indexOf("color") != -1
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
694 || (type != null && type.toLowerCase().indexOf("color") > -1)) {
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
695 value = htmlToRgb(value);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
696 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
697 set.setDefaultValue(value);
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
698 }
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
699
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
700
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
701 protected final void setNewStyle(Style style) {
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
702 Theme t = facet.getTheme();
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
703 Style s = attributes.getStyle(t.getFacet(), t.getIndex());
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
704 attributes.removeStyle(s.getName());
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
705 attributes.appendStyle(style);
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
706 }
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
707 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
708 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org