Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.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 | a38640f273ae |
children | 7a9cbb3a3d5a |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -33,9 +33,8 @@ import org.dive4elements.river.model.River; import org.dive4elements.river.themes.LineStyle; import org.dive4elements.river.themes.TextStyle; -import org.dive4elements.river.themes.ThemeAccess; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.ThemeUtil; import java.awt.BasicStroke; import java.awt.Color; @@ -198,7 +197,7 @@ ChartArea area, LineStyle lineStyle, TextStyle textStyle, - Document theme + ThemeDocument theme ) { // OPTIMIZE pre-calculate area-related values final float TEXT_OFF = 0.03f; @@ -249,7 +248,7 @@ area2, annotation.getPos(), lineStyle); if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { // New line annotation to hit curve. - if (ThemeUtil.parseShowVerticalLine(theme)) { + if (theme.parseShowVerticalLine()) { XYLineAnnotation hitLineAnnotation = createStickyLineAnnotation( StickyAxisAnnotation.SimpleAxis.X_AXIS, @@ -258,7 +257,7 @@ plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, org.jfree.ui.Layer.BACKGROUND); } - if (ThemeUtil.parseShowHorizontalLine(theme)) { + if (theme.parseShowHorizontalLine()) { XYLineAnnotation lineBackAnnotation = createStickyLineAnnotation( StickyAxisAnnotation.SimpleAxis.Y_AXIS2, @@ -277,7 +276,7 @@ lineAnnotation = createLeftStickAnnotation(area, annotation.getPos(), lineStyle); if (!Float.isNaN(annotation.getHitPoint()) && theme != null) { // New line annotation to hit curve. - if (ThemeUtil.parseShowHorizontalLine(theme)) { + if (theme.parseShowHorizontalLine()) { XYLineAnnotation hitLineAnnotation = createStickyLineAnnotation( StickyAxisAnnotation.SimpleAxis.Y_AXIS, @@ -286,7 +285,7 @@ plot.getRenderer(rendererIndex).addAnnotation(hitLineAnnotation, org.jfree.ui.Layer.BACKGROUND); } - if (ThemeUtil.parseShowVerticalLine(theme)) { + if (theme.parseShowVerticalLine()) { XYLineAnnotation lineBackAnnotation = createStickyLineAnnotation( StickyAxisAnnotation.SimpleAxis.X_AXIS, @@ -452,15 +451,14 @@ for (RiverAnnotation fa: annotations) { // Access text styling, if any. - Document theme = fa.getTheme(); + ThemeDocument theme = fa.getTheme(); TextStyle textStyle = null; LineStyle lineStyle = null; // Get Themeing information and add legend item. if (theme != null) { - ThemeAccess themeAccess = new ThemeAccess(theme); - textStyle = themeAccess.parseTextStyle(); - lineStyle = themeAccess.parseLineStyle(); + textStyle = theme.parseTextStyle(); + lineStyle = theme.parseComplexLineStyle(); if (fa.getLabel() != null) { LegendItemCollection lic = new LegendItemCollection(); LegendItemCollection old = plot.getFixedLegendItems(); @@ -509,7 +507,7 @@ @Override public abstract void doOut( ArtifactAndFacet bundle, - Document attr, + ThemeDocument attr, boolean visible); @@ -622,7 +620,7 @@ public void doAnnotations( RiverAnnotation annotations, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ){ logger.debug("doAnnotations"); @@ -1834,11 +1832,10 @@ * * @return a new LegendItem instance. */ - public LegendItem createLegendItem(Document theme, String name) { + public LegendItem createLegendItem(ThemeDocument theme, String name) { // OPTIMIZE Pass font, parsed Theme items. - ThemeAccess themeAccess = new ThemeAccess(theme); - Color color = themeAccess.parseLineColorField(); + Color color = theme.parseComplexLineColorField(); LegendItem legendItem = new LegendItem(name, color); legendItem.setLabelFont(createLegendLabelFont());