Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.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 | 2d690611d110 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java Thu Aug 22 23:31:38 2013 +0200 @@ -8,7 +8,7 @@ package org.dive4elements.river.jfree; -import org.dive4elements.river.utils.ThemeUtil; +import org.dive4elements.river.themes.ThemeDocument; import java.awt.BasicStroke; import java.awt.Color; @@ -16,7 +16,6 @@ import org.apache.log4j.Logger; import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer; -import org.w3c.dom.Document; /** @@ -27,14 +26,13 @@ private static Logger logger = Logger.getLogger(XYStyle.class); - protected Document theme; + protected ThemeDocument theme; protected XYLineAndShapeRenderer renderer; - public XYStyle(Document theme) { + public XYStyle(ThemeDocument theme) { this.theme = theme; - this.renderer = null; } @@ -76,7 +74,7 @@ /** Set line color to renderer. */ protected void applyLineColor(XYLineAndShapeRenderer r, int idx) { - Color c = ThemeUtil.parseLineColorField(theme); + Color c = theme.parseLineColorField(); if(c != null) { logger.debug("applyLineColor " + c.toString()); r.setSeriesPaint(idx, c); @@ -92,10 +90,10 @@ if (!(r instanceof EnhancedLineAndShapeRenderer)) { return; } - boolean showLabelLine = ThemeUtil.parseShowLineLabel(theme); - boolean anyLabel = showLabelLine || ThemeUtil.parseShowWidth(theme) || - ThemeUtil.parseShowLevel(theme) || - ThemeUtil.parseShowMiddleHeight(theme); + boolean showLabelLine = theme.parseShowLineLabel(); + boolean anyLabel = showLabelLine || theme.parseShowWidth() || + theme.parseShowLevel() || + theme.parseShowMiddleHeight(); ((EnhancedLineAndShapeRenderer)r).setShowLineLabel(anyLabel, idx); } @@ -105,7 +103,7 @@ if (!(r instanceof EnhancedLineAndShapeRenderer)) { return; } - boolean showLabelLine = ThemeUtil.parseLabelShowBackground(theme); + boolean showLabelLine = theme.parseLabelShowBackground(); ((EnhancedLineAndShapeRenderer)r).setShowLineLabelBG(idx, showLabelLine); } @@ -116,7 +114,7 @@ return; } ((EnhancedLineAndShapeRenderer)r).setLineLabelFont( - ThemeUtil.parseTextFont(theme), idx); + theme.parseTextFont(), idx); } /** Tell the renderer which color to use for @@ -126,7 +124,7 @@ return; } ((EnhancedLineAndShapeRenderer)r).setLineLabelTextColor( - idx, ThemeUtil.parseTextColor(theme)); + idx, theme.parseTextColor()); } /** Tell the renderer which color to use for bg of @@ -136,12 +134,12 @@ return; } ((EnhancedLineAndShapeRenderer)r).setLineLabelBGColor(idx, - ThemeUtil.parseTextBackground(theme)); + theme.parseTextBackground()); } /** Set stroke of series. */ protected void applyLineSize(XYLineAndShapeRenderer r, int idx) { - int size = ThemeUtil.parseLineWidth(theme); + int size = theme.parseLineWidth(); r.setSeriesStroke( idx, new BasicStroke(size)); @@ -150,8 +148,8 @@ /** Set stroke strength of series. */ protected void applyLineType(XYLineAndShapeRenderer r, int idx) { - int size = ThemeUtil.parseLineWidth(theme); - float[] dashes = ThemeUtil.parseLineStyle(theme); + int size = theme.parseLineWidth(); + float[] dashes = theme.parseLineStyle(); // Do not apply the dashed style. if (dashes.length <= 1) { @@ -170,7 +168,7 @@ protected void applyPointSize(XYLineAndShapeRenderer r, int idx) { - int size = ThemeUtil.parsePointWidth(theme); + int size = theme.parsePointWidth(); int dim = 2 * size; r.setSeriesShape(idx, new Ellipse2D.Double(-size, -size, dim, dim)); @@ -178,7 +176,7 @@ protected void applyPointColor(XYLineAndShapeRenderer r, int idx) { - Color c = ThemeUtil.parsePointColor(theme); + Color c = theme.parsePointColor(); if (c != null) { r.setSeriesFillPaint(idx, c); @@ -192,7 +190,7 @@ * Sets form and visibility of points. */ protected void applyShowPoints(XYLineAndShapeRenderer r, int idx) { - boolean show = ThemeUtil.parseShowPoints(theme); + boolean show = theme.parseShowPoints(); r.setSeriesShapesVisible(idx, show); r.setDrawOutlines(true); @@ -200,7 +198,7 @@ protected void applyShowLine(XYLineAndShapeRenderer r, int idx) { - boolean show = ThemeUtil.parseShowLine(theme); + boolean show = theme.parseShowLine(); r.setSeriesLinesVisible(idx, show); } @@ -210,7 +208,7 @@ return; } - boolean visible = ThemeUtil.parseShowMinimum(theme); + boolean visible = theme.parseShowMinimum(); EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; er.setIsMinimumShapeVisisble(idx, visible); @@ -222,7 +220,7 @@ return; } - boolean visible = ThemeUtil.parseShowMaximum(theme); + boolean visible = theme.parseShowMaximum(); EnhancedLineAndShapeRenderer er = (EnhancedLineAndShapeRenderer) r; er.setIsMaximumShapeVisible(idx, visible);