Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java @ 1990:5c1e7c1e9e09
Improved the ChartSettings returned by charts - it now contains a legend specific section.
flys-artifacts/trunk@3426 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 15 Dec 2011 15:58:56 +0000 |
parents | |
children | 2ae0627f956e |
comparison
equal
deleted
inserted
replaced
1989:156304542edf | 1990:5c1e7c1e9e09 |
---|---|
1 package de.intevation.flys.exports; | |
2 | |
3 import de.intevation.artifactdatabase.state.Attribute; | |
4 import de.intevation.artifactdatabase.state.DefaultSection; | |
5 | |
6 | |
7 /** | |
8 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
9 */ | |
10 public class LegendSection extends DefaultSection { | |
11 | |
12 public static final String VISIBILITY_ATTR = "visibility"; | |
13 public static final String FONTSIZE_ATTR = "font-size"; | |
14 | |
15 | |
16 public LegendSection() { | |
17 super("legend"); | |
18 } | |
19 | |
20 | |
21 public void setFontSize(int fontSize) { | |
22 if (fontSize <= 0) { | |
23 return; | |
24 } | |
25 | |
26 Attribute attr = getAttribute(FONTSIZE_ATTR); | |
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 } | |
35 | |
36 | |
37 public void setVisibility(boolean visibility) { | |
38 Attribute attr = getAttribute(VISIBILITY_ATTR); | |
39 if (attr == null) { | |
40 attr = new BooleanAttribute(VISIBILITY_ATTR, visibility, true); | |
41 addAttribute(VISIBILITY_ATTR, attr); | |
42 } | |
43 else { | |
44 attr.setValue(visibility); | |
45 } | |
46 } | |
47 } | |
48 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |