annotate gwt-client/src/main/java/org/dive4elements/river/client/client/ui/StyleEditorWindow.java @ 8856:5e38e2924c07 3.2.x

Fix code style.
author Tom Gottfried <tom@intevation.de>
date Thu, 18 Jan 2018 20:12:01 +0100
parents 5b568f7f18bc
children d9c89651bd67
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",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
297 "showpoints",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
298 "linetype",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
299 "linesize",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
300 "linecolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
301 "font",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
302 "textstyle",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
303 "textsize",
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
304 "pointcolor",
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
305 "pointsize",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
306 "showpointlabel",
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
307 "textcolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
308 "backgroundcolor",
2499
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
309 "showbackground",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
310 "showlinelabel",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
311 "labelfontface",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
312 "labelfontcolor",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
313 "labelfontsize",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
314 "labelfontstyle",
3703
4e32de1b6a9e Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents: 3702
diff changeset
315 "textorientation",
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
316 "labelshowbg",
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
317 "labelbgcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
318 "bandwidth",
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
319 "bandwidthcolor",
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
320 "transparency",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
321 "showminimum",
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
322 "showmaximum"};
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
323
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
324 for (String settingName: sets) {
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
325 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
326
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
327 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
328 continue;
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
329 }
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 DynamicForm property = createPropertyUI(
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
332 set.getDisplayName(),
8601
5b568f7f18bc Lowercase additional call to createPropertyUi
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8600
diff changeset
333 set.getName().toLowerCase(),
5b568f7f18bc Lowercase additional call to createPropertyUi
Andre Heinecke <andre.heinecke@intevation.de>
parents: 8600
diff changeset
334 set.getType().toLowerCase(),
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
335 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
336 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
337 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
338 }
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
339 }
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 // 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
342 for (StyleSetting set: style.getSettings()) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
343
4666
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
344 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
345 set == null ||
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
346 set.isHidden()
28eb979ae31b Reordered some attributes in editor ui and use the hidden attribute.
Raimund Renkert <rrenkert@intevation.de>
parents: 4577
diff changeset
347 ) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
348 continue;
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
349 }
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
350
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
351 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
352 set.getDisplayName(),
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
353 set.getName().toLowerCase(),
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
354 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
355 set.getDefaultValue());
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
356 if (property != null) {
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
357 vl.addMember(property);
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
358 }
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
359 }
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
360
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
361 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
362 }
a95e82d6bcc1 Refactored the code to create 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
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
364
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
365 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
366 * Create a property form.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
367 * @param dname The display name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
368 * @param name The property name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
369 * @param type The property type.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
370 * @param value The current value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
371 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
372 * @return The dynamic form for the attribute property.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
373 */
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
374 protected DynamicForm createPropertyUI(
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
375 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
376 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
377 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
378 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
379 {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
380 df = new DynamicForm();
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
381 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
382
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
383 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
384 if(type.equals("int")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
385 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
386 if (name.equals("linesize")) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
387 f = createLineSizeUI(f);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
388 f.setValue(value);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
389 }
7581
b2d750a6df9f issue1606: Handle textstyle property in clients StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 6100
diff changeset
390 else if (name.equals("labelfontsize") || name.equals("textsize")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
391 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
392 new LinkedHashMap<String, String>();
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
393 valueMap.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
394 valueMap.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
395 valueMap.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
396 valueMap.put("10", "10");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
397 valueMap.put("12", "12");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
398 valueMap.put("14", "14");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
399 valueMap.put("18", "18");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
400 valueMap.put("24", "24");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
401 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
402 f.setValue(value);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
403 }
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
404 else if (name.equals("bandwidth")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
405 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
406 new LinkedHashMap<String, String>();
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
407 valueMap.put("0", "0");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
408 valueMap.put("1", "1");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
409 valueMap.put("2", "2");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
410 valueMap.put("3", "3");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
411 valueMap.put("4", "4");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
412 valueMap.put("5", "5");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
413 valueMap.put("6", "6");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
414 valueMap.put("7", "7");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
415 valueMap.put("8", "8");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
416 valueMap.put("9", "9");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
417 valueMap.put("10", "10");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
418 valueMap.put("11", "11");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
419 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
420 f.setValue(value);
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
421 }
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
422 else if (name.equals("pointsize")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
423 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
424 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
425 valueMap.put("1", "1");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
426 valueMap.put("2", "2");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
427 valueMap.put("3", "3");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
428 valueMap.put("4", "4");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
429 valueMap.put("5", "5");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
430 valueMap.put("6", "6");
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
431 valueMap.put("7", "7");
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
432 f.setValueMap(valueMap);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
433 f.setValue(value);
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
434 }
4577
1c6c2ddac3d6 Work on dynamic color classes for floodmap (work in progress, not yet functional).
Christian Lins <christian.lins@intevation.de>
parents: 4433
diff changeset
435 else if (name.equals("numclasses")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
436 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
437 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
438 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
439 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
440 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
441 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
442 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
443 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
444 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
445 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
446 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
447 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
448 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
449 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
450 f.setValue(value);
5658
995320711d80 Temporary remove classification from floodmap plane theme editor (#801).
Christian Lins <christian.lins@intevation.de>
parents: 4697
diff changeset
451 // 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
452 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
453 }
4687
b3d7d5289b7f Display all 'tranparency' attributes.
Raimund Renkert <rrenkert@intevation.de>
parents: 4666
diff changeset
454 else if (name.contains("transparency")) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
455 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
456 new LinkedHashMap<String, String>();
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
457 for (int n = 10; n < 100; n += 10) {
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
458 valueMap.put(Integer.toString(n), n + "%");
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
459 }
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
460 f.setValueMap(valueMap);
3702
394e1a9915ec Transparency combobox appearence fix for #840.
Christian Lins <christian.lins@intevation.de>
parents: 3700
diff changeset
461 f.setValue(value);
3700
dbcd14c27c8d Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents: 3384
diff changeset
462 }
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
463 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
464 else if (type.equals("boolean")) {
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
465 if(name.equals("textorientation")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
466 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
467 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
468 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
469 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
470 valueMap.put("false", MSG.getString("vertical"));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
471 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
472 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
473 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
474 else {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
475 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
476 if(value.equals("true")) {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
477 c.setValue(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
478 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
479 else {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
480 c.setValue(false);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
481 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
482 c.setLabelAsTitle(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
483 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
484 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
485 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
486 else if (type.equals("color")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
487 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
488 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
489 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
490 }
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
491 else if (type.equals("double")) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
492 f = new FormItem(name);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
493 IsFloatValidator fpv = new IsFloatValidator();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
494
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
495 f.setValidators(fpv);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
496 f.setValidateOnChange(true);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
497 f.setTitle(MSG.getString(name));
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
498 f.addBlurHandler(new BlurHandler() {
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
499 @Override
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
500 public void onBlur(BlurEvent e) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
501 DoubleValidator validator = new DoubleValidator();
3384
a6b7f0585761 Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents: 3364
diff changeset
502 Map<?, ?> errors = e.getForm().getErrors();
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
503 if(validator.validate(e.getItem(), errors)) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
504 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
505 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
506 else {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
507 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
508 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
509 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
510 });
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
511 f.setValue(value);
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
512 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
513 else if (type.equals("dash")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
514 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
515 LinkedHashMap<String, String> valueIcons =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
516 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
517 f.setImageURLPrefix(GWT.getHostPageBaseURL()
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
518 + "images/linestyle-dash-");
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
519 f.setImageURLSuffix(".png");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
520 f.setValueIconHeight(20);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
521 f.setValueIconWidth(80);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
522 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
523 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
524 valueMap.put("10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
525 valueMap.put("10,5", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
526 valueMap.put("20,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
527 valueMap.put("30,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
528 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
529 valueIcons.put("10", "10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
530 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
531 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
532 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
533 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
534 f.setValueIcons(valueIcons);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
535 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
536 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
537 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
538 else if (type.equals("font")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
539 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
540 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
541 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
542 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
543 "arial", "<span style='font-family:arial'>Arial</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
544 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
545 "courier", "<span style='font-family:courier'>Courier</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
546 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
547 "verdana", "<span style='font-family:verdana'>Verdana</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
548 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
549 "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
550 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
551 f.setValue(value);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
552 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
553 else if (type.equals("style")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
554 f = new SelectItem(name, MSG.getString(name));
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
555 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
556 new LinkedHashMap<String, String>();
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
557 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
558 "standard", "<span style='font-style:normal'>Normal</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
559 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
560 "bold", "<span style='font-weight:bold'>Bold</span>");
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
561 valueMap.put(
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
562 "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
563 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
564 f.setValue(value);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
565 }
8600
d23982357c79 (issue1753) Fix editing the point color (not Color) of SQThemes.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 7581
diff changeset
566 else if (type.equals("symbol")) {
2458
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
567 //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
568 //changed.
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
569 f = new StaticTextItem("");
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
570 }
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
571 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
572 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
573 }
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
574 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
575 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
576 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
577 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
578 @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
579 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
580 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
581 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
582 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
583 }
a95e82d6bcc1 Refactored the code to create 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 });
a95e82d6bcc1 Refactored the code to create 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
a95e82d6bcc1 Refactored the code to create 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 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
587 }
a95e82d6bcc1 Refactored the code to create 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
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
589
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
590 protected FormItem createLineSizeUI(FormItem f) {
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
591 LinkedHashMap<String, String> valueIcons =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
592 new LinkedHashMap<String, String>();
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
593 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
594 f.setImageURLSuffix("px.png");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
595 f.setValueIconHeight(20);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
596 f.setValueIconWidth(80);
8856
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
597 LinkedHashMap<String, String> valueMap =
5e38e2924c07 Fix code style.
Tom Gottfried <tom@intevation.de>
parents: 8601
diff changeset
598 new LinkedHashMap<String, String>();
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
599 valueMap.put("1", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
600 valueMap.put("2", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
601 valueMap.put("3", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
602 valueMap.put("4", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
603 valueMap.put("5", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
604 valueMap.put("6", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
605 valueMap.put("7", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
606 valueMap.put("8", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
607 valueIcons.put("1", "1");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
608 valueIcons.put("2", "2");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
609 valueIcons.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
610 valueIcons.put("4", "4");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
611 valueIcons.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
612 valueIcons.put("6", "6");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
613 valueIcons.put("7", "7");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
614 valueIcons.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
615 f.setValueIcons(valueIcons);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
616 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
617 return f;
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
618 }
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
619
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
620
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
621 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
622 * Static method to convert a color from RGB to HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
623 * @param rgb String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
624 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
625 * @return String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
626 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
627 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
628 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
629 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
630 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
631 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
632 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
633 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
634 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
635 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
636 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
637 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
638 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
639 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
640 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
641 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
642 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
643 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
644 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
645 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
646 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
647 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
648
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
649
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
650 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
651 * Static method to convert a color from HTML to RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
652 * @param html String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
653 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
654 * @return String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
655 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
656 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
657 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
658 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
659 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
660
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
661 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
662 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
663 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
664
a95e82d6bcc1 Refactored the code to create 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 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
666 }
a95e82d6bcc1 Refactored the code to create 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
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
668
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
669 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
670 * Saves the current style attributes and requests a redraw.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
671 */
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
672 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
673 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
674 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
675 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
676
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
677 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
678 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
679 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
680 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
681 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
682 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
683 @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
684 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
685 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
686 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
687 @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
688 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
689 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
690 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
691 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
692 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
693
a95e82d6bcc1 Refactored the code to create 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
a95e82d6bcc1 Refactored the code to create 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 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
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
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
698
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
699 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
700 * Sets a new value for an attribute.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
701 * @param name Attribute name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
702 * @param value The new value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
703 */
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
704 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
705 Theme t = facet.getTheme();
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
706 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
707 StyleSetting set = s.getSetting(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
708 String type = set.getType();
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
709
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
710 if(name.indexOf("color") != -1
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
711 || (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
712 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
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 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
715 }
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
716
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
717
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
718 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
719 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
720 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
721 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
722 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
723 }
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
724 }
a95e82d6bcc1 Refactored the code to create 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 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org