comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java @ 2058:f97cf2e350c9

Some refactoring done: all Sections subclass TypeSection now to be able to use the convinience methods for string, integer, double and boolean attributes. flys-artifacts/trunk@3550 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 27 Dec 2011 11:37:23 +0000
parents 2ae0627f956e
children ca8997aa683e
comparison
equal deleted inserted replaced
2057:49b7c2b1a6a7 2058:f97cf2e350c9
5 5
6 6
7 /** 7 /**
8 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> 8 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
9 */ 9 */
10 public class LegendSection extends DefaultSection { 10 public class LegendSection extends TypeSection {
11 11
12 public static final String VISIBILITY_ATTR = "visibility"; 12 public static final String VISIBILITY_ATTR = "visibility";
13 public static final String FONTSIZE_ATTR = "font-size"; 13 public static final String FONTSIZE_ATTR = "font-size";
14 14
15 15
21 public void setFontSize(int fontSize) { 21 public void setFontSize(int fontSize) {
22 if (fontSize <= 0) { 22 if (fontSize <= 0) {
23 return; 23 return;
24 } 24 }
25 25
26 Attribute attr = getAttribute(FONTSIZE_ATTR); 26 setIntegerValue(FONTSIZE_ATTR, fontSize);
27 if (attr == null) {
28 attr = new IntegerAttribute(FONTSIZE_ATTR, fontSize, true);
29 addAttribute(FONTSIZE_ATTR, attr);
30 }
31 else {
32 attr.setValue(fontSize);
33 }
34 } 27 }
35 28
36 29
37 public Integer getFontSize() { 30 public Integer getFontSize() {
38 IntegerAttribute ia = (IntegerAttribute) getAttribute(FONTSIZE_ATTR); 31 return getIntegerValue(FONTSIZE_ATTR);
39 return ia != null ? (Integer) ia.getValue() : null;
40 } 32 }
41 33
42 34
43 public void setVisibility(boolean visibility) { 35 public void setVisibility(boolean visibility) {
44 Attribute attr = getAttribute(VISIBILITY_ATTR); 36 setBooleanValue(VISIBILITY_ATTR, visibility);
45 if (attr == null) {
46 attr = new BooleanAttribute(VISIBILITY_ATTR, visibility, true);
47 addAttribute(VISIBILITY_ATTR, attr);
48 }
49 else {
50 attr.setValue(visibility);
51 }
52 } 37 }
53 38
54 39
55 public Boolean getVisibility() { 40 public Boolean getVisibility() {
56 BooleanAttribute ba = (BooleanAttribute) getAttribute(VISIBILITY_ATTR); 41 return getBooleanValue(VISIBILITY_ATTR);
57 return ba != null ? (Boolean ) ba.getValue() : null;
58 } 42 }
59 } 43 }
60 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 44 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org