Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 4205:0dd8963cec9c
Set also the width of the GaugeTree when resizing the GaugePanel
GWT is no longer able to calculate and set the correct width of the GaugeTree since
the GaugeTree is added via a Canvas wrapper. Therefore set the width manually
when resizing the GaugeTree.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 15:33:16 +0200 |
parents | 4e32de1b6a9e |
children | e8a4d2fd25cc |
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; |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
20 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
|
21 import com.smartgwt.client.widgets.form.fields.events.BlurHandler; |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
22 import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; |
2540
e75b15818435
Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2499
diff
changeset
|
23 import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
24 import com.smartgwt.client.widgets.form.validator.IsFloatValidator; |
2954
b9433322fcaf
Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents:
2908
diff
changeset
|
25 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
|
26 import com.smartgwt.client.widgets.layout.VLayout; |
2540
e75b15818435
Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2499
diff
changeset
|
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; |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
34 import de.intevation.flys.client.client.utils.DoubleValidator; |
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
|
35 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
|
36 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
|
37 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
|
38 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
|
39 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
|
40 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
|
41 |
2954
b9433322fcaf
Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents:
2908
diff
changeset
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 |
a95e82d6bcc1
Refactored the code to create 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 /** |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
49 * Editor window for styles. |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
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. */ |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
75 protected DynamicForm df; |
3355
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 "backgroundcolor", |
2499
8f36d4b5890c
Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2472
diff
changeset
|
299 "showbackground", |
8f36d4b5890c
Define order for linelabel theme properties.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2472
diff
changeset
|
300 "showlinelabel", |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
301 "labelfontface", |
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
302 "labelfontcolor", |
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
303 "labelfontsize", |
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
304 "labelfontstyle", |
3703
4e32de1b6a9e
Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents:
3702
diff
changeset
|
305 "textorientation", |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
306 "labelshowbg", |
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
307 "labelbgcolor", |
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
308 "showpointlabel", |
3364
b31b0d249d21
Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3355
diff
changeset
|
309 "bandwidthcolor", |
3349
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
310 "bandwidth"}; |
1451
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
311 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
312 for (String settingName: sets) { |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
313 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
|
314 |
2908
cd068ff7966d
Show only style attributes in StyleEditorWindow that are not 'hidden'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2543
diff
changeset
|
315 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
|
316 continue; |
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 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
319 DynamicForm property = createPropertyUI( |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
320 set.getDisplayName(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
321 set.getName(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
322 set.getType(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
323 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
|
324 vl.addMember(property); |
1451
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 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
327 // 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
|
328 for (StyleSetting set: style.getSettings()) { |
1380
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
329 |
1451
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
330 if (Arrays.asList(sets).contains(set.getName()) || set == null) { |
1380
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
331 continue; |
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
332 } |
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
333 |
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
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 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
|
340 } |
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
|
341 |
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
|
342 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
|
343 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
344 |
1336
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
345 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
346 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
347 * Create a property form. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
348 * @param dname The display name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
349 * @param name The property name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
350 * @param type The property type. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
351 * @param value The current value. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
352 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
353 * @return The dynamic form for the attribute property. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
354 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 { |
3355
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
361 df = new DynamicForm(); |
2472
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
362 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
|
363 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
364 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
|
365 if(type.equals("int")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
366 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
|
367 if (name.equals("linesize")) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
368 f = createLineSizeUI(f); |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
369 f.setValue(value); |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
370 } |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
371 else if (name.equals("labelfontsize")) { |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
372 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
|
373 valueMap.put("3", "3"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
374 valueMap.put("5", "5"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
375 valueMap.put("8", "8"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
376 valueMap.put("10", "10"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
377 valueMap.put("12", "12"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
378 valueMap.put("14", "14"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
379 valueMap.put("18", "18"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
380 valueMap.put("24", "24"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
381 f.setValueMap(valueMap); |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
382 f.setValue(value); |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
383 } |
3349
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
384 else if (name.equals("bandwidth")) { |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
385 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
386 valueMap.put("0", "0"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
387 valueMap.put("1", "1"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
388 valueMap.put("2", "2"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
389 valueMap.put("3", "3"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
390 valueMap.put("4", "4"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
391 valueMap.put("5", "5"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
392 valueMap.put("6", "6"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
393 valueMap.put("7", "7"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
394 valueMap.put("8", "8"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
395 valueMap.put("9", "9"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
396 valueMap.put("10", "10"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
397 valueMap.put("11", "11"); |
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
398 f.setValueMap(valueMap); |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
399 f.setValue(value); |
3349
36cd7d88551a
Added bandwidth field, i18n.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2954
diff
changeset
|
400 } |
1495
bd6c8b06cb94
Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1479
diff
changeset
|
401 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
|
402 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
|
403 valueMap.put("1", "1"); |
2433
47a7bdfb4d37
fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1499
diff
changeset
|
404 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
|
405 valueMap.put("3", "3"); |
2433
47a7bdfb4d37
fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1499
diff
changeset
|
406 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
|
407 valueMap.put("5", "5"); |
2433
47a7bdfb4d37
fix flys/issue613 . cap max point size.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1499
diff
changeset
|
408 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
|
409 valueMap.put("7", "7"); |
bd6c8b06cb94
Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1479
diff
changeset
|
410 f.setValueMap(valueMap); |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
411 f.setValue(value); |
1495
bd6c8b06cb94
Improved the StyledEditorWindow to support a list of pointsizes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1479
diff
changeset
|
412 } |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
413 else if (name.equals("transparency")) { |
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
414 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); |
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
415 for (int n = 10; n < 100; n += 10) { |
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
416 valueMap.put(Integer.toString(n), n + "%"); |
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
417 } |
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
418 f.setValueMap(valueMap); |
3702
394e1a9915ec
Transparency combobox appearence fix for #840.
Christian Lins <christian.lins@intevation.de>
parents:
3700
diff
changeset
|
419 f.setValue(value); |
3700
dbcd14c27c8d
Transparency attribute theme fixes
Christian Lins <christian.lins@intevation.de>
parents:
3384
diff
changeset
|
420 } |
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
|
421 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
422 else if (type.equals("boolean")) { |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
423 if(name.equals("textorientation")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
424 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
|
425 LinkedHashMap<String, String> valueMap = new LinkedHashMap<String, String>(); |
3703
4e32de1b6a9e
Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents:
3702
diff
changeset
|
426 valueMap.put("true", MSG.getString("horizontal")); |
4e32de1b6a9e
Fix for line label text in Delta W(t) chart (#837).
Christian Lins <christian.lins@intevation.de>
parents:
3702
diff
changeset
|
427 valueMap.put("false", MSG.getString("vertical")); |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
428 f.setValueMap(valueMap); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
429 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
|
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 { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
432 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
|
433 if(value.equals("true")) { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
434 c.setValue(true); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
435 } |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
436 else { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
437 c.setValue(false); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
438 } |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
439 c.setLabelAsTitle(true); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
440 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
|
441 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
442 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
443 else if (type.equals("Color")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
444 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
|
445 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
|
446 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
|
447 } |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
448 else if (type.equals("double")) { |
3355
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
449 f = new FormItem(name); |
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
450 IsFloatValidator fpv = new IsFloatValidator(); |
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
451 |
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
452 f.setValidators(fpv); |
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
453 f.setValidateOnChange(true); |
dab808e5f516
Improve validation of double-type style arguments.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3352
diff
changeset
|
454 f.setTitle(MSG.getString(name)); |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
455 f.addBlurHandler(new BlurHandler() { |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
456 @Override |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
457 public void onBlur(BlurEvent e) { |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
458 DoubleValidator validator = new DoubleValidator(); |
3384
a6b7f0585761
Merge point/line label styles
Christian Lins <christian.lins@intevation.de>
parents:
3364
diff
changeset
|
459 Map<?, ?> errors = e.getForm().getErrors(); |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
460 if(validator.validate(e.getItem(), errors)) { |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
461 e.getForm().setErrors(errors, true); |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
462 } |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
463 else { |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
464 e.getForm().setErrors(errors, true); |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
465 } |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
466 } |
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
467 }); |
3364
b31b0d249d21
Set previously selected values for bandwidth theme-prop.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3355
diff
changeset
|
468 f.setValue(value); |
3352
2f533220af1c
Handle upcoming 'double' theme attribute type.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3349
diff
changeset
|
469 } |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
470 else if (type.equals("Dash")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
471 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
|
472 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
|
473 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
|
474 f.setImageURLSuffix(".png"); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
475 f.setValueIconHeight(20); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
476 f.setValueIconWidth(80); |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
477 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
|
478 valueMap.put("10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
479 valueMap.put("10,5", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
480 valueMap.put("20,10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
481 valueMap.put("30,10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
482 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
|
483 valueIcons.put("10", "10"); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
484 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
|
485 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
|
486 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
|
487 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
|
488 f.setValueIcons(valueIcons); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
489 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
|
490 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
|
491 } |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
492 else if (type.equals("Font")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
493 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
|
494 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
|
495 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
|
496 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
|
497 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
|
498 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
|
499 f.setValueMap(valueMap); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
500 f.setValue(value); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
501 } |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
502 else if (type.equals("Style")) { |
1479
2f525f54e429
Issue 427.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1451
diff
changeset
|
503 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
|
504 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
|
505 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
|
506 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
|
507 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
|
508 f.setValueMap(valueMap); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
509 f.setValue(value); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
510 } |
2458
208f923032ac
Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2433
diff
changeset
|
511 else if (type.equals("Symbol")) { |
208f923032ac
Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2433
diff
changeset
|
512 //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
|
513 //changed. |
208f923032ac
Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2433
diff
changeset
|
514 f = new StaticTextItem(""); |
208f923032ac
Issue 493.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2433
diff
changeset
|
515 } |
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
|
516 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
|
517 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
|
518 } |
2472
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
519 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
|
520 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
|
521 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
|
522 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
|
523 @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
|
524 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
|
525 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
|
526 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
|
527 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
|
528 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
529 }); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
530 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
531 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
|
532 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
533 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
534 |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
535 protected FormItem createLineSizeUI(FormItem f) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
536 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
|
537 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
538 f.setImageURLSuffix("px.png"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
539 f.setValueIconHeight(20); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
540 f.setValueIconWidth(80); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
541 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
|
542 valueMap.put("1", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
543 valueMap.put("2", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
544 valueMap.put("3", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
545 valueMap.put("4", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
546 valueMap.put("5", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
547 valueMap.put("6", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
548 valueMap.put("7", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
549 valueMap.put("8", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
550 valueIcons.put("1", "1"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
551 valueIcons.put("2", "2"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
552 valueIcons.put("3", "3"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
553 valueIcons.put("4", "4"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
554 valueIcons.put("5", "5"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
555 valueIcons.put("6", "6"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
556 valueIcons.put("7", "7"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
557 valueIcons.put("8", "8"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
558 f.setValueIcons(valueIcons); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
559 f.setValueMap(valueMap); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
560 return f; |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
561 } |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
562 |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
563 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
564 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
565 * Static method to convert a color from RGB to HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
566 * @param rgb String in RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
567 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
568 * @return String in HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
569 */ |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
570 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
|
571 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
|
572 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
|
573 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
|
574 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
|
575 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
|
576 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
|
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 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
|
579 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
|
580 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
581 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
582 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
|
583 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
|
584 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
|
585 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
|
586 } |
a95e82d6bcc1
Refactored the code to create 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 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
|
588 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
589 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
|
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 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
592 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
593 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
594 * Static method to convert a color from HTML to RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
595 * @param html String in HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
596 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
597 * @return String in RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
598 */ |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
599 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
|
600 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
|
601 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
|
602 } |
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create 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 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
|
605 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
|
606 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
|
607 |
a95e82d6bcc1
Refactored the code to create 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 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
|
609 } |
a95e82d6bcc1
Refactored the code to create 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 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
611 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
612 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
613 * Saves the current style attributes and requests a redraw. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
614 */ |
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
|
615 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
|
616 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
|
617 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
|
618 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
|
619 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
620 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
|
621 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
|
622 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
|
623 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
|
624 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
|
625 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
|
626 @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
|
627 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
|
628 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
|
629 } |
2954
b9433322fcaf
Add alpha transp. and fix exceptions on unknown style attributes.
Christian Lins <christian.lins@intevation.de>
parents:
2908
diff
changeset
|
630 @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
|
631 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
|
632 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
|
633 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
|
634 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
635 }); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
636 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
637 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
638 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
|
639 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
640 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
641 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
642 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
643 * Sets a new value for an attribute. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
644 * @param name Attribute name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
645 * @param value The new value. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
646 */ |
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
|
647 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
|
648 Theme t = facet.getTheme(); |
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1309
diff
changeset
|
649 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
|
650 StyleSetting set = s.getSetting(name); |
2472
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
651 String type = set.getType(); |
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
652 |
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
653 if(name.indexOf("color") != -1 |
75d19d46c3cd
Prepared the style editor for WSPLGEN themes.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2458
diff
changeset
|
654 || (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
|
655 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
|
656 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
657 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
|
658 } |
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
|
659 |
e75b15818435
Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2499
diff
changeset
|
660 |
e75b15818435
Added a style chooser to the style editor to provide predefined styles and
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2499
diff
changeset
|
661 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
|
662 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
|
663 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
|
664 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
|
665 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
|
666 } |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
667 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
668 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |