annotate flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/StyleEditorWindow.java @ 1292:bdc270ea6195

Edited item attributes are saved and send to the server on accept. flys-client/trunk@2898 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 05 Oct 2011 16:29:14 +0000
parents 1d04f35b2cc0
children
rev   line source
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.client.client.ui.chart;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 import com.google.gwt.core.client.GWT;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
4 import com.google.gwt.user.client.rpc.AsyncCallback;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 import com.smartgwt.client.widgets.Window;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 import com.smartgwt.client.widgets.layout.VLayout;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 import com.smartgwt.client.widgets.layout.HLayout;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 import com.smartgwt.client.widgets.Button;
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
10 import com.smartgwt.client.widgets.form.DynamicForm;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
11 import com.smartgwt.client.widgets.form.fields.FormItem;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
12 import com.smartgwt.client.widgets.form.fields.CheckboxItem;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
13 import com.smartgwt.client.widgets.form.fields.SpinnerItem;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
14 import com.smartgwt.client.widgets.form.fields.ColorPickerItem;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
15 import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
16 import com.smartgwt.client.widgets.form.fields.TextItem;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 import com.smartgwt.client.widgets.events.ClickEvent;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 import com.smartgwt.client.widgets.events.ClickHandler;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
20 import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
21 import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
22 import com.smartgwt.client.types.Alignment;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 import de.intevation.flys.client.shared.model.Collection;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 import de.intevation.flys.client.shared.model.CollectionItemAttribute;
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
26 import de.intevation.flys.client.shared.model.Style;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
27 import de.intevation.flys.client.shared.model.StyleSetting;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
28 import de.intevation.flys.client.shared.model.FacetRecord;
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
29
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
30 import de.intevation.flys.client.client.services.CollectionItemAttributeServiceAsync;
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
31 import de.intevation.flys.client.client.services.CollectionItemAttributeService;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 import de.intevation.flys.client.client.ui.CollectionView;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 import de.intevation.flys.client.client.FLYSConstants;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
35 import de.intevation.flys.client.client.Config;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 /**
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 public class StyleEditorWindow
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 extends Window
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 implements ClickHandler
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 /** The interface that provides i18n messages. */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 /** The collection */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 protected Collection collection;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 /** The parent collection view */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 protected CollectionView view;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 /** The attributes */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54 protected CollectionItemAttribute attributes;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
56 /** The selected facet. */
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
57 protected FacetRecord facet;
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
58
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 /** Main layout */
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 protected VLayout layout;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
62 /** The service used to set collection item attributes. */
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
63 protected CollectionItemAttributeServiceAsync itemAttributeService =
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
64 GWT.create(CollectionItemAttributeService.class);
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 public StyleEditorWindow (
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 Collection collection,
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
68 CollectionItemAttribute attributes,
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
69 FacetRecord facet)
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 this.collection = collection;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 this.attributes = attributes;
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
73 this.facet = facet;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 this.layout = new VLayout();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 init();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 initPanels();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 protected void init() {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 setTitle(MSG.properties());
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
83 setWidth(270);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
84 setHeight(200);
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 setCanDragReposition(true);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 setCanDragResize(true);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 setKeepInParentRect(true);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 layout.setWidth100();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 layout.setHeight100();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 }
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 protected void initPanels() {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 HLayout buttons = new HLayout();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 Button accept = new Button(MSG.label_ok());
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 Button cancel = new Button(MSG.label_cancel());
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 cancel.addClickHandler(this);
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
100 accept.addClickHandler(new ClickHandler() {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
101 public void onClick(ClickEvent e) {
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
102 saveStyle();
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
103 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
104 });
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 buttons.addMember(accept);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 buttons.addMember(cancel);
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
108 buttons.setAlign(Alignment.RIGHT);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
109
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
110 layout.addMember(createPropertyGrid());;
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 layout.addMember(buttons);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 addItem(layout);
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 }
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
115
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
116 public void setCollectionView (CollectionView view) {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 this.view = view;
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 setParentElement(this.view.getParentElement());
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 }
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
121
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
122 public void onClick(ClickEvent event) {
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
123 this.hide();
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
124 }
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
125
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
126
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
127 protected VLayout createPropertyGrid() {
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
128 VLayout properties = new VLayout();
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
129
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
130 Style s = attributes.getStyle(facet.getTheme().getFacet());
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
131
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
132 TextItem name = new TextItem("name", "Name");
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
133 name.setValue(facet.getName());
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
134 name.setTitleStyle("color:#000; width:120px");
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
135 name.setTitleAlign(Alignment.LEFT);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
136 name.setDisabled(true);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
137 name.setShowDisabled(false);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
138 DynamicForm f = new DynamicForm();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
139 f.setFields(name);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
140 properties.addMember(f);
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
141
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
142 for (int i = 0; i < s.getNumSettings(); i ++) {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
143 final StyleSetting set = s.getSetting(i);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
144 DynamicForm property = createPropertyUI(
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
145 set.getDisplayName(),
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
146 set.getName(),
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
147 set.getType(),
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
148 set.getDefaultValue());
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
149 properties.addMember(property);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
150 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
151 return properties;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
152 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
153
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
154 protected DynamicForm createPropertyUI(
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
155 String dname,
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
156 String name,
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
157 String type,
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
158 String value)
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
159 {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
160 DynamicForm df = new DynamicForm();
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
161
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
162 FormItem f;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
163 if(type.equals("int")) {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
164 SpinnerItem s = new SpinnerItem(name, dname);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
165 s.setMin(1);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
166 s.setMax(10);
1291
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
167 s.setValue(value);
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
168 f = s;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
169 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
170 else if (type.equals("boolean")) {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
171 CheckboxItem c = new CheckboxItem(name, dname);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
172 if(value.equals("true")) {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
173 c.setValue(true);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
174 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
175 else {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
176 c.setValue(false);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
177 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
178 c.setLabelAsTitle(true);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
179 f = c;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
180 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
181 else if (type.equals("Color")) {
1291
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
182 ColorPickerItem c = new ColorPickerItem(name, dname);
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
183 c.setValue(rgbToHtml(value));
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
184 f = c;
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
185 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
186 else if (type.equals("Dash")) {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
187 f = new ComboBoxItem(name, dname);
1291
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
188 f.setValue(value);
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
189 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
190 else {
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
191 f = new FormItem();
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
192 }
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
193 f.setTitleStyle("color:#000; width:120px");
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
194 f.setTitleAlign(Alignment.LEFT);
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
195 df.setFields(f);
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
196 df.addItemChangedHandler(new ItemChangedHandler() {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
197 public void onItemChanged(ItemChangedEvent e) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
198 String name = e.getItem().getName();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
199 String newValue = e.getNewValue().toString();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
200 GWT.log("changed: " + name);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
201 setNewValue(name, newValue);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
202 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
203 });
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
204
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
205 return df;
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
206 }
1291
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
207
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
208 protected String rgbToHtml(String rgb) {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
209 String[] parts = rgb.split(",");
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
210 int values[] = new int[parts.length];
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
211 for (int i = 0; i < parts.length; i++) {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
212 parts[i] = parts[i].trim();
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
213 try {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
214 values[i] = Integer.parseInt(parts[i]);
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
215 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
216 catch(NumberFormatException nfe) {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
217 return "#000000";
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
218 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
219 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
220 String hex = "#";
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
221 for (int i = 0; i < values.length; i++) {
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
222 if (values[i] < 16) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
223 hex += "0";
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
224 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
225 hex += Integer.toHexString(values[i]);
1291
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
226 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
227 return hex;
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
228 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
229
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
230 protected String htmlToRgb(String html) {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
231 if (!html.startsWith("#")) {
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
232 return "0, 0, 0";
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
233 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
234
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
235 int r = Integer.valueOf(html.substring(1, 3), 16);
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
236 int g = Integer.valueOf(html.substring(3, 5), 16);
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
237 int b = Integer.valueOf(html.substring(5, 7), 16);
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
238
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
239 return r + ", " + g + ", " + b;
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
240 }
1d04f35b2cc0 New methods for color transformation (html to rgb; rgb to html).
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1290
diff changeset
241
1292
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
242 protected void saveStyle () {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
243 GWT.log("StyleEditorWindow.saveStyle()");
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
244 Config config = Config.getInstance();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
245 String url = config.getServerUrl();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
246 String locale = config.getLocale();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
247
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
248 itemAttributeService.setCollectionItemAttribute(
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
249 this.collection,
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
250 attributes.getArtifact(),
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
251 url,
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
252 locale,
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
253 attributes,
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
254 new AsyncCallback<Void>() {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
255 public void onFailure (Throwable caught) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
256 GWT.log("Could not set Collection item attributes.");
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
257 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
258 public void onSuccess(Void v) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
259 GWT.log("Successfully saved collection item attributes.");
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
260 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
261 });
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
262
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
263
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
264 this.hide();
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
265 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
266
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
267 protected final void setNewValue(String name, String value) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
268 Style s = attributes.getStyle(facet.getTheme().getFacet());
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
269 StyleSetting set = s.getSetting(name);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
270 if(name.equals("linecolor")) {
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
271 value = htmlToRgb(value);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
272 }
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
273 set.setDefaultValue(value);
bdc270ea6195 Edited item attributes are saved and send to the server on accept.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1291
diff changeset
274 }
1287
95ecb98c6015 Added skeleton for editor window.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
275 }
1290
f4deeafa60b3 Build up the editor window from CollectionItemAttribute response.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1287
diff changeset
276 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org