Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 1465:d0bcf5ba7adf
Create the properties dialog content dynamically based on the properties read
from describe collection document.
flys-client/trunk@3505 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Wed, 21 Dec 2011 10:53:02 +0000 |
parents | bc830e564b6d |
children | 2f525f54e429 |
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 |
1451
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
3 import java.util.Arrays; |
1341
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
4 import java.util.LinkedHashMap; |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
5 |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 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
|
7 import com.google.gwt.user.client.rpc.AsyncCallback; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import com.smartgwt.client.widgets.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
|
10 import com.smartgwt.client.widgets.layout.VLayout; |
a95e82d6bcc1
Refactored the code to create 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.layout.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
|
12 import com.smartgwt.client.widgets.Button; |
a95e82d6bcc1
Refactored the code to create 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.DynamicForm; |
a95e82d6bcc1
Refactored the code to create 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.fields.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
|
15 import com.smartgwt.client.widgets.form.fields.CheckboxItem; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import com.smartgwt.client.widgets.form.fields.ColorPickerItem; |
1341
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
17 import com.smartgwt.client.widgets.form.fields.SelectItem; |
1337
9bf72f84728d
Show theme name in static text field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1336
diff
changeset
|
18 import com.smartgwt.client.widgets.form.fields.StaticTextItem; |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import com.smartgwt.client.widgets.events.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
|
21 import com.smartgwt.client.widgets.events.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
|
22 import com.smartgwt.client.widgets.form.events.ItemChangedEvent; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 import com.smartgwt.client.widgets.form.events.ItemChangedHandler; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 import com.smartgwt.client.types.Alignment; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 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
|
27 import de.intevation.flys.client.shared.model.CollectionItemAttribute; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 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
|
29 import de.intevation.flys.client.shared.model.StyleSetting; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.client.shared.model.FacetRecord; |
1326
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1309
diff
changeset
|
31 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
|
32 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync; |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 import de.intevation.flys.client.client.services.CollectionItemAttributeService; |
1336
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
35 import de.intevation.flys.client.client.ui.ThemePanel; |
1309
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 import de.intevation.flys.client.client.FLYSConstants; |
a95e82d6bcc1
Refactored the code to create 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.client.Config; |
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 /** |
a95e82d6bcc1
Refactored the code to create 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 * @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
|
42 */ |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 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
|
44 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
|
45 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
|
46 { |
a95e82d6bcc1
Refactored the code to create 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 /** 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
|
48 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
|
49 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
50 /** 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
|
51 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
|
52 |
1336
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
53 /** The parent ThemePanel. */ |
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
54 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
|
55 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
56 /** 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
|
57 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
|
58 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 /** 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
|
60 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
|
61 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
62 /** 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
|
63 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
|
64 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 /** The 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
|
66 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
|
67 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
|
68 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
69 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
70 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
71 * Setup editor dialog. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
72 * @param collection The collection the current theme belongs to. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
73 * @param attributes The collection attributes. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
74 * @param facet The selected facet. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
75 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 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
|
80 { |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 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
|
82 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
|
83 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
|
84 this.layout = new VLayout(); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 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
|
87 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
|
88 } |
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create 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 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
91 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
92 * Initialize the window and set the layout. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
93 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 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
|
95 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
|
96 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
|
97 setCanDragResize(true); |
1381
4459901e4ec0
Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1380
diff
changeset
|
98 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
|
99 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 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
|
101 layout.setHeight100(); |
a95e82d6bcc1
Refactored the code to create 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 } |
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create 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 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
105 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
106 * Initialize the static window content like buttons and main layout. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
107 */ |
1309
a95e82d6bcc1
Refactored the code to create 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 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
|
109 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
|
110 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
|
111 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
|
112 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
|
113 accept.addClickHandler(new 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
|
114 public void onClick(ClickEvent 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
|
115 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
|
116 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 }); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 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
|
120 buttons.addMember(cancel); |
1381
4459901e4ec0
Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1380
diff
changeset
|
121 buttons.setAlign(Alignment.CENTER); |
4459901e4ec0
Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1380
diff
changeset
|
122 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
|
123 |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
124 VLayout propGrid = createPropertyGrid(); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
125 |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
126 layout.addMember(propGrid); |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 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
|
128 addItem(layout); |
1381
4459901e4ec0
Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1380
diff
changeset
|
129 setWidth(300); |
4459901e4ec0
Updated the theme editor window layout.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1380
diff
changeset
|
130 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
|
131 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
134 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
135 * Setter for the parent panel. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
136 * @param panel The panel. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
137 */ |
1336
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
138 public void setThemePanel (ThemePanel panel) { |
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
139 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
|
140 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
143 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
144 * this method is called when the user aborts theming. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
145 * @param event The event. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
146 */ |
1309
a95e82d6bcc1
Refactored the code to create 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 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
|
148 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
|
149 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
152 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
153 * This method creates the property grid for available styling attributes. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
154 * @return The layout containing the UI elements. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
155 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
156 protected VLayout createPropertyGrid() { |
a95e82d6bcc1
Refactored the code to create 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 VLayout properties = new VLayout(); |
a95e82d6bcc1
Refactored the code to create 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 |
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
|
159 Theme theme = facet.getTheme(); |
bb91cdf8407b
Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
160 Style style = attributes.getStyle(theme.getFacet(), theme.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
|
161 |
1337
9bf72f84728d
Show theme name in static text field.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1336
diff
changeset
|
162 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
|
163 name.setValue(facet.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
|
164 name.setTitleStyle("color:#000; width:120px"); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
165 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
|
166 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
|
167 name.setShowDisabled(false); |
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
|
168 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
|
169 form.setFields(name); |
bb91cdf8407b
Minor refactoring to ease addition of new style-fields (are now added automically).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1425
diff
changeset
|
170 properties.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
|
171 |
1451
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
172 // 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
|
173 String[] sets = {"showlines", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
174 "showpoints", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
175 "linetype", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
176 "linesize", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
177 "linecolor", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
178 "font", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
179 "textstyle", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
180 "textsize", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
181 "textcolor", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
182 "textorientation", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
183 "backgroundcolor", |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
184 "showbackground"}; |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
185 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
186 for (String settingName: sets) { |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
187 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
|
188 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
189 if (set == null) { |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
190 continue; |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
191 } |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
192 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
193 DynamicForm property = createPropertyUI( |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
194 set.getDisplayName(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
195 set.getName(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
196 set.getType(), |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
197 set.getDefaultValue()); |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
198 properties.addMember(property); |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
199 } |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
200 |
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
201 // 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
|
202 for (StyleSetting set: style.getSettings()) { |
1380
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
203 |
1451
bc830e564b6d
Restore feature that was optimized away by last commit.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1450
diff
changeset
|
204 if (Arrays.asList(sets).contains(set.getName()) || set == null) { |
1380
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
205 continue; |
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
206 } |
2d617c48ca5f
Issue 400.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1360
diff
changeset
|
207 |
1309
a95e82d6bcc1
Refactored the code to create 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 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
|
209 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
|
210 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
|
211 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
|
212 set.getDefaultValue()); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
213 properties.addMember(property); |
a95e82d6bcc1
Refactored the code to create 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 } |
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
|
215 |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
216 return 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
|
217 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
218 |
1336
ceb989d64cd2
Request redraw on style attribute change.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1333
diff
changeset
|
219 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
220 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
221 * Create a property form. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
222 * @param dname The display name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
223 * @param name The property name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
224 * @param type The property type. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
225 * @param value The current value. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
226 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
227 * @return The dynamic form for the attribute property. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
228 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
229 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
|
230 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
|
231 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
|
232 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
|
233 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
|
234 { |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
235 DynamicForm df = new DynamicForm(); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
236 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
237 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
|
238 if(type.equals("int")) { |
1341
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
239 f = new SelectItem(name, dname); |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
240 if (name.equals("linesize")) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
241 f = createLineSizeUI(f); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
242 } |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
243 else if (name.equals("textsize")) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
244 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
|
245 valueMap.put("3", "3"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
246 valueMap.put("5", "5"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
247 valueMap.put("8", "8"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
248 valueMap.put("10", "10"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
249 valueMap.put("12", "12"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
250 valueMap.put("14", "14"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
251 valueMap.put("18", "18"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
252 valueMap.put("24", "24"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
253 f.setValueMap(valueMap); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
254 } |
1341
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
255 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
|
256 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
257 else if (type.equals("boolean")) { |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
258 if(name.equals("textorientation")) { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
259 f = new SelectItem(name, dname); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
260 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
|
261 valueMap.put("true", "horizontal"); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
262 valueMap.put("false", "vertical"); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
263 f.setValueMap(valueMap); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
264 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
|
265 } |
a95e82d6bcc1
Refactored the code to create 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 else { |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
267 CheckboxItem c = new CheckboxItem(name, dname); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
268 if(value.equals("true")) { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
269 c.setValue(true); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
270 } |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
271 else { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
272 c.setValue(false); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
273 } |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
274 c.setLabelAsTitle(true); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
275 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
|
276 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
277 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
278 else if (type.equals("Color")) { |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
279 ColorPickerItem c = new ColorPickerItem(name, 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
|
280 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
|
281 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
|
282 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
283 else if (type.equals("Dash")) { |
1341
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
284 f = new SelectItem(name, dname); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
285 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
|
286 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
|
287 f.setImageURLSuffix(".png"); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
288 f.setValueIconHeight(20); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
289 f.setValueIconWidth(80); |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
290 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
|
291 valueMap.put("10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
292 valueMap.put("10,5", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
293 valueMap.put("20,10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
294 valueMap.put("30,10", ""); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
295 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
|
296 valueIcons.put("10", "10"); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
297 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
|
298 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
|
299 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
|
300 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
|
301 f.setValueIcons(valueIcons); |
e26088566e8a
Use images for line type and line size selection.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1339
diff
changeset
|
302 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
|
303 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
|
304 } |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
305 else if (type.equals("Font")) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
306 f = new SelectItem(name, dname); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
307 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
|
308 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
|
309 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
|
310 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
|
311 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
|
312 f.setValueMap(valueMap); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
313 f.setValue(value); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
314 } |
1359
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
315 else if (type.equals("Style")) { |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
316 f = new SelectItem(name, dname); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
317 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
|
318 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
|
319 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
|
320 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
|
321 f.setValueMap(valueMap); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
322 f.setValue(value); |
5ebcf5b3fc10
Display new attributes in editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1357
diff
changeset
|
323 } |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
324 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
|
325 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
|
326 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
327 f.setTitleStyle("color:#000; width:120px"); |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
328 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
|
329 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
|
330 df.addItemChangedHandler(new ItemChangedHandler() { |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
331 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
|
332 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
|
333 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
|
334 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
|
335 } |
a95e82d6bcc1
Refactored the code to create 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 }); |
a95e82d6bcc1
Refactored the code to create 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 |
a95e82d6bcc1
Refactored the code to create 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 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
|
339 } |
a95e82d6bcc1
Refactored the code to create 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 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
341 |
1348
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
342 protected FormItem createLineSizeUI(FormItem f) { |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
343 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
|
344 f.setImageURLPrefix(GWT.getHostPageBaseURL() + "images/linestyle-"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
345 f.setImageURLSuffix("px.png"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
346 f.setValueIconHeight(20); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
347 f.setValueIconWidth(80); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
348 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
|
349 valueMap.put("1", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
350 valueMap.put("2", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
351 valueMap.put("3", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
352 valueMap.put("4", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
353 valueMap.put("5", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
354 valueMap.put("6", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
355 valueMap.put("7", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
356 valueMap.put("8", ""); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
357 valueIcons.put("1", "1"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
358 valueIcons.put("2", "2"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
359 valueIcons.put("3", "3"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
360 valueIcons.put("4", "4"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
361 valueIcons.put("5", "5"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
362 valueIcons.put("6", "6"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
363 valueIcons.put("7", "7"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
364 valueIcons.put("8", "8"); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
365 f.setValueIcons(valueIcons); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
366 f.setValueMap(valueMap); |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
367 return f; |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
368 } |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
369 |
fb224f54c643
Prepared editor UI for annotation styling.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1345
diff
changeset
|
370 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
371 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
372 * Static method to convert a color from RGB to HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
373 * @param rgb String in RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
374 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
375 * @return String in HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
376 */ |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
377 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
|
378 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
|
379 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
|
380 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
|
381 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
|
382 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
|
383 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
|
384 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
385 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
|
386 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
|
387 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
388 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
389 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
|
390 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
|
391 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
|
392 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
|
393 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
394 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
|
395 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
396 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
|
397 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
398 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
399 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
400 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
401 * Static method to convert a color from HTML to RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
402 * @param html String in HTML notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
403 * |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
404 * @return String in RGB notation. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
405 */ |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
406 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
|
407 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
|
408 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
|
409 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
410 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
411 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
|
412 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
|
413 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
|
414 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
415 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
|
416 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
417 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
418 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
419 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
420 * Saves the current style attributes and requests a redraw. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
421 */ |
1309
a95e82d6bcc1
Refactored the code to create 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 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
|
423 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
|
424 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
|
425 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
|
426 |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
427 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
|
428 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
|
429 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
|
430 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
|
431 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
|
432 new AsyncCallback<Void>() { |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
433 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
|
434 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
|
435 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
436 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
|
437 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
|
438 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
|
439 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
440 }); |
a95e82d6bcc1
Refactored the code to create 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 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
|
444 } |
a95e82d6bcc1
Refactored the code to create 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 |
1333
1627a28c4504
Cosmetics, docs.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
1326
diff
changeset
|
446 |
1345
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
447 /** |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
448 * Sets a new value for an attribute. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
449 * @param name Attribute name. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
450 * @param value The new value. |
92074508a387
Added documentation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1341
diff
changeset
|
451 */ |
1309
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
452 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
|
453 Theme t = facet.getTheme(); |
974c6b3700de
Use the theme index to identify the correct style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1309
diff
changeset
|
454 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
|
455 StyleSetting set = s.getSetting(name); |
1353
fd408dfbd3b8
Convert all color attributes from html to rgb notation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1348
diff
changeset
|
456 if(name.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
|
457 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
|
458 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
459 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
|
460 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
461 } |
a95e82d6bcc1
Refactored the code to create a context menu and a style editor so that it is also available for maps.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
462 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |