comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/StyleEditorWindow.java @ 1333:1627a28c4504

Cosmetics, docs. flys-client/trunk@2978 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 17 Oct 2011 09:41:40 +0000
parents 974c6b3700de
children ceb989d64cd2
comparison
equal deleted inserted replaced
1332:ab2b1a4a9ead 1333:1627a28c4504
43 implements ClickHandler 43 implements ClickHandler
44 { 44 {
45 /** The interface that provides i18n messages. */ 45 /** The interface that provides i18n messages. */
46 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); 46 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
47 47
48 /** The collection */ 48 /** The collection. */
49 protected Collection collection; 49 protected Collection collection;
50 50
51 /** The parent collection view */ 51 /** The parent collection view. */
52 protected CollectionView view; 52 protected CollectionView view;
53 53
54 /** The attributes */ 54 /** The attributes. */
55 protected CollectionItemAttribute attributes; 55 protected CollectionItemAttribute attributes;
56 56
57 /** The selected facet. */ 57 /** The selected facet. */
58 protected FacetRecord facet; 58 protected FacetRecord facet;
59 59
60 /** Main layout */ 60 /** Main layout. */
61 protected VLayout layout; 61 protected VLayout layout;
62 62
63 /** The service used to set collection item attributes. */ 63 /** The service used to set collection item attributes. */
64 protected CollectionItemAttributeServiceAsync itemAttributeService = 64 protected CollectionItemAttributeServiceAsync itemAttributeService =
65 GWT.create(CollectionItemAttributeService.class); 65 GWT.create(CollectionItemAttributeService.class);
66
66 67
67 public StyleEditorWindow ( 68 public StyleEditorWindow (
68 Collection collection, 69 Collection collection,
69 CollectionItemAttribute attributes, 70 CollectionItemAttribute attributes,
70 FacetRecord facet) 71 FacetRecord facet)
205 }); 206 });
206 207
207 return df; 208 return df;
208 } 209 }
209 210
210 protected String rgbToHtml(String rgb) { 211
212 protected static String rgbToHtml(String rgb) {
211 String[] parts = rgb.split(","); 213 String[] parts = rgb.split(",");
212 int values[] = new int[parts.length]; 214 int values[] = new int[parts.length];
213 for (int i = 0; i < parts.length; i++) { 215 for (int i = 0; i < parts.length; i++) {
214 parts[i] = parts[i].trim(); 216 parts[i] = parts[i].trim();
215 try { 217 try {
227 hex += Integer.toHexString(values[i]); 229 hex += Integer.toHexString(values[i]);
228 } 230 }
229 return hex; 231 return hex;
230 } 232 }
231 233
232 protected String htmlToRgb(String html) { 234
235 protected static String htmlToRgb(String html) {
233 if (!html.startsWith("#")) { 236 if (!html.startsWith("#")) {
234 return "0, 0, 0"; 237 return "0, 0, 0";
235 } 238 }
236 239
237 int r = Integer.valueOf(html.substring(1, 3), 16); 240 int r = Integer.valueOf(html.substring(1, 3), 16);
238 int g = Integer.valueOf(html.substring(3, 5), 16); 241 int g = Integer.valueOf(html.substring(3, 5), 16);
239 int b = Integer.valueOf(html.substring(5, 7), 16); 242 int b = Integer.valueOf(html.substring(5, 7), 16);
240 243
241 return r + ", " + g + ", " + b; 244 return r + ", " + g + ", " + b;
242 } 245 }
246
243 247
244 protected void saveStyle () { 248 protected void saveStyle () {
245 GWT.log("StyleEditorWindow.saveStyle()"); 249 GWT.log("StyleEditorWindow.saveStyle()");
246 Config config = Config.getInstance(); 250 Config config = Config.getInstance();
247 String url = config.getServerUrl(); 251 String url = config.getServerUrl();
264 268
265 269
266 this.hide(); 270 this.hide();
267 } 271 }
268 272
273
269 protected final void setNewValue(String name, String value) { 274 protected final void setNewValue(String name, String value) {
270 Theme t = facet.getTheme(); 275 Theme t = facet.getTheme();
271 Style s = attributes.getStyle(t.getFacet(), t.getIndex()); 276 Style s = attributes.getStyle(t.getFacet(), t.getIndex());
272 StyleSetting set = s.getSetting(name); 277 StyleSetting set = s.getSetting(name);
273 if(name.equals("linecolor")) { 278 if(name.equals("linecolor")) {

http://dive4elements.wald.intevation.org