annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java @ 8913:924cd9943337

Configured some real fill patterns
author gernotbelger
date Mon, 26 Feb 2018 18:10:03 +0100
parents d9c89651bd67
children
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 *
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
4 * This file is Free Software under the GNU AGPL (>=v3)
5861
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
5993
ea9eef426962 Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5861
diff changeset
6 * documentation coming with Dive4Elements River for details.
5861
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.LinkedHashMap;
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.Map;
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.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
55
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 /**
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
57 * 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
58 * @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
59 */
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 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
61 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
62 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
63 {
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 /** 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
65 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
66
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
67 /** 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
68 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
69
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
70 /** The parent ThemePanel. */
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
71 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
72
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
73 /** 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
74 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
75
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 /** 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
77 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
78
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
79 /** 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
80 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
81
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
82 /** 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
83 protected DynamicForm df;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
84
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
85 protected VLayout properties;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
86
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
87 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
88
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 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
90
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 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
92
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 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
94
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
95 /** 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
96 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
97 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
98
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
99 /** 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
100 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
101 GWT.create(ThemeListingService.class);
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
102
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
103
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
104 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
105 * Setup editor dialog.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
106 * @param collection The collection the current theme belongs to.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
107 * @param attributes The collection attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
108 * @param facet The selected facet.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
109 */
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
110 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
111 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
112 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
113 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
114 {
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 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
116 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
117 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
118 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
119 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
120 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
121 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
122
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
123 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
124 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
125 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
126 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
127 @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
128 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
129 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
130 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
131 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
132 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
133 }
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 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
135 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
136 }
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 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
139 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
140 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
141 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
142 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
143 }
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 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
148 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
149 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
150
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 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
152 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
153 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
154 }
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
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
157 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
158 * Initialize the window and set the layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
159 */
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
160 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
161 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
162 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
163 setCanDragResize(true);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
164 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
165
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 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
167 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
168
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 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
170 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
171
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 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
173 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
174 if(style == null) {
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
175 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
176 return;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
177 }
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
178 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
179 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
180
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 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
182 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
183 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
184 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
185 @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
186 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
187 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
188 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
189 @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
190 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
191 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
192
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 styleGroups = list;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
194 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
195 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
196 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
197 valueMap.put("aktuell", "Aktuell");
6100
de92e0cdebdc GWT client: Removed some Iterator cruft.
Sascha L. Teichmann <teichmann@intevation.de>
parents: 5993
diff changeset
198 for (String s: keys) {
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
199 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
200 tmp.setFacet(current.getFacet());
d632a6526ad9 Set the facet and the index to valid values.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2540
diff changeset
201 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
202 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
203 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
204 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
205 }
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 });
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
207 }
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
208
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
209
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
210 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
211 * Initialize the static window content like buttons and main layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
212 */
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
213 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
214 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
215 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
216 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
217 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
218 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
219 @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
220 public void onClick(ClickEvent e) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
221 // 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
222 // (always valid).
4697
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
223 if (df == null) {
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
224 return;
52068f1231da Fixed NPE in empty style editor window.
Raimund Renkert <rrenkert@intevation.de>
parents: 4687
diff changeset
225 }
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
226 if (!df.hasErrors() && df.validate()) {
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
227 saveStyle();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
228 }
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
229 }
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
230 });
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
231
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 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
233 buttons.addMember(cancel);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
234 buttons.setAlign(Alignment.CENTER);
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
235 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
236
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
237 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
238 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
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 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
241 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
242 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
243 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
244 addItem(layout);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
245 setWidth(400);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
246 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
247 }
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
248
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
249
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
250 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
251 * Setter for the parent panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
252 * @param panel The panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
253 */
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
254 public void setThemePanel (ThemePanel panel) {
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
255 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
256 }
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
257
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
258
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
259 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
260 * this method is called when the user aborts theming.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
261 * @param event The event.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
262 */
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
263 @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
264 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
265 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
266 }
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
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
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
269 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
270 * This method creates the property grid for available styling attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
271 * @return The layout containing the UI elements.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
272 */
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
273 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
274 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
275
1337
9bf72f84728d Show theme name in static text field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1336
diff changeset
276 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
277 name.setValue(facet.getName());
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
278 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
279 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
280 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
281 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
282
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
283 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
284 form.setFields(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
285 form.setColWidths("40%", "60%");
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
286
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
287
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
288 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
289
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
290 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
291 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
292 return vl;
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
293 }
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
294
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
295 // 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
296 String[] sets = {"showlines",
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
297 "showborder",
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
298 "showpoints",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
299 "linetype",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
300 "linesize",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
301 "linecolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
302 "font",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
303 "textstyle",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
304 "textsize",
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
305 "pointcolor",
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
306 "pointsize",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
307 "showpointlabel",
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
308 "textcolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
309 "backgroundcolor",
2499
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
310 "showbackground",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
311 "showlinelabel",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
312 "labelfontface",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
313 "labelfontcolor",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
314 "labelfontsize",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
315 "labelfontstyle",
3703
4e32de1b6a9e Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents: 3702
diff changeset
316 "textorientation",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
317 "labelshowbg",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
318 "labelbgcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
319 "bandwidth",
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
320 "bandwidthcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
321 "transparency",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
322 "showminimum",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
323 "showmaximum"};
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
324
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
325 for (String settingName: sets) {
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
326 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
327
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
328 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
329 continue;
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
330 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
331
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
332 DynamicForm property = createPropertyUI(
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
333 set.getDisplayName(),
8601
5b568f7f18bc Lowercase additional call to createPropertyUi
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8600
diff changeset
334 set.getName().toLowerCase(),
5b568f7f18bc Lowercase additional call to createPropertyUi
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8600
diff changeset
335 set.getType().toLowerCase(),
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
336 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
337 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
338 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
339 }
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
340 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
341
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
342 // 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
343 for (StyleSetting set: style.getSettings()) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
344
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
345 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
346 set == null ||
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
347 set.isHidden()
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
348 ) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
349 continue;
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
350 }
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
351
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
352 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
353 set.getDisplayName(),
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
354 set.getName().toLowerCase(),
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
355 set.getType().toLowerCase(),
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
356 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
357 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
358 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
359 }
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
360 }
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
361
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
362 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
363 }
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
364
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
365
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
366 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
367 * Create a property form.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
368 * @param dname The display name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
369 * @param name The property name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
370 * @param type The property type.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
371 * @param value The current value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
372 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
373 * @return The dynamic form for the attribute property.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
374 */
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
375 protected DynamicForm createPropertyUI(
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
376 // FIXME: display name (which comes from the server side) is not used but i10n happens on client side,,
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 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
378 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
379 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
380 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
381 {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
382 df = new DynamicForm();
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
383 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
384
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 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
386 if(type.equals("int")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
387 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
388 if (name.equals("linesize")) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
389 f = createLineSizeUI(f);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
390 f.setValue(value);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
391 }
7581
b2d750a6df9f issue1606: Handle textstyle property in clients StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6100
diff changeset
392 else if (name.equals("labelfontsize") || name.equals("textsize")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
393 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
394 new LinkedHashMap<String, String>();
1348
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")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
407 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
408 new LinkedHashMap<String, String>();
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
409 valueMap.put("0", "0");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
410 valueMap.put("1", "1");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
411 valueMap.put("2", "2");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
412 valueMap.put("3", "3");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
413 valueMap.put("4", "4");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
414 valueMap.put("5", "5");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
415 valueMap.put("6", "6");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
416 valueMap.put("7", "7");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
417 valueMap.put("8", "8");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
418 valueMap.put("9", "9");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
419 valueMap.put("10", "10");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
420 valueMap.put("11", "11");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
421 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
422 f.setValue(value);
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
423 }
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
424 else if (name.equals("pointsize")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
425 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
426 new LinkedHashMap<String, String>();
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
427 valueMap.put("1", "1");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
428 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
429 valueMap.put("3", "3");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
430 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
431 valueMap.put("5", "5");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
432 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
433 valueMap.put("7", "7");
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
434 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
435 f.setValue(value);
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
436 }
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
437 else if (name.equals("numclasses")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
438 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
439 new LinkedHashMap<String, String>();
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
440 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
441 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
442 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
443 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
444 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
445 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
446 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
447 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
448 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
449 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
450 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
451 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
452 f.setValue(value);
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
453 // 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
454 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
455 }
4687
b3d7d5289b7f Display all 'tranparency' attributes.
Raimund Renkert <rrenkert@intevation.de>
parents: 4666
diff changeset
456 else if (name.contains("transparency")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
457 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
458 new LinkedHashMap<String, String>();
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
459 for (int n = 10; n < 100; n += 10) {
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
460 valueMap.put(Integer.toString(n), n + "%");
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
461 }
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
462 f.setValueMap(valueMap);
3702
394e1a9915ec Transparency combobox appearence fix for #840.
Christian Lins <christian.lins@intevation.de>
parents: 3700
diff changeset
463 f.setValue(value);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
464 }
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
465 }
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
466 else if (type.equals("boolean")) {
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
467 if(name.equals("textorientation")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
468 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
469 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
470 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
471 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
472 valueMap.put("false", MSG.getString("vertical"));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
473 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
474 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
475 }
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
476 else {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
477 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
478 if(value.equals("true")) {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
479 c.setValue(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
480 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
481 else {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
482 c.setValue(false);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
483 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
484 c.setLabelAsTitle(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
485 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
486 }
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 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
488 else if (type.equals("color")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
489 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
490 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
491 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
492 }
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
493 else if (type.equals("double")) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
494 f = new FormItem(name);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
495 IsFloatValidator fpv = new IsFloatValidator();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
496
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
497 f.setValidators(fpv);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
498 f.setValidateOnChange(true);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
499 f.setTitle(MSG.getString(name));
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
500 f.addBlurHandler(new BlurHandler() {
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
501 @Override
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
502 public void onBlur(BlurEvent e) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
503 DoubleValidator validator = new DoubleValidator();
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
504 Map<?, ?> errors = e.getForm().getErrors();
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
505 if(validator.validate(e.getItem(), errors)) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
506 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
507 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
508 else {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
509 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
510 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
511 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
512 });
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
513 f.setValue(value);
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
514 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
515 else if (type.equals("dash")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
516 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
517 LinkedHashMap<String, String> valueIcons =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
518 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
519 f.setImageURLPrefix(GWT.getHostPageBaseURL()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
520 + "images/linestyle-dash-");
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
521 f.setImageURLSuffix(".png");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
522 f.setValueIconHeight(20);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
523 f.setValueIconWidth(80);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
524 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
525 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
526 valueMap.put("10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
527 valueMap.put("10,5", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
528 valueMap.put("20,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
529 valueMap.put("30,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
530 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
531 valueIcons.put("10", "10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
532 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
533 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
534 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
535 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
536 f.setValueIcons(valueIcons);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
537 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
538 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
539 }
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
540 else if (type.equals("areapattern")) {
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
541 f = createAreaPetternUi(name, value);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
542 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
543 else if (type.equals("font")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
544 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
545 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
546 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
547 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
548 "arial", "<span style='font-family:arial'>Arial</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
549 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
550 "courier", "<span style='font-family:courier'>Courier</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
551 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
552 "verdana", "<span style='font-family:verdana'>Verdana</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
553 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
554 "times", "<span style='font-family:times'>Times</span>");
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
555 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
556 f.setValue(value);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
557 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
558 else if (type.equals("style")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
559 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
560 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
561 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
562 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
563 "standard", "<span style='font-style:normal'>Normal</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
564 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
565 "bold", "<span style='font-weight:bold'>Bold</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
566 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
567 "italic", "<span style='font-style:italic'>Italic</span>");
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
568 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
569 f.setValue(value);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
570 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
571 else if (type.equals("symbol")) {
2458
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
572 //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
573 //changed.
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
574 f = new StaticTextItem("");
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
575 }
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
576 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
577 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
578 }
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
579 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
580 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
581 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
582 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
583 @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
584 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
585 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
586 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
587 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
588 }
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
589 });
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
590
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
591 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
592 }
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
593
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
594
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
595 private FormItem createAreaPetternUi(String name, String value) {
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
596 final FormItem f = new SelectItem(name, MSG.getString(name));
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
597
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
598 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/areapattern-");
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
599 f.setImageURLSuffix(".png");
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
600 f.setValueIconHeight(20);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
601 f.setValueIconWidth(80);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
602
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
603 final LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
604 final Map<String, String> valueIcons = new LinkedHashMap<String, String>();
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
605
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
606 // FIXME: ugly, using knowledge of available patterns at this point, creating redundancy with AreaFillPattern enum.
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
607 // But the whole code does it like that, so this is 'flys style'
8913
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
608 final String[] patterns = new String[] {"patternFill", //
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
609 "patternPoints", //
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
610 "paternCross", //
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
611 "patternDagonalLeft", //
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
612 "patternDiagonalRight"};
924cd9943337 Configured some real fill patterns
gernotbelger
parents: 8910
diff changeset
613
8910
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
614 for (int i = 0; i < patterns.length; i++) {
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
615 final String pattern = patterns[i];
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
616
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
617 valueMap.put(pattern, "");
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
618 valueIcons.put(pattern, pattern);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
619 }
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
620
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
621 f.setValueIcons(valueIcons);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
622 f.setValueMap(valueMap);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
623 f.setValue(value);
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
624 return f;
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
625 }
d9c89651bd67 Area chart layers may now have an 'arebgpattern'. Real pattern yet to be defined.
gernotbelger
parents: 8856
diff changeset
626
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
627 protected FormItem createLineSizeUI(FormItem f) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
628 LinkedHashMap<String, String> valueIcons =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
629 new LinkedHashMap<String, String>();
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
630 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
631 f.setImageURLSuffix("px.png");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
632 f.setValueIconHeight(20);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
633 f.setValueIconWidth(80);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
634 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
635 new LinkedHashMap<String, String>();
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
636 valueMap.put("1", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
637 valueMap.put("2", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
638 valueMap.put("3", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
639 valueMap.put("4", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
640 valueMap.put("5", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
641 valueMap.put("6", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
642 valueMap.put("7", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
643 valueMap.put("8", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
644 valueIcons.put("1", "1");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
645 valueIcons.put("2", "2");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
646 valueIcons.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
647 valueIcons.put("4", "4");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
648 valueIcons.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
649 valueIcons.put("6", "6");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
650 valueIcons.put("7", "7");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
651 valueIcons.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
652 f.setValueIcons(valueIcons);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
653 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
654 return f;
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
655 }
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
656
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
657
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
658 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
659 * Static method to convert a color from RGB to HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
660 * @param rgb String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
661 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
662 * @return String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
663 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
664 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
665 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
666 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
667 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
668 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
669 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
670 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
671 }
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 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
673 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
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 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
677 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
678 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
679 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
680 }
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
681 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
682 }
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
683 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
684 }
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
685
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
686
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
687 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
688 * Static method to convert a color from HTML to RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
689 * @param html String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
690 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
691 * @return String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
692 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
693 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
694 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
695 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
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
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 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
699 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
700 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
701
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
702 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
703 }
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
704
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
705
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
706 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
707 * Saves the current style attributes and requests a redraw.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
708 */
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
709 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
710 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
711 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
712 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
713
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
714 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
715 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
716 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
717 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
718 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
719 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
720 @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
721 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
722 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
723 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
724 @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
725 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
726 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
727 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
728 }
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
729 });
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
730
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
731
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
732 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
733 }
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
734
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
735
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
736 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
737 * Sets a new value for an attribute.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
738 * @param name Attribute name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
739 * @param value The new value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
740 */
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
741 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
742 Theme t = facet.getTheme();
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
743 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
744 StyleSetting set = s.getSetting(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
745 String type = set.getType();
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
746
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
747 if(name.indexOf("color") != -1
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
748 || (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
749 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
750 }
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
751 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
752 }
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
753
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
754
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
755 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
756 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
757 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
758 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
759 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
760 }
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
761 }
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
762 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org