comparison artifacts/src/main/java/org/dive4elements/river/jfree/StyledAreaSeriesCollection.java @ 6905:1b35b2ddfc28

Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 22 Aug 2013 23:31:38 +0200
parents af13ceeba52a
children 7a9cbb3a3d5a
comparison
equal deleted inserted replaced
6904:d710bd3df387 6905:1b35b2ddfc28
11 import java.awt.BasicStroke; 11 import java.awt.BasicStroke;
12 import java.awt.Color; 12 import java.awt.Color;
13 import java.awt.Stroke; 13 import java.awt.Stroke;
14 14
15 import org.jfree.data.xy.XYSeriesCollection; 15 import org.jfree.data.xy.XYSeriesCollection;
16 import org.w3c.dom.Document;
17 16
18 import org.dive4elements.river.themes.ThemeAccess; 17 import org.dive4elements.river.themes.ThemeDocument;
19 import org.dive4elements.river.utils.ThemeUtil;
20
21 18
22 /** 19 /**
23 * One or more dataseries to draw a polygon (either "open up/downwards", or 20 * One or more dataseries to draw a polygon (either "open up/downwards", or
24 * the area between two curves), a theme-document and further display options. 21 * the area between two curves), a theme-document and further display options.
25 * The theme-document will later "style" the graphical representation. 22 * The theme-document will later "style" the graphical representation.
34 31
35 /** MODE in use. */ 32 /** MODE in use. */
36 protected FILL_MODE mode; 33 protected FILL_MODE mode;
37 34
38 /** The theme-document with attributes about actual visual representation. */ 35 /** The theme-document with attributes about actual visual representation. */
39 protected Document theme; 36 protected ThemeDocument theme;
40 37
41 38
42 /** 39 /**
43 * @param theme the theme-document. 40 * @param theme the theme-document.
44 */ 41 */
45 public StyledAreaSeriesCollection(Document theme) { 42 public StyledAreaSeriesCollection(ThemeDocument theme) {
46 this.theme = theme; 43 this.theme = theme;
47 this.mode = FILL_MODE.BETWEEN; 44 this.mode = FILL_MODE.BETWEEN;
48 } 45 }
49 46
50 47
83 else { 80 else {
84 renderer.setAreaCalculationMode(StableXYDifferenceRenderer.CALCULATE_ALL_AREA); 81 renderer.setAreaCalculationMode(StableXYDifferenceRenderer.CALCULATE_ALL_AREA);
85 } 82 }
86 83
87 // Apply text style. 84 // Apply text style.
88 new ThemeAccess(theme).parseTextStyle().apply(renderer); 85 theme.parseTextStyle().apply(renderer);
89 return renderer; 86 return renderer;
90 } 87 }
91 88
92 89
93 protected void applyFillColor(StableXYDifferenceRenderer renderer) { 90 protected void applyFillColor(StableXYDifferenceRenderer renderer) {
94 Color paint = ThemeUtil.parseColor( 91 Color paint = ThemeDocument.parseColor(
95 ThemeUtil.getAreaBackgroundColorString(theme)); 92 theme.getAreaBackgroundColorString());
96 93
97 int transparency = ThemeUtil.parseAreaTransparency(theme); 94 int transparency = theme.parseAreaTransparency();
98 if (transparency > 0 && paint != null) { 95 if (transparency > 0 && paint != null) {
99 paint = new Color( 96 paint = new Color(
100 paint.getRed(), 97 paint.getRed(),
101 paint.getGreen(), 98 paint.getGreen(),
102 paint.getBlue(), 99 paint.getBlue(),
119 } 116 }
120 } 117 }
121 118
122 119
123 protected void applyShowShape(StableXYDifferenceRenderer renderer) { 120 protected void applyShowShape(StableXYDifferenceRenderer renderer) {
124 boolean show = ThemeUtil.parseAreaShowBorder(theme); 121 boolean show = theme.parseAreaShowBorder();
125 renderer.setDrawOutline(show); 122 renderer.setDrawOutline(show);
126 } 123 }
127 124
128 125
129 protected void applyShowLine(StableXYDifferenceRenderer renderer) { 126 protected void applyShowLine(StableXYDifferenceRenderer renderer) {
130 boolean show = ThemeUtil.parseShowLine(theme); 127 boolean show = theme.parseShowLine();
131 renderer.setShapesVisible(show); 128 renderer.setShapesVisible(show);
132 } 129 }
133 130
134 131
135 protected void applyOutlineColor(StableXYDifferenceRenderer renderer) { 132 protected void applyOutlineColor(StableXYDifferenceRenderer renderer) {
136 Color c = ThemeUtil.parseLineColorField(theme); 133 Color c = theme.parseLineColorField();
137 renderer.setOutlinePaint(c); 134 renderer.setOutlinePaint(c);
138 } 135 }
139 136
140 protected void applyOutlineWidth(StableXYDifferenceRenderer renderer) { 137 protected void applyOutlineWidth(StableXYDifferenceRenderer renderer) {
141 int size = ThemeUtil.parseLineWidth(theme); 138 // int size = theme.parseLineWidth();
139 // XXX: Why is this not set?
142 } 140 }
143 141
144 /** Inform renderer whether it should draw a label. */ 142 /** Inform renderer whether it should draw a label. */
145 protected void applyShowArea(StableXYDifferenceRenderer renderer) { 143 protected void applyShowArea(StableXYDifferenceRenderer renderer) {
146 renderer.setLabelArea(ThemeUtil.parseShowArea(theme)); 144 renderer.setLabelArea(theme.parseShowArea());
147 } 145 }
148 146
149 protected void applyOutlineStyle(StableXYDifferenceRenderer renderer) { 147 protected void applyOutlineStyle(StableXYDifferenceRenderer renderer) {
150 float[] dashes = ThemeUtil.parseLineStyle(theme); 148 float[] dashes = theme.parseLineStyle();
151 int size = ThemeUtil.parseLineWidth(theme); 149 int size = theme.parseLineWidth();
152 150
153 Stroke stroke = null; 151 Stroke stroke = null;
154 152
155 if (dashes.length <= 1) { 153 if (dashes.length <= 1) {
156 stroke = new BasicStroke(Integer.valueOf(size)); 154 stroke = new BasicStroke(Integer.valueOf(size));

http://dive4elements.wald.intevation.org