annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 3364:b31b0d249d21

Set previously selected values for bandwidth theme-prop. flys-client/trunk@5051 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 19 Jul 2012 08:24:22 +0000
parents dab808e5f516
children a6b7f0585761
rev   line source
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
1 package de.intevation.flys.client.client.ui;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 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
4 import com.google.gwt.user.client.rpc.AsyncCallback;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
5 import com.smartgwt.client.types.Alignment;
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
6 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
7 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
8 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
9 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
10 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
11 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
12 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
13 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
14 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
15 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
16 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
17 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
18 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
19 import com.smartgwt.client.widgets.form.fields.StaticTextItem;
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
20 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
21 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
22 import com.smartgwt.client.widgets.form.fields.events.BlurHandler;
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
23 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
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.layout.HLayout;
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.layout.VLayout;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
26 import com.smartgwt.client.widgets.form.validator.IsFloatValidator;
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
27
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
28 import de.intevation.flys.client.client.Config;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
29 import de.intevation.flys.client.client.FLYSConstants;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
30 import de.intevation.flys.client.client.services.CollectionItemAttributeService;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
31 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
32 import de.intevation.flys.client.client.services.ThemeListingService;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
33 import de.intevation.flys.client.client.services.ThemeListingServiceAsync;
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
34 import de.intevation.flys.client.shared.model.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
35 import de.intevation.flys.client.shared.model.CollectionItemAttribute;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
36 import de.intevation.flys.client.shared.model.FacetRecord;
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
37 import de.intevation.flys.client.shared.model.Style;
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 import de.intevation.flys.client.shared.model.StyleSetting;
1326
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
39 import de.intevation.flys.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
40
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
41 import de.intevation.flys.client.client.utils.DoubleValidator;
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
42
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
43 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
44 import java.util.Iterator;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
45 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
46 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
47 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
48
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 /**
a95e82d6bcc1 Refactored the code to create 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 * @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
51 */
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 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
53 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
54 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
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 /** 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
57 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
58
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
59 /** 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
60 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
61
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
62 /** The parent ThemePanel. */
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
63 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
64
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
65 /** 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
66 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
67
a95e82d6bcc1 Refactored the code to create 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 /** 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
69 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
70
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
71 /** 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
72 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
73
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
74 /** The form that contains all the input widgets. */
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
75 DynamicForm df;
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
76
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
77 protected VLayout properties;
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
78
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
79 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
80
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
81 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
82
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
83 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
84
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 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
86
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
87 /** 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
88 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
89 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
90
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
91 /** 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
92 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
93 GWT.create(ThemeListingService.class);
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
94
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
95
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
96 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
97 * Setup editor dialog.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
98 * @param collection The collection the current theme belongs to.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
99 * @param attributes The collection attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
100 * @param facet The selected facet.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
101 */
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
102 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
103 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
104 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
105 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
106 {
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 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
108 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
109 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
110 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
111 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
112 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
113 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
114
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
115 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
116 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
117 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
118 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
119 @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
120 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
121 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
122 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
123 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
124 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
125 }
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 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
127 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
128 }
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
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 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
131 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
132 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
133 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
134 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
135 }
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
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 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
140 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
141 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
142
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 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
144 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
145 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
146 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
149 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
150 * Initialize the window and set the layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
151 */
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 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
153 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
154 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
155 setCanDragResize(true);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
156 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
157
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 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
159 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
160
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
161 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
162 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
163
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
164 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
165 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
166 if(style == null) {
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
167 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
168 return;
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
169 }
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
170 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
171 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
172
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
173 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
174 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
175 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
176 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
177 @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
178 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
179 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
180 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
181 @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
182 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
183 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
184
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
185 styleGroups = list;
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
186 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
187 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
188 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
189 valueMap.put("aktuell", "Aktuell");
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
190 Iterator<String> iter = keys.iterator();
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
191 while (iter.hasNext()) {
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
192 String s = iter.next().toString();
2540
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
193 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
194 tmp.setFacet(current.getFacet());
d632a6526ad9 Set the facet and the index to valid values.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2540
diff changeset
195 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
196 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
197 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
198 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
199 }
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
200 });
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
201 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
203
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
204 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
205 * Initialize the static window content like buttons and main layout.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
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 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
208 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
209 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
210 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
211 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
212 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
213 @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
214 public void onClick(ClickEvent e) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
215 // 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
216 // (always valid).
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
217 if (!df.hasErrors() && df.validate()) {
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
218 saveStyle();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
219 }
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 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
221 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
222
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
223 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
224 buttons.addMember(cancel);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
225 buttons.setAlign(Alignment.CENTER);
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
226 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
227
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
228 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
229 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
230
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
231 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
232 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
233 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
234 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
235 addItem(layout);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
236 setWidth(400);
1381
4459901e4ec0 Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1380
diff changeset
237 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
238 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
241 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
242 * Setter for the parent panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
243 * @param panel The panel.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
244 */
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
245 public void setThemePanel (ThemePanel panel) {
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
246 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
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 * this method is called when the user aborts theming.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
252 * @param event The event.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
253 */
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
254 @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
255 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
256 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
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
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
260 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
261 * This method creates the property grid for available styling attributes.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
262 * @return The layout containing the UI elements.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
263 */
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
264 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
265 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
266
1337
9bf72f84728d Show theme name in static text field.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1336
diff changeset
267 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
268 name.setValue(facet.getName());
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
269 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
270 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
271 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
272 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
273
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
274 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
275 form.setFields(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
276 form.setColWidths("40%", "60%");
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
277
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
278
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
279 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
280
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
281 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
282 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
283 return vl;
1499
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
284 }
0372797fc9cf Avoid NPE in StyleEditorWindow.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1495
diff changeset
285
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
286 // 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
287 String[] sets = {"showlines",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
288 "showpoints",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
289 "linetype",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
290 "linesize",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
291 "linecolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
292 "font",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
293 "textstyle",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
294 "textsize",
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
295 "pointcolor",
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
296 "pointsize",
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
297 "textcolor",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
298 "textorientation",
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
299 "backgroundcolor",
2499
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
300 "showbackground",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
301 "showlinelabel",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
302 "linelabelfont",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
303 "linelabelcolor",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
304 "linelabelsize",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
305 "linelabelstyle",
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
306 "linelabelshowbg",
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
307 "linelabelbgcolor",
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
308 "bandwidthcolor",
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
309 "bandwidth"};
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
310
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
311 for (String settingName: sets) {
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
312 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
313
2908
cd068ff7966d Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2543
diff changeset
314 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
315 continue;
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
316 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
317
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
318 DynamicForm property = createPropertyUI(
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
319 set.getDisplayName(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
320 set.getName(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
321 set.getType(),
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
322 set.getDefaultValue());
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
323 vl.addMember(property);
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
324 }
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
325
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
326 // 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
327 for (StyleSetting set: style.getSettings()) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
328
1451
bc830e564b6d Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1450
diff changeset
329 if (Arrays.asList(sets).contains(set.getName()) || set == null) {
1380
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
330 continue;
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
331 }
2d617c48ca5f Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1360
diff changeset
332
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
333 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
334 set.getDisplayName(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
335 set.getName(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
336 set.getType(),
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
337 set.getDefaultValue());
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
338 vl.addMember(property);
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
339 }
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
340
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
341 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
342 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
343
1336
ceb989d64cd2 Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1333
diff changeset
344
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
345 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
346 * Create a property form.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
347 * @param dname The display name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
348 * @param name The property name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
349 * @param type The property type.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
350 * @param value The current value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
351 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
352 * @return The dynamic form for the attribute property.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
353 */
1309
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
354 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
355 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
356 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
357 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
358 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
359 {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
360 df = new DynamicForm();
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
361 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
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 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
364 if(type.equals("int")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
365 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
366 if (name.equals("linesize")) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
367 f = createLineSizeUI(f);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
368 }
2499
8f36d4b5890c Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2472
diff changeset
369 else if (name.equals("textsize") || name.equals("linelabelsize")) {
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
370 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
371 valueMap.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
372 valueMap.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
373 valueMap.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
374 valueMap.put("10", "10");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
375 valueMap.put("12", "12");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
376 valueMap.put("14", "14");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
377 valueMap.put("18", "18");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
378 valueMap.put("24", "24");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
379 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
380 }
3349
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
381 else if (name.equals("bandwidth")) {
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
382 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
383 valueMap.put("0", "0");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
384 valueMap.put("1", "1");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
385 valueMap.put("2", "2");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
386 valueMap.put("3", "3");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
387 valueMap.put("4", "4");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
388 valueMap.put("5", "5");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
389 valueMap.put("6", "6");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
390 valueMap.put("7", "7");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
391 valueMap.put("8", "8");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
392 valueMap.put("9", "9");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
393 valueMap.put("10", "10");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
394 valueMap.put("11", "11");
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
395 f.setValueMap(valueMap);
36cd7d88551a Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2954
diff changeset
396 }
1495
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
397 else if (name.equals("pointsize")) {
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
398 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
399 valueMap.put("1", "1");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
400 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
401 valueMap.put("3", "3");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
402 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
403 valueMap.put("5", "5");
2433
47a7bdfb4d37 fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1499
diff changeset
404 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
405 valueMap.put("7", "7");
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
406 f.setValueMap(valueMap);
bd6c8b06cb94 Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1479
diff changeset
407 }
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
408 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
409 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
410 else if (type.equals("boolean")) {
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
411 if(name.equals("textorientation")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
412 f = new SelectItem(name, MSG.getString(name));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
413 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
414 valueMap.put("true", "horizontal");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
415 valueMap.put("false", "vertical");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
416 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
417 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
418 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
419 else {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
420 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
421 if(value.equals("true")) {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
422 c.setValue(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
423 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
424 else {
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
425 c.setValue(false);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
426 }
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
427 c.setLabelAsTitle(true);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
428 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
429 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
430 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
431 else if (type.equals("Color")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
432 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
433 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
434 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
435 }
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
436 else if (type.equals("double")) {
3355
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
437 f = new FormItem(name);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
438 IsFloatValidator fpv = new IsFloatValidator();
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
439
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
440 f.setValidators(fpv);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
441 f.setValidateOnChange(true);
dab808e5f516 Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3352
diff changeset
442 f.setTitle(MSG.getString(name));
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
443 f.addBlurHandler(new BlurHandler() {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
444 public void onBlur(BlurEvent e) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
445 DoubleValidator validator = new DoubleValidator();
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
446 Map errors = e.getForm().getErrors();
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
447 if(validator.validate(e.getItem(), errors)) {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
448 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
449 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
450 else {
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
451 e.getForm().setErrors(errors, true);
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
452 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
453 }
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
454 });
3364
b31b0d249d21 Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3355
diff changeset
455 f.setValue(value);
3352
2f533220af1c Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3349
diff changeset
456 }
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
457 else if (type.equals("Dash")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
458 f = new SelectItem(name, MSG.getString(name));
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
459 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
460 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-dash-");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
461 f.setImageURLSuffix(".png");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
462 f.setValueIconHeight(20);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
463 f.setValueIconWidth(80);
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
464 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
1341
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
465 valueMap.put("10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
466 valueMap.put("10,5", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
467 valueMap.put("20,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
468 valueMap.put("30,10", "");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
469 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
470 valueIcons.put("10", "10");
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
471 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
472 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
473 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
474 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
475 f.setValueIcons(valueIcons);
e26088566e8a Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
476 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
477 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
478 }
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
479 else if (type.equals("Font")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
480 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
481 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
482 valueMap.put("arial", "<span style='font-family:arial'>Arial</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
483 valueMap.put("courier", "<span style='font-family:courier'>Courier</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
484 valueMap.put("verdana", "<span style='font-family:verdana'>Verdana</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
485 valueMap.put("times", "<span style='font-family:times'>Times</span>");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
486 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
487 f.setValue(value);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
488 }
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
489 else if (type.equals("Style")) {
1479
2f525f54e429 Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1451
diff changeset
490 f = new SelectItem(name, MSG.getString(name));
1359
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
491 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
492 valueMap.put("standard", "<span style='font-style:normal'>Normal</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
493 valueMap.put("bold", "<span style='font-weight:bold'>Bold</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
494 valueMap.put("italic", "<span style='font-style:italic'>Italic</span>");
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
495 f.setValueMap(valueMap);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
496 f.setValue(value);
5ebcf5b3fc10 Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1357
diff changeset
497 }
2458
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
498 else if (type.equals("Symbol")) {
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
499 //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
500 //changed.
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
501 f = new StaticTextItem("");
208f923032ac Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2433
diff changeset
502 }
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
503 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
504 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
505 }
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
506 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
507 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
508 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
509 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
510 @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
511 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
512 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
513 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
514 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
515 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
516 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
517
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
518 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
519 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
520
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
521
1348
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
522 protected FormItem createLineSizeUI(FormItem f) {
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
523 LinkedHashMap<String, String> valueIcons = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
524 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
525 f.setImageURLSuffix("px.png");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
526 f.setValueIconHeight(20);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
527 f.setValueIconWidth(80);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
528 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>();
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
529 valueMap.put("1", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
530 valueMap.put("2", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
531 valueMap.put("3", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
532 valueMap.put("4", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
533 valueMap.put("5", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
534 valueMap.put("6", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
535 valueMap.put("7", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
536 valueMap.put("8", "");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
537 valueIcons.put("1", "1");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
538 valueIcons.put("2", "2");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
539 valueIcons.put("3", "3");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
540 valueIcons.put("4", "4");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
541 valueIcons.put("5", "5");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
542 valueIcons.put("6", "6");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
543 valueIcons.put("7", "7");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
544 valueIcons.put("8", "8");
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
545 f.setValueIcons(valueIcons);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
546 f.setValueMap(valueMap);
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
547 return f;
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
548 }
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
549
fb224f54c643 Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1345
diff changeset
550
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
551 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
552 * Static method to convert a color from RGB to HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
553 * @param rgb String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
554 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
555 * @return String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
556 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
557 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
558 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
559 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
560 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
561 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
562 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
563 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
564 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
565 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
566 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
567 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
568 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
569 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
570 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
571 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
572 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
573 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
574 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
575 }
a95e82d6bcc1 Refactored the code to create 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 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
577 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
578
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
579
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
580 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
581 * Static method to convert a color from HTML to RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
582 * @param html String in HTML notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
583 *
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
584 * @return String in RGB notation.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
585 */
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
586 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
587 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
588 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
589 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
590
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
591 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
592 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
593 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
594
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
595 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
596 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
597
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
598
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
599 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
600 * Saves the current style attributes and requests a redraw.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
601 */
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
602 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
603 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
604 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
605 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
606
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
607 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
608 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
609 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
610 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
611 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
612 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
613 @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
614 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
615 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
616 }
2954
b9433322fcaf Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents: 2908
diff changeset
617 @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
618 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
619 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
620 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
621 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
622 });
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
623
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
624
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
625 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
626 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
627
1333
1627a28c4504 Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1326
diff changeset
628
1345
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
629 /**
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
630 * Sets a new value for an attribute.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
631 * @param name Attribute name.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
632 * @param value The new value.
92074508a387 Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1341
diff changeset
633 */
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
634 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
635 Theme t = facet.getTheme();
974c6b3700de Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1309
diff changeset
636 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
637 StyleSetting set = s.getSetting(name);
2472
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
638 String type = set.getType();
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
639
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
640 if(name.indexOf("color") != -1
75d19d46c3cd Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2458
diff changeset
641 || (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
642 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
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 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
645 }
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
646
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
647
e75b15818435 Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2499
diff changeset
648 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
649 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
650 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
651 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
652 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
653 }
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
654 }
a95e82d6bcc1 Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
655 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org