annotate flys-artifacts/src/main/java/de/intevation/flys/exports/LegendSection.java @ 4569:276d9bd3c77d

Workaround for NPE in FloodMapState.
author Christian Lins <christian.lins@intevation.de>
date Tue, 20 Nov 2012 12:53:14 +0100
parents 2c86dd618c84
children
rev   line source
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 /**
3148
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
5 * Settings regarding legend of chart.
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 */
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.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
8 public class LegendSection extends TypeSection {
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9
3148
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
10 public static final String VISIBILITY_ATTR = "visibility";
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
11 public static final String FONTSIZE_ATTR = "font-size";
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
12 public static final String AGGREGATION_ATTR = "aggregation-threshold";
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 public LegendSection() {
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 super("legend");
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
3148
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
20 /** Register font size attribute and value. */
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 public void setFontSize(int fontSize) {
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 if (fontSize <= 0) {
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 return;
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25
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.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
26 setIntegerValue(FONTSIZE_ATTR, fontSize);
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
30 public Integer getFontSize() {
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.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
31 return getIntegerValue(FONTSIZE_ATTR);
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
32 }
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
33
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
34
3148
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
35 public Integer getAggregationThreshold() {
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
36 return getIntegerValue(AGGREGATION_ATTR);
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
37 }
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
38
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
39
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
40 public void setAggregationThreshold(int aggregationThreshold) {
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
41 setIntegerValue(AGGREGATION_ATTR, Math.abs(aggregationThreshold));
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
42 }
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
43
2c86dd618c84 Prepare legend aggregation threshold setting.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2064
diff changeset
44
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public void setVisibility(boolean visibility) {
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.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
46 setBooleanValue(VISIBILITY_ATTR, visibility);
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 }
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
48
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
49
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
50 public Boolean getVisibility() {
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.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2046
diff changeset
51 return getBooleanValue(VISIBILITY_ATTR);
2046
2ae0627f956e Improved ChartSettings and depending classes to avoid a lot of casting.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1990
diff changeset
52 }
1990
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 }
5c1e7c1e9e09 Improved the ChartSettings returned by charts - it now contains a legend specific section.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org