# HG changeset patch # User Sascha L. Teichmann # Date 1377207098 -7200 # Node ID 1b35b2ddfc28ff94e5805185cb0106e93dff1f52 # Parent d710bd3df387a978b39bcbd6bdb81e35f1ddde59 Artifacts: Introduce ThemeDocument & make stuff compileable again. THIS BREAKS THE SYSTEM! TODO: Move ThemeUtils into ThemeDocument. diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ATExporter.java Thu Aug 22 23:31:38 2013 +0200 @@ -30,6 +30,7 @@ import org.dive4elements.river.model.Gauge; import org.dive4elements.river.model.River; import org.dive4elements.river.model.TimeInterval; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; import org.dive4elements.river.artifacts.access.RangeAccess; @@ -71,8 +72,8 @@ @Override public void doOut( ArtifactAndFacet artifactf, - Document attr, - boolean visible + ThemeDocument attr, + boolean visible ) { data = (WQ)artifactf.getData(context); } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java Thu Aug 22 23:31:38 2013 +0200 @@ -32,6 +32,7 @@ import org.dive4elements.river.artifacts.resources.Resources; import org.dive4elements.river.collections.D4EArtifactCollection; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.Formatter; @@ -158,7 +159,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactFacet.getFacetName(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator.java --- 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()); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ChartInfoGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartInfoGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartInfoGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,6 +10,7 @@ import org.dive4elements.river.collections.D4EArtifactCollection; import org.dive4elements.river.java2d.NOPGraphics2D; +import org.dive4elements.river.themes.ThemeDocument; import java.io.IOException; import java.io.OutputStream; @@ -106,9 +107,10 @@ /** * Dispatches the operation to the instantiated generator. */ + @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { generator.doOut(artifactFacet, attr, visible); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -21,6 +21,7 @@ import org.dive4elements.river.jfree.StickyAxisAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; import java.awt.Font; @@ -33,8 +34,6 @@ import org.apache.log4j.Logger; -import org.w3c.dom.Document; - /** * An OutGenerator that generates discharge curves, also at locations @@ -141,7 +140,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -213,7 +212,7 @@ protected void doWQOut( Object wq, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("ComputedDischargeCurveGenerator: doWQOut"); @@ -234,7 +233,7 @@ protected void doDischargeQOut( WQKms wqkms, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("ComputedDischargeCurveGenerator: doDischargeQOut"); @@ -266,7 +265,7 @@ protected void doQOut( WQKms wqkms, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("ComputedDischargeCurveGenerator: doQOut (add W/Q data)."); @@ -285,7 +284,7 @@ protected void doWQAnnotations( Object wqkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { List xy = new ArrayList(); @@ -311,7 +310,7 @@ protected void doWAnnotations( Object wqkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { Facet facet = aandf.getFacet(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/CrossSectionGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -21,7 +21,6 @@ import org.jfree.chart.annotations.XYTextAnnotation; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.DataProvider; @@ -36,10 +35,9 @@ import org.dive4elements.river.model.FastCrossSectionLine; 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.Formatter; -import org.dive4elements.river.utils.ThemeUtil; /** @@ -185,14 +183,13 @@ for(RiverAnnotation fa : this.annotations) { // Access text styling, if any. - Document theme = fa.getTheme(); + ThemeDocument theme = fa.getTheme(); TextStyle textStyle = null; // XXX: DEAD CODE // LineStyle lineStyle = null; // Get Themeing information and add legend item. if (theme != null) { - ThemeAccess themeAccess = new ThemeAccess(theme); - textStyle = themeAccess.parseTextStyle(); + textStyle = theme.parseTextStyle(); // XXX: DEAD CODE // lineStyle = themeAccess.parseLineStyle(); if (fa.getLabel() != null) { LegendItemCollection lic = new LegendItemCollection(); @@ -258,7 +255,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -332,7 +329,7 @@ protected void doCrossSectionWaterLineOut( Object o, String seriesName, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("CrossSectionGenerator.doCrossSectionWaterLineOut"); @@ -341,10 +338,10 @@ // DO NOT SORT DATA! This destroys the gaps indicated by NaNs. StyledXYSeries series = new StyledXYSeries(seriesName, false, theme); - if (!ThemeUtil.parseShowLineLabel(theme)) { + if (!theme.parseShowLineLabel()) { series.setLabel(""); } - if (ThemeUtil.parseShowWidth(theme)) { + if (theme.parseShowWidth()) { NumberFormat nf = Formatter.getMeterFormat(this.context); String labelAdd = "b=" + nf.format(lines.width) + "m"; if (series.getLabel().length() == 0) { @@ -354,7 +351,7 @@ series.setLabel(series.getLabel() + ", " + labelAdd); } } - if (ThemeUtil.parseShowLevel(theme) && lines.points.length > 1 + if (theme.parseShowLevel() && lines.points.length > 1 && lines.points[1].length > 0) { NumberFormat nf = Formatter.getMeterFormat(this.context); D4EArtifact flys = (D4EArtifact) master; @@ -369,7 +366,7 @@ series.setLabel(series.getLabel() + ", " + labelAdd); } } - if (ThemeUtil.parseShowMiddleHeight(theme) && lines.width != 0) { + if (theme.parseShowMiddleHeight() && lines.width != 0) { NumberFormat nf = Formatter.getMeterFormat(this.context); String labelAdd = "T=" + nf.format(lines.area / lines.width) + "m"; // : " + lines.area + "/" + lines.width); @@ -391,7 +388,7 @@ protected void doHyk( Object o, String seriesName, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("CrossSectionGenerator.doHyk"); @@ -419,7 +416,7 @@ protected void doCrossSectionOut( Object o, String seriesName, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("CrossSectionGenerator.doCrossSectionOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -23,8 +23,8 @@ import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.model.Gauge; import org.dive4elements.river.model.River; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.ThemeUtil; import org.apache.log4j.Logger; import org.jfree.chart.annotations.XYTextAnnotation; @@ -32,7 +32,6 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.data.Range; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; /** @@ -186,7 +185,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document theme, + ThemeDocument theme, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -231,7 +230,7 @@ D4EArtifact artifact, Object o, String description, - Document theme, + ThemeDocument theme, boolean visible) { logger.debug("DischargeCurveGenerator.doDischargeOut"); @@ -268,7 +267,7 @@ protected void doQOut( Object wqkms, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("DischargeCurveGenerator: doQOut (add W/Q data)."); @@ -285,7 +284,7 @@ String title, double x, double y, - Document theme + ThemeDocument theme ) { List textAnnos = new ArrayList(); @@ -330,7 +329,7 @@ protected void doWQOut( Object wq, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("DischargeCurveGenerator: doWQOut"); @@ -372,7 +371,7 @@ addAxisSeries(series, YAXIS.W.idx, visible); } - if (visible && ThemeUtil.parseShowPointLabel(theme) + if (visible && theme.parseShowPointLabel() && data != null && data.length != 0) { double[] xs = data[0]; diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DischargeLongitudinalSectionGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -12,8 +12,6 @@ import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; - import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -25,6 +23,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; @@ -49,7 +48,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { logger.debug("DischargeLongitudinalSectionGenerator.doOut"); @@ -111,10 +110,10 @@ * @param theme The theme that contains styling information. */ protected void doCorrectedWOut( - WQCKms wqckms, - Facet facet, - Document theme, - boolean visible + WQCKms wqckms, + Facet facet, + ThemeDocument theme, + boolean visible ) { logger.debug("DischargeLongitudinalSectionGenerator.doCorrectedWOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/DurationCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -14,6 +14,7 @@ import org.dive4elements.river.jfree.Bounds; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import java.awt.Font; import java.awt.geom.Point2D; @@ -24,7 +25,6 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.data.Range; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; /** @@ -173,7 +173,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -238,7 +238,7 @@ protected void doWOut( WQDay wqdays, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("DurationCurveGenerator.doWOut"); @@ -257,10 +257,10 @@ } protected void doPointOut( - Point2D point, + Point2D point, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ){ logger.debug("DurationCurveGenerator.doPointOut"); @@ -281,7 +281,7 @@ protected void doQOut( WQDay wqdays, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("DurationCurveGenerator.doQOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/FlowVelocityGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -14,8 +14,6 @@ import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; - import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -33,6 +31,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; @@ -209,7 +208,7 @@ */ public void doOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactAndFacet.getFacetName(); @@ -370,7 +369,7 @@ private void doBedQualityLoadDiameter( BedloadDiameterResult data, ArtifactAndFacet aandf, - Document attr, + ThemeDocument attr, boolean visible) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), attr); StyledSeriesBuilder.addPoints(series, data.getDiameterData(), true); @@ -382,7 +381,7 @@ private void doBedQualityTopLayerOut( BedDiameterResult data, ArtifactAndFacet aandf, - Document attr, + ThemeDocument attr, boolean visible) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), attr); StyledSeriesBuilder.addPoints(series, data.getDiameterSubData(), true); @@ -393,7 +392,7 @@ private void doBedQualitySubLayerOut( BedDiameterResult data, ArtifactAndFacet aandf, - Document attr, + ThemeDocument attr, boolean visible ) { logger.debug("Do beddiametersubout"); @@ -416,7 +415,7 @@ protected void doMainChannelOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FlowVelocityGenerator.doMainChannelOut"); @@ -433,7 +432,7 @@ protected void doVPointOut ( Object data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FlowVelocityGenerator.doVPointOut"); @@ -456,7 +455,7 @@ protected void doTotalChannelOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FlowVelocityGenerator.doTotalChannelOut"); @@ -486,10 +485,10 @@ protected void doQOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { - logger.debug("FlowVelocityGenerator.doTauOut"); + logger.debug("FlowVelocityGenerator.doQOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -509,7 +508,7 @@ protected void doTauOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FlowVelocityGenerator.doTauOut"); @@ -543,10 +542,10 @@ * @param visible whether or not visible. */ protected void doArea( - Object o, + Object o, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ) { logger.debug("FlowVelocityGenerator.doArea"); logger.warn("TODO: Implement FlowVelocityGenerator.doArea"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -25,6 +25,7 @@ import org.dive4elements.river.jfree.StyledTimeSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; import org.jfree.chart.plot.XYPlot; @@ -36,8 +37,6 @@ import org.jfree.data.time.TimeSeries; import org.jfree.data.time.TimeSeriesCollection; -import org.w3c.dom.Document; - /** * @author Ingo Weinzierl @@ -127,7 +126,7 @@ } @Override - public void doOut(ArtifactAndFacet artifactFacet, Document theme, + public void doOut(ArtifactAndFacet artifactFacet, ThemeDocument theme, boolean visible) { String name = artifactFacet.getFacetName(); logger.debug("HistoricalDischargeCurveGenerator.doOut: " + name); @@ -169,7 +168,7 @@ } protected void doHistoricalDischargeOutQ(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { logger.debug("doHistoricalDischargeOut(): description = " + desc); WQTimerange wqt = (WQTimerange) data; @@ -181,7 +180,7 @@ } protected void doHistoricalDischargeOutW(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { logger.debug("doHistoricalDischargeOut(): description = " + desc); WQTimerange wqt = (WQTimerange) data; @@ -193,7 +192,7 @@ } protected void doHistoricalDischargeDifferenceOutQ(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; @@ -205,7 +204,7 @@ } protected void doHistoricalDischargeDifferenceOutW(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { logger.debug("doHistoricalDischargeDifferenceOut: desc = " + desc); HistoricalWQTimerange wqt = (HistoricalWQTimerange) data; @@ -223,7 +222,7 @@ * looks like a "step chart". */ protected TimeSeriesCollection newTimeSeriesCollection( - Timerange[] timeranges, double[] values, Document theme, String desc) { + Timerange[] timeranges, double[] values, ThemeDocument theme, String desc) { logger.debug("Create new TimeSeriesCollection for: " + desc); TimeSeriesCollection tsc = new TimeSeriesCollection(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/HistoricalDischargeWQCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.artifacts.D4EArtifact; @@ -22,6 +21,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledValueMarker; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; @@ -105,7 +105,7 @@ } @Override - public void doOut(ArtifactAndFacet artifactFacet, Document theme, + public void doOut(ArtifactAndFacet artifactFacet, ThemeDocument theme, boolean visible) { String name = artifactFacet.getFacetName(); logger.debug("HistoricalDischargeWQCurveGenerator.doOut: " + name); @@ -150,19 +150,19 @@ } protected void doHistoricalDischargeOutQ(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { double value = Double.valueOf(data.toString()); addDomainMarker(new StyledValueMarker(value, theme), visible); } protected void doHistoricalDischargeOutW(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { double value = Double.valueOf(data.toString()); addValueMarker(new StyledValueMarker(value, theme), visible); } protected void doHistoricalDischargeCurveOut(D4EArtifact artifact, - Object data, String desc, Document theme, boolean visible) { + Object data, String desc, ThemeDocument theme, boolean visible) { XYSeries series = new StyledXYSeries(desc, theme); StyledSeriesBuilder.addPointsQW(series, (WQKms) data); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -26,6 +26,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledAreaSeriesCollection; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; import org.dive4elements.river.utils.RiverUtils; import org.apache.log4j.Logger; @@ -33,7 +34,6 @@ import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; /** @@ -321,7 +321,7 @@ @Override public void doOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactAndFacet.getFacetName(); @@ -411,7 +411,7 @@ protected void doWDifferencesOut( WKms wkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("WDifferencesCurveGenerator.doWDifferencesOut"); @@ -453,7 +453,7 @@ protected void doQOut( WQKms wqkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("LongitudinalSectionGenerator.doQOut"); @@ -536,7 +536,7 @@ protected void doArea( Object o, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("LongitudinalSectionGenerator.doArea"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MapGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -24,9 +24,9 @@ import org.dive4elements.river.artifacts.model.map.WSPLGENLayerFacet; import org.dive4elements.river.artifacts.states.WaterlevelGroundDifferences; import org.dive4elements.river.collections.D4EArtifactCollection; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.ArtifactMapfileGenerator; import org.dive4elements.river.utils.GeometryUtils; -import org.dive4elements.river.utils.ThemeUtil; import java.io.File; import java.io.FileNotFoundException; @@ -96,7 +96,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible) { String name = artifactFacet.getFacetName(); @@ -137,9 +137,9 @@ protected void createWSPLGENLayer( - D4EArtifact flys, + D4EArtifact flys, WMSLayerFacet wms, - Document attr + ThemeDocument attr ) { try { if(wms instanceof WSPLGENLayerFacet) { @@ -160,7 +160,8 @@ mfg.createUeskLayer( flys, (WSPLGENLayerFacet) wms, - ThemeUtil.createDynamicMapserverStyle(attr, from, to, step, context.getMeta()), + attr.createDynamicMapserverStyle( + from, to, step, context.getMeta()), context); } else { @@ -190,9 +191,9 @@ protected void createDatabaseLayer( - D4EArtifact flys, + D4EArtifact flys, WMSLayerFacet wms, - Document attr + ThemeDocument attr ) { logger.debug("createDatabaseLayer for facet: " + wms.getName()); @@ -211,7 +212,7 @@ mfg.createDatabaseLayer( flys, (WMSDBLayerFacet) wms, - ThemeUtil.createMapserverStyle(attr)); + attr.createMapserverStyle()); } else { logger.warn("Cannot create DB layer from: " + wms.getClass()); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/MiddleBedHeightGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -18,11 +18,11 @@ import org.dive4elements.river.exports.process.WOutProcessor; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; // TODO Move class to org.dive4elements.river.exports.minfo /** @@ -166,7 +166,7 @@ @Override public void doOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String name = artifactAndFacet.getFacetName(); @@ -249,7 +249,7 @@ protected void doHeightOut( MiddleBedHeightData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("MiddleBedHeightGenerator.doMainChannelOut"); @@ -283,10 +283,10 @@ * @param visible whether or not visible. */ protected void doArea( - Object o, + Object o, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ) { logger.debug("FlowVelocityGenerator.doArea"); logger.warn("TODO: Implement FlowVelocityGenerator.doArea"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/OutGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/OutGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -18,6 +18,7 @@ import org.dive4elements.artifacts.Artifact; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.collections.D4EArtifactCollection; +import org.dive4elements.river.themes.ThemeDocument; /** @@ -63,7 +64,7 @@ * producing the output. * @param visible Specifies, if this output should be visible or not. */ - void doOut(ArtifactAndFacet bundle, Document attr, boolean visible); + void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible); /** * Writes the collected output of all artifacts specified in the diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/OutputHelper.java Thu Aug 22 23:31:38 2013 +0200 @@ -40,6 +40,7 @@ import org.dive4elements.river.artifacts.model.ManagedDomFacet; import org.dive4elements.river.artifacts.model.ManagedFacet; import org.dive4elements.river.themes.Theme; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.themes.ThemeFactory; public class OutputHelper { @@ -76,6 +77,8 @@ ThemeList themeList = new ThemeList(attributes); + ThemeDocument themeDoc = new ThemeDocument(attributes); + List dataProviders = doBlackboardPass(themeList, context, outName); @@ -109,7 +112,7 @@ if (outName.equals("sq_overview")) { generator.doOut( dataProviders.get(i), - attributes, + themeDoc, theme.getActive() == 1); } else { @@ -141,7 +144,7 @@ * * @return an attribute in form of a document. */ - protected Document getFacetThemeFromAttribute( + protected ThemeDocument getFacetThemeFromAttribute( String uuid, String outName, String facet, @@ -219,7 +222,7 @@ Document doc = XMLUtils.newDocument(); doc.appendChild(doc.importNode(theme, true)); - return doc; + return new ThemeDocument(doc); } /** * Adds the theme of a facet to a CollectionItem's attribute. diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ReferenceCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -15,6 +15,7 @@ import org.dive4elements.river.artifacts.model.WWAxisTypes; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.Formatter; import java.awt.geom.Point2D; @@ -25,7 +26,6 @@ import org.jfree.chart.axis.TickUnits; import org.jfree.chart.axis.ValueAxis; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; /** * An OutGenerator that generates reference curves. @@ -137,7 +137,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document theme, + ThemeDocument theme, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -187,9 +187,9 @@ /** Register DataSeries with (maybe transformed) points. */ public void doReferenceOut( - Object data, - Document theme, - boolean visible + Object data, + ThemeDocument theme, + boolean visible ) { WW ww = (WW)data; @@ -216,10 +216,10 @@ // TODO resolve duplicate in DurationCurveGenerator protected void doPointOut( - Point2D point, + Point2D point, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ){ logger.debug("ReferenceCurveGenerator.doPointOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ReportGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ReportGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ReportGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -24,6 +24,7 @@ import org.dive4elements.river.artifacts.model.Calculation; import org.dive4elements.river.collections.D4EArtifactCollection; +import org.dive4elements.river.themes.ThemeDocument; import org.w3c.dom.Document; @@ -60,7 +61,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document attr, + ThemeDocument attr, boolean visible ) { logger.debug("doOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/ShapeExporter.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/ShapeExporter.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ShapeExporter.java Thu Aug 22 23:31:38 2013 +0200 @@ -14,6 +14,7 @@ import org.dive4elements.artifacts.common.utils.FileTools; import org.dive4elements.artifacts.common.utils.XMLUtils; import org.dive4elements.river.collections.D4EArtifactCollection; +import org.dive4elements.river.themes.ThemeDocument; import org.w3c.dom.Document; @@ -47,7 +48,7 @@ } @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { String name = bundle.getFacetName(); if (!isFacetValid(name)) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/TimeseriesChartGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -16,6 +16,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledTimeSeries; import org.dive4elements.river.jfree.TimeBounds; +import org.dive4elements.river.themes.ThemeDocument; import java.awt.Color; import java.awt.Font; @@ -51,7 +52,6 @@ import org.jfree.ui.Layer; import org.json.JSONArray; import org.json.JSONException; -import org.w3c.dom.Document; /** * Generator for diagrams with time on x axis. @@ -692,7 +692,7 @@ protected void doPoints( Object o, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int axisIndex ) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/WDifferencesCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -20,10 +20,10 @@ import org.dive4elements.river.exports.process.BedDiffHeightYearProcessor; import org.dive4elements.river.exports.process.BedheightProcessor; import org.dive4elements.river.exports.process.Processor; +import org.dive4elements.river.themes.ThemeDocument; import org.jfree.chart.JFreeChart; import org.jfree.chart.plot.XYPlot; -import org.w3c.dom.Document; /** @@ -101,7 +101,7 @@ /** Handle additional facets (beddifferences). */ @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { super.doOut(bundle, attr, visible); String name = bundle.getFacetName(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/XYChartGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -38,7 +38,6 @@ import org.jfree.data.xy.XYSeriesCollection; import org.json.JSONArray; import org.json.JSONException; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.jfree.Bounds; @@ -47,6 +46,7 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledAreaSeriesCollection; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; /** @@ -991,7 +991,7 @@ protected void doPoints( Object o, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int axisIndex ) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/extreme/ExtremeWQCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -17,7 +17,6 @@ import org.jfree.chart.plot.XYPlot; import org.jfree.chart.title.TextTitle; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -33,8 +32,8 @@ import org.dive4elements.river.jfree.JFreeUtil; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.ThemeUtil; /** @@ -76,7 +75,7 @@ /** First, ask parent to add data, then handle extreme_wq_curve(_base) data.*/ @Override - public boolean prepareChartData(ArtifactAndFacet aaf, Document theme, boolean visible) { + public boolean prepareChartData(ArtifactAndFacet aaf, ThemeDocument theme, boolean visible) { if (super.prepareChartData(aaf, theme, visible)) { return true; } @@ -104,7 +103,7 @@ } /** Do Extreme Curve nonextrapolated points out. */ - protected void doExtremeCurveBaseOut(ArtifactAndFacet aaf, Document theme, boolean visible) { + protected void doExtremeCurveBaseOut(ArtifactAndFacet aaf, ThemeDocument theme, boolean visible) { logger.debug("doExtremeCurveBaseOut"); ExtremeCurveFacet facet = (ExtremeCurveFacet) aaf.getFacet(); Curve curve = (Curve) facet.getData(aaf.getArtifact(), context); @@ -136,7 +135,7 @@ /** Do Extreme Curve out */ - protected void doExtremeCurveOut(ArtifactAndFacet aaf, Document theme, boolean visible) { + protected void doExtremeCurveOut(ArtifactAndFacet aaf, ThemeDocument theme, boolean visible) { logger.debug("doExtremeCurveOut"); ExtremeCurveFacet facet = (ExtremeCurveFacet) aaf.getFacet(); Curve curve = (Curve) facet.getData(aaf.getArtifact(), context); @@ -159,7 +158,7 @@ maxQ); // end // Add marker from where on its extrapolated. - if (ThemeUtil.parseShowExtraMark(theme)) { + if (theme.parseShowExtraMark()) { double[] qs = curve.getQs(); double extrapolateFrom = qs[qs.length-1]; diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixATExport.java Thu Aug 22 23:31:38 2013 +0200 @@ -16,6 +16,7 @@ import org.dive4elements.river.artifacts.access.FixAccess; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; import org.dive4elements.river.artifacts.math.fitting.Function; @@ -37,7 +38,6 @@ import org.apache.log4j.Logger; -import org.w3c.dom.Document; import org.w3c.dom.NodeList; /** Export result of fixation analysis. */ @@ -52,7 +52,7 @@ @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { logger.debug("AT Export doOut()."); Object data = bundle.getData(context); if (data instanceof CalculationResult) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDeltaWtGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -23,7 +23,7 @@ import org.dive4elements.river.jfree.StyledDomainMarker; import org.dive4elements.river.jfree.StyledTimeSeries; import org.dive4elements.river.jfree.StyledValueMarker; -import org.dive4elements.river.utils.ThemeUtil; +import org.dive4elements.river.themes.ThemeDocument; import java.io.OutputStream; import java.text.NumberFormat; @@ -160,7 +160,7 @@ @Override public void doOut( ArtifactAndFacet artifactFacet, - Document theme, + ThemeDocument theme, boolean visible ) { String name = artifactFacet.getFacetName(); @@ -230,11 +230,11 @@ protected void doReferencePeriodsOut( - D4EArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible) + D4EArtifact artifact, + Object data, + String desc, + ThemeDocument theme, + boolean visible) { logger.debug("doReferencePeriodsOut()"); @@ -260,11 +260,11 @@ protected void doSectorAverageOut( - D4EArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible) + D4EArtifact artifact, + Object data, + String desc, + ThemeDocument theme, + boolean visible) { logger.debug("doSectorAverageOut(): description = " + desc); @@ -289,7 +289,7 @@ addAxisDataset(tsc, 0, visible); - if (visible && ThemeUtil.parseShowLineLabel(theme)) { + if (visible && theme.parseShowLineLabel()) { List textAnnos = new ArrayList(); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( "\u0394 W(t) [cm] " + (float)Math.round(qwd.qwd.getDeltaW() * 10000) / 10000, @@ -308,7 +308,7 @@ D4EArtifact artifact, Object data, String desc, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("doAnalysisEventsOut: desc = " + desc); @@ -318,7 +318,7 @@ } - protected void doQWDEventsOut(QWD qwd, String desc, Document theme, boolean visible) + protected void doQWDEventsOut(QWD qwd, String desc, ThemeDocument theme, boolean visible) { TimeSeriesCollection tsc = new TimeSeriesCollection(); @@ -369,11 +369,11 @@ * @param annoIdxMap map of index in qwds to series/data item indices in tsc. */ protected void doQWDTextAnnotations(Map annoIdxMap, - TimeSeriesCollection tsc, QWD qwd, Document theme, + TimeSeriesCollection tsc, QWD qwd, ThemeDocument theme, boolean visible) { logger.debug("doQWDTextAnnotation()"); - if (!visible || !ThemeUtil.parseShowPointLabel(theme)) { + if (!visible || !theme.parseShowPointLabel()) { logger.debug("doQWDTextAnnotation: annotation not visible"); return; } @@ -401,11 +401,11 @@ protected void doReferenceEventsOut( - D4EArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible + D4EArtifact artifact, + Object data, + String desc, + ThemeDocument theme, + boolean visible ) { logger.debug("doReferenceEventsOut: desc = " + desc); @@ -415,11 +415,11 @@ protected void doDeviationOut( - D4EArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible + D4EArtifact artifact, + Object data, + String desc, + ThemeDocument theme, + boolean visible ) { logger.debug("doDeviationOut: desc = " + desc); @@ -438,10 +438,10 @@ protected void doAnalysisPeriodsOut( D4EArtifact artifact, - Object data, - String desc, - Document theme, - boolean visible) + Object data, + String desc, + ThemeDocument theme, + boolean visible) { DateRange[] ranges = (DateRange[]) data; if (ranges == null || !visible) { @@ -473,7 +473,9 @@ context.putContextValue("currentKm", currentKm); - StyledValueMarker marker = new StyledValueMarker(0, request); + // XXX: This looks hackish! + StyledValueMarker marker = + new StyledValueMarker(0, new ThemeDocument(request)); valueMarker.add(marker); } } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixDerivedCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -9,7 +9,6 @@ package org.dive4elements.river.exports.fixings; import org.apache.log4j.Logger; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.artifacts.model.FacetTypes; @@ -19,6 +18,7 @@ import org.dive4elements.river.exports.ChartGenerator; import org.dive4elements.river.jfree.JFreeUtil; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; /** * Generator for fixation derived function curve. @@ -65,7 +65,7 @@ @Override - public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doOut"); if (FacetTypes.IS.MANUALPOINTS(aaf.getFacetName())) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixLongitudinalSectionGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -27,13 +27,13 @@ import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledAreaSeriesCollection; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; import org.dive4elements.river.utils.KMIndex; import org.dive4elements.river.utils.RiverUtils; import org.jfree.chart.plot.Marker; import org.jfree.chart.plot.ValueMarker; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; public class FixLongitudinalSectionGenerator extends FixChartGenerator @@ -81,7 +81,7 @@ } @Override - public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { String name = aaf.getFacetName(); logger.debug("FixLongitudinalSectionGenerator: doOut: " + name); @@ -136,7 +136,7 @@ protected void doQOut( WQKms wqkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("LongitudinalSectionGenerator.doQOut"); @@ -184,7 +184,7 @@ @SuppressWarnings("unchecked") protected void doSectorAverageDeviationOut( ArtifactAndFacet aaf, - Document doc, + ThemeDocument doc, boolean visible) { logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex()); @@ -230,7 +230,7 @@ @SuppressWarnings("unchecked") protected void doReferenceDeviationOut( ArtifactAndFacet aaf, - Document doc, + ThemeDocument doc, boolean visible) { logger.debug("doReferenceOut"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/fixings/FixWQCurveGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -27,7 +27,6 @@ import org.jfree.ui.RectangleAnchor; import org.jfree.ui.RectangleInsets; import org.jfree.ui.TextAnchor; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -57,8 +56,8 @@ import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.model.Gauge; import org.dive4elements.river.model.River; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.RiverUtils; -import org.dive4elements.river.utils.ThemeUtil; /** * Generator for WQ fixing charts. @@ -175,7 +174,7 @@ } @Override - public void doOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + public void doOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doOut: " + aaf.getFacetName()); if (!prepareChartData(aaf, doc, visible)) { logger.warn("Unknown facet, name " + aaf.getFacetName()); @@ -186,7 +185,7 @@ * Return true if data could be handled, * to be overridden to add more handled data. */ - public boolean prepareChartData(ArtifactAndFacet aaf, Document doc, boolean visible) { + public boolean prepareChartData(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { String name = aaf.getFacetName(); this.artifact = (D4EArtifact) aaf.getArtifact(); @@ -257,7 +256,7 @@ /** Add sector average points to chart. */ - protected void doSectorAverageOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doSectorAverageOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doSectorAverageOut"); QWDDateRange qwdd = (QWDDateRange) aaf.getData(context); @@ -272,7 +271,7 @@ } /** Add analysis event points to chart. */ - protected void doAnalysisEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doAnalysisEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doAnalysisEventsOut"); QWD qwd = (QWD)aaf.getData(context); @@ -292,7 +291,7 @@ textAnnos.add(anno); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(doc)) { + if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); @@ -305,7 +304,7 @@ /** Add reference event points to chart. */ - protected void doReferenceEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doReferenceEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doReferenceEventsOut"); QWI qwd = (QWI)aaf.getData(context); @@ -329,7 +328,7 @@ textAnnos.add(anno); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(doc)) { + if(visible && doc.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, doc); flysAnno.setTextAnnotations(textAnnos); addAnnotations(flysAnno); @@ -338,9 +337,9 @@ private void addPointFromWQKms(WQKms wqkms, - String title, - Document theme, - boolean visible + String title, + ThemeDocument theme, + boolean visible ) { XYSeries series = new StyledXYSeries(title, theme); Double ckm = (Double) context.getContextValue(CURRENT_KM); @@ -353,7 +352,7 @@ if (Math.abs(kms[i] - ckm) <= EPSILON) { series.add(wqkms.getQ(i), wqkms.getW(i), false); addAxisSeries(series, YAXIS.W.idx, visible); - if(visible && ThemeUtil.parseShowPointLabel(theme)) { + if(visible && theme.parseShowPointLabel()) { List textAnnos = new ArrayList(); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( title, @@ -369,7 +368,7 @@ } } - protected void doEventsOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doEventsOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doEventsOut"); // Find W/Q at km. addPointFromWQKms((WQKms) aaf.getData(context), @@ -377,7 +376,7 @@ } - protected void doWQCurveOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doWQCurveOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doWQCurveOut"); FixWQCurveFacet facet = (FixWQCurveFacet)aaf.getFacet(); @@ -428,7 +427,7 @@ } } - protected void doOutlierOut(ArtifactAndFacet aaf, Document doc, boolean visible) { + protected void doOutlierOut(ArtifactAndFacet aaf, ThemeDocument doc, boolean visible) { logger.debug("doOutlierOut"); QWI[] qws = (QWI[])aaf.getData(context); @@ -437,7 +436,7 @@ /** Add markers for q sectors. */ - protected void doQSectorOut(ArtifactAndFacet aaf, Document theme, boolean visible) { + protected void doQSectorOut(ArtifactAndFacet aaf, ThemeDocument theme, boolean visible) { logger.debug("doQSectorOut"); if (!visible) { return; @@ -465,8 +464,8 @@ Marker m = new ValueMarker(qsector.getValue()); m.setPaint(Color.black); - float[] dashes = ThemeUtil.parseLineStyle(theme); - int size = ThemeUtil.parseLineWidth(theme); + float[] dashes = theme.parseLineStyle(); + int size = theme.parseLineWidth(); BasicStroke stroke; if (dashes.length <= 1) { stroke = new BasicStroke(size); @@ -481,12 +480,12 @@ } m.setStroke(stroke); - if (ThemeUtil.parseShowLineLabel(theme)) { + if (theme.parseShowLineLabel()) { m.setLabel(qsector.getName()); - m.setPaint(ThemeUtil.parseTextColor(theme)); - m.setLabelFont(ThemeUtil.parseTextFont(theme)); + m.setPaint(theme.parseTextColor()); + m.setLabelFont(theme.parseTextFont()); } - Color paint = ThemeUtil.parseLineColorField(theme); + Color paint = theme.parseLineColorField(); if (paint != null) { m.setPaint(paint); } @@ -504,10 +503,10 @@ * @param theme theme to use. */ protected void doWAnnotations( - Object wqkms, + Object wqkms, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ) { Facet facet = aandf.getFacet(); @@ -549,7 +548,7 @@ WINFOArtifact artifact, Object o, String description, - Document theme, + ThemeDocument theme, boolean visible) { WQKms wqkms = (WQKms) o; @@ -583,7 +582,7 @@ protected void doWQOut( Object wqkms, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { logger.debug("FixWQCurveGenerator: doWQOut"); @@ -609,7 +608,7 @@ protected void addQWSeries( QWI [] qws, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible ) { if (qws == null) { @@ -638,7 +637,7 @@ } addAxisSeries(series, YAXIS.W.idx, visible); - if (visible && ThemeUtil.parseShowPointLabel(theme)) { + if (visible && theme.parseShowPointLabel()) { RiverAnnotation flysAnno = new RiverAnnotation(null, null, null, theme); flysAnno.setTextAnnotations(textAnnos); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDiffHeightYearGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -9,7 +9,6 @@ package org.dive4elements.river.exports.minfo; import org.apache.log4j.Logger; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -19,6 +18,7 @@ import org.dive4elements.river.exports.process.KMIndexProcessor; import org.dive4elements.river.exports.process.Processor; import org.dive4elements.river.jfree.RiverAnnotation; +import org.dive4elements.river.themes.ThemeDocument; public class BedDiffHeightYearGenerator @@ -68,7 +68,7 @@ } @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { String name = bundle.getFacetName(); logger.debug("doOut: " + name); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceEpochGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -28,6 +27,7 @@ import org.dive4elements.river.jfree.DoubleBounds; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; import org.dive4elements.river.utils.RiverUtils; @@ -86,7 +86,7 @@ } @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { String name = bundle.getFacetName(); logger.debug("doOut: " + name); @@ -215,7 +215,7 @@ } protected void doBedDifferenceEpochOut(BedDiffEpochResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); StyledSeriesBuilder.addPoints(series, data.getDifferencesData(), true); @@ -226,7 +226,7 @@ private void doBedDifferenceHeightsOut( BedDiffEpochResult data, ArtifactAndFacet bundle, - Document attr, + ThemeDocument attr, boolean visible, int idx) { logger.debug("doBedDifferenceHeightOut()"); @@ -245,7 +245,7 @@ protected void doWDifferencesOut( WKms wkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { if (wkms == null) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedDifferenceYearGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -28,6 +27,7 @@ import org.dive4elements.river.exports.process.WOutProcessor; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; import org.dive4elements.river.utils.RiverUtils; @@ -87,7 +87,7 @@ @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { String name = bundle.getFacetName(); logger.debug("doOut: " + name); @@ -158,7 +158,7 @@ private void doMorphologicWidthOut( MorphologicWidth data, ArtifactAndFacet bundle, - Document attr, + ThemeDocument attr, boolean visible, int i) { XYSeries series = new StyledXYSeries(bundle.getFacetDescription(), attr); @@ -210,7 +210,7 @@ protected void doBedDifferenceMorphWidthOut(BedDiffYearResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("doBedDifferencesMorphWidthOut()"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -220,10 +220,10 @@ } protected void doWDifferencesOut( - WKms wkms, + WKms wkms, ArtifactAndFacet aandf, - Document theme, - boolean visible + ThemeDocument theme, + boolean visible ) { if (wkms == null) { logger.warn("No data to add to WDifferencesChart."); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/BedQualityGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -23,6 +22,7 @@ import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; /** @@ -141,8 +141,11 @@ * theme for facet */ @Override - public void doOut(ArtifactAndFacet artifactAndFacet, Document attr, - boolean visible) { + public void doOut( + ArtifactAndFacet artifactAndFacet, + ThemeDocument attr, + boolean visible + ) { String name = artifactAndFacet.getFacetName(); logger.debug("BedQualityGenerator.doOut: " + name); @@ -222,7 +225,7 @@ private void doBedDiameterDataOut( BedDiameterData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -232,7 +235,7 @@ } protected void doBedDiameterTopLayerOut(BedDiameterResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doBedDiameterTopLayerOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -242,7 +245,7 @@ } protected void doBedDiameterSubLayerOut(BedDiameterResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doBedDiameterSubLayerOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -252,7 +255,7 @@ } protected void doBedLoadDiameterOut(BedloadDiameterResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doBedLoadDiameterOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -262,7 +265,7 @@ } protected void doPorosityTopLayerOut(BedParametersResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doPorosityTopLayerOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -274,7 +277,7 @@ } protected void doPorositySubLayerOut(BedParametersResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doPorositySubLayerOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -286,7 +289,7 @@ } protected void doDensityTopLayerOut(BedParametersResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doDensityOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -298,7 +301,7 @@ } protected void doDensitySubLayerOut(BedParametersResult data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { logger.debug("BedQuality.doDensityOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadLSGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -13,7 +13,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifactdatabase.state.Facet; @@ -33,6 +32,7 @@ import org.dive4elements.river.jfree.DoubleBounds; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; @@ -94,7 +94,7 @@ } @Override - public void doOut(ArtifactAndFacet bundle, Document attr, boolean visible) { + public void doOut(ArtifactAndFacet bundle, ThemeDocument attr, boolean visible) { String name = bundle.getFacetName(); logger.debug("doOut: " + name); @@ -259,7 +259,7 @@ } protected void doSedimentLoadOut(double[][] data, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { // Allow for gaps (NaNs). XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), false, theme); @@ -269,7 +269,7 @@ } protected void doSedimentLoadUnknownOut(SedimentLoad load, - ArtifactAndFacet aandf, Document theme, boolean visible) { + ArtifactAndFacet aandf, ThemeDocument theme, boolean visible) { Set kms = load.getKms(); double[][] data = new double[2][kms.size()]; @@ -289,7 +289,7 @@ protected void doFlowVelocityMainOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -301,7 +301,7 @@ protected void doFlowVelocityTotalOut( FlowVelocityData data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { if (data == null) { @@ -318,7 +318,7 @@ protected void doBedDifferenceYearOut( BedDiffYearResult data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -330,7 +330,7 @@ protected void doBedDifferenceEpochOut( BedDiffEpochResult data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -342,7 +342,7 @@ protected void doWDifferencesOut( WKms wkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible ) { if (wkms == null) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffHeightYearProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; @@ -19,6 +18,7 @@ import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; public class BedDiffHeightYearProcessor implements Processor, FacetTypes { @@ -32,7 +32,7 @@ public void doOut( XYChartGenerator generator, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int index ) { @@ -59,7 +59,7 @@ protected void doBedDifferenceYearOut(XYChartGenerator generator, BedDiffYearResult data, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int axidx) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedDiffYearProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; @@ -19,6 +18,7 @@ import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; public class BedDiffYearProcessor implements Processor, FacetTypes { @@ -32,7 +32,7 @@ public void doOut( XYChartGenerator generator, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int axidx ) { @@ -65,7 +65,7 @@ XYChartGenerator generator, BedDiffYearResult data, ArtifactAndFacet bundle, - Document attr, + ThemeDocument attr, boolean visible, int idx, int axidx) { diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/BedheightProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -12,7 +12,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; @@ -20,6 +19,7 @@ import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledXYSeries; import org.dive4elements.river.model.BedHeightSingleValue; +import org.dive4elements.river.themes.ThemeDocument; public class BedheightProcessor implements Processor { @@ -32,7 +32,7 @@ public void doOut( XYChartGenerator generator, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int index ) { @@ -50,9 +50,9 @@ } private void doBedheightSingeValuesOut(XYChartGenerator generator, - ArtifactAndFacet aandf, Document theme, int index, boolean visible, + ArtifactAndFacet aandf, ThemeDocument theme, int index, boolean visible, List data) { - logger.debug("doBedheightSingleOut"); + logger.debug("doBedheightSingeValuesOut"); XYSeries series = new StyledXYSeries(aandf.getFacetDescription(), theme); @@ -68,7 +68,7 @@ } public void doBedheightSingleOut(XYChartGenerator generator, - ArtifactAndFacet aandf, Document theme, int index, boolean visible, + ArtifactAndFacet aandf, ThemeDocument theme, int index, boolean visible, BedHeightSingle data) { double[] width = data.getMorphWidths(); double[] stations = data.getStations().toNativeArray(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/DischargeProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -13,19 +13,17 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; import org.dive4elements.river.artifacts.model.FacetTypes; import org.dive4elements.river.artifacts.model.WQKms; import org.dive4elements.river.exports.DischargeCurveGenerator; -import org.dive4elements.river.exports.StyledSeriesBuilder; import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.CollisionFreeXYTextAnnotation; import org.dive4elements.river.jfree.RiverAnnotation; import org.dive4elements.river.jfree.StyledXYSeries; -import org.dive4elements.river.utils.ThemeUtil; +import org.dive4elements.river.themes.ThemeDocument; import org.jfree.chart.annotations.XYTextAnnotation; @@ -60,7 +58,7 @@ public void doOut( XYChartGenerator generator, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int index ) { @@ -112,7 +110,7 @@ protected void doWQKmsPointOut(XYChartGenerator generator, WQKms wqkms, ArtifactAndFacet aandf, - Document theme, + ThemeDocument theme, boolean visible, int axidx ) { @@ -127,7 +125,7 @@ if (Math.abs(kms[i] - getKm()) <= KM_EPSILON) { series.add(wqkms.getQ(i), wqkms.getW(i)); generator.addAxisSeries(series, axidx, visible); - if(visible && ThemeUtil.parseShowPointLabel(theme)) { + if(visible && theme.parseShowPointLabel()) { List textAnnos = new ArrayList(); XYTextAnnotation anno = new CollisionFreeXYTextAnnotation( title, diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/KMIndexProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -11,7 +11,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; import org.jfree.data.xy.XYSeriesCollection; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; @@ -20,6 +19,7 @@ import org.dive4elements.river.artifacts.model.fixings.QWD; import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.KMIndex; public class KMIndexProcessor implements Processor { @@ -28,7 +28,7 @@ @Override public void doOut(XYChartGenerator generator, ArtifactAndFacet aandf, - Document theme, boolean visible, int index) { + ThemeDocument theme, boolean visible, int index) { String facettype = aandf.getFacetName(); if (facettype.contains(FacetTypes.FIX_SECTOR_AVERAGE_LS)) { doSectorAverageOut(generator, aandf, theme, visible, index); @@ -58,7 +58,7 @@ } private void doSectorAverageOut(XYChartGenerator generator, ArtifactAndFacet aaf, - Document doc, boolean visible, int idx) { + ThemeDocument doc, boolean visible, int idx) { logger.debug("doSectorAverageOut" + aaf.getFacet().getIndex()); CallContext context = generator.getCallContext(); @@ -90,7 +90,7 @@ } private void doReferenceEventsOut(XYChartGenerator generator, - ArtifactAndFacet aaf, Document doc, boolean visible, int idx) { + ArtifactAndFacet aaf, ThemeDocument doc, boolean visible, int idx) { logger.debug("doReferenceEventOut"); CallContext context = generator.getCallContext(); @@ -120,7 +120,7 @@ } private void doAnalysisEventsOut(XYChartGenerator generator, - ArtifactAndFacet aaf, Document doc, boolean visible, int idx) { + ArtifactAndFacet aaf, ThemeDocument doc, boolean visible, int idx) { logger.debug("doAnalysisEventsOut"); CallContext context = generator.getCallContext(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/Processor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/Processor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/Processor.java Thu Aug 22 23:31:38 2013 +0200 @@ -8,10 +8,9 @@ package org.dive4elements.river.exports.process; -import org.w3c.dom.Document; - import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.river.exports.XYChartGenerator; +import org.dive4elements.river.themes.ThemeDocument; /** * A processor is intended to generate an output e.g. curve in a chart diagramm from @@ -32,10 +31,10 @@ */ public void doOut( XYChartGenerator generator, - ArtifactAndFacet aandf, - Document theme, - boolean visible, - int index); + ArtifactAndFacet aandf, + ThemeDocument theme, + boolean visible, + int index); /** * Returns true if the Processor class is able to generate output for a facet type diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/process/WOutProcessor.java Thu Aug 22 23:31:38 2013 +0200 @@ -10,7 +10,6 @@ import org.apache.log4j.Logger; import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; import org.dive4elements.artifactdatabase.state.ArtifactAndFacet; import org.dive4elements.artifacts.CallContext; @@ -20,8 +19,8 @@ import org.dive4elements.river.exports.XYChartGenerator; import org.dive4elements.river.jfree.StyledAreaSeriesCollection; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.dive4elements.river.utils.DataUtil; -import org.dive4elements.river.utils.ThemeUtil; /** * Add data to chart/generator. @@ -38,7 +37,7 @@ public void doOut( XYChartGenerator generator, ArtifactAndFacet aaf, - Document theme, + ThemeDocument theme, boolean visible, int index) { @@ -53,7 +52,7 @@ generator.addAxisSeries(series, index, visible); // If a "band around the curve shall be drawn, add according area. - double bandWidth = ThemeUtil.parseBandWidth(theme); + double bandWidth = theme.parseBandWidth(); if (bandWidth > 0 ) { XYSeries seriesDown = new StyledXYSeries( "band " + aaf.getFacetDescription(), false, theme); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQOverviewGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -38,6 +38,7 @@ import org.dive4elements.river.exports.ChartGenerator; import org.dive4elements.river.exports.OutGenerator; import org.dive4elements.river.exports.OutputHelper; +import org.dive4elements.river.themes.ThemeDocument; public class SQOverviewGenerator implements OutGenerator @@ -69,7 +70,7 @@ @Override public void doOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { logger.debug("doOut()"); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationGenerator.java --- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationGenerator.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationGenerator.java Thu Aug 22 23:31:38 2013 +0200 @@ -24,6 +24,7 @@ import org.dive4elements.river.jfree.JFreeUtil; import org.dive4elements.river.jfree.StyledXYSeries; +import org.dive4elements.river.themes.ThemeDocument; import org.apache.log4j.Logger; @@ -32,7 +33,6 @@ import org.jfree.data.xy.XYSeries; -import org.w3c.dom.Document; /** * An OutGenerator that generates charts for MINFO sq relation. @@ -135,7 +135,7 @@ @Override public void doOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { logger.debug("doOut"); @@ -172,7 +172,7 @@ protected void doSQCurveOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String desc = artifactAndFacet.getFacetDescription(); @@ -208,7 +208,7 @@ protected void doSQOut( ArtifactAndFacet artifactAndFacet, - Document attr, + ThemeDocument attr, boolean visible ) { String desc = artifactAndFacet.getFacetDescription(); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/JFreeUtil.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/JFreeUtil.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/JFreeUtil.java Thu Aug 22 23:31:38 2013 +0200 @@ -16,9 +16,9 @@ import org.apache.log4j.Logger; import org.jfree.chart.entity.ChartEntity; import org.jfree.chart.entity.EntityCollection; -import org.w3c.dom.Document; import org.dive4elements.river.artifacts.math.Function; +import org.dive4elements.river.themes.ThemeDocument; public class JFreeUtil { @@ -107,7 +107,7 @@ public static StyledXYSeries sampleFunction2D( Function func, - Document theme, + ThemeDocument theme, String seriesKey, int samples, double start, @@ -127,7 +127,7 @@ public static StyledXYSeries sampleFunction2DPositive( Function func, - Document theme, + ThemeDocument theme, String seriesKey, int samples, double start, diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/RiverAnnotation.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/RiverAnnotation.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/RiverAnnotation.java Thu Aug 22 23:31:38 2013 +0200 @@ -9,12 +9,12 @@ package org.dive4elements.river.jfree; import org.dive4elements.river.artifacts.model.HYKFactory; +import org.dive4elements.river.themes.ThemeDocument; import java.util.Collections; import java.util.List; import org.jfree.chart.annotations.XYTextAnnotation; -import org.w3c.dom.Document; /** * List of Text- Annotations (Sticky to one axis or in space) @@ -32,7 +32,7 @@ protected List boxes; /** Styling information. */ - protected Document theme; + protected ThemeDocument theme; /** Chart-legend information. */ protected String label; @@ -53,7 +53,7 @@ /** Create annotations, parameter might be null. */ public RiverAnnotation(String label, List annotations, - List bAnnotations, Document theme + List bAnnotations, ThemeDocument theme ) { this.label = label; this.axisTextAnnotations = (annotations != null) @@ -92,11 +92,11 @@ return boxes; } - public void setTheme(Document theme) { + public void setTheme(ThemeDocument theme) { this.theme = theme; } - public Document getTheme() { + public ThemeDocument getTheme() { return theme; } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/StyledAreaSeriesCollection.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledAreaSeriesCollection.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledAreaSeriesCollection.java Thu Aug 22 23:31:38 2013 +0200 @@ -13,11 +13,8 @@ import java.awt.Stroke; import org.jfree.data.xy.XYSeriesCollection; -import org.w3c.dom.Document; -import org.dive4elements.river.themes.ThemeAccess; -import org.dive4elements.river.utils.ThemeUtil; - +import org.dive4elements.river.themes.ThemeDocument; /** * One or more dataseries to draw a polygon (either "open up/downwards", or @@ -36,13 +33,13 @@ protected FILL_MODE mode; /** The theme-document with attributes about actual visual representation. */ - protected Document theme; + protected ThemeDocument theme; /** * @param theme the theme-document. */ - public StyledAreaSeriesCollection(Document theme) { + public StyledAreaSeriesCollection(ThemeDocument theme) { this.theme = theme; this.mode = FILL_MODE.BETWEEN; } @@ -85,16 +82,16 @@ } // Apply text style. - new ThemeAccess(theme).parseTextStyle().apply(renderer); + theme.parseTextStyle().apply(renderer); return renderer; } protected void applyFillColor(StableXYDifferenceRenderer renderer) { - Color paint = ThemeUtil.parseColor( - ThemeUtil.getAreaBackgroundColorString(theme)); + Color paint = ThemeDocument.parseColor( + theme.getAreaBackgroundColorString()); - int transparency = ThemeUtil.parseAreaTransparency(theme); + int transparency = theme.parseAreaTransparency(); if (transparency > 0 && paint != null) { paint = new Color( paint.getRed(), @@ -121,34 +118,35 @@ protected void applyShowShape(StableXYDifferenceRenderer renderer) { - boolean show = ThemeUtil.parseAreaShowBorder(theme); + boolean show = theme.parseAreaShowBorder(); renderer.setDrawOutline(show); } protected void applyShowLine(StableXYDifferenceRenderer renderer) { - boolean show = ThemeUtil.parseShowLine(theme); + boolean show = theme.parseShowLine(); renderer.setShapesVisible(show); } protected void applyOutlineColor(StableXYDifferenceRenderer renderer) { - Color c = ThemeUtil.parseLineColorField(theme); + Color c = theme.parseLineColorField(); renderer.setOutlinePaint(c); } protected void applyOutlineWidth(StableXYDifferenceRenderer renderer) { - int size = ThemeUtil.parseLineWidth(theme); + // int size = theme.parseLineWidth(); + // XXX: Why is this not set? } /** Inform renderer whether it should draw a label. */ protected void applyShowArea(StableXYDifferenceRenderer renderer) { - renderer.setLabelArea(ThemeUtil.parseShowArea(theme)); + renderer.setLabelArea(theme.parseShowArea()); } protected void applyOutlineStyle(StableXYDifferenceRenderer renderer) { - float[] dashes = ThemeUtil.parseLineStyle(theme); - int size = ThemeUtil.parseLineWidth(theme); + float[] dashes = theme.parseLineStyle(); + int size = theme.parseLineWidth(); Stroke stroke = null; diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/StyledDomainMarker.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledDomainMarker.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledDomainMarker.java Thu Aug 22 23:31:38 2013 +0200 @@ -11,9 +11,8 @@ import java.awt.Color; import org.jfree.chart.plot.IntervalMarker; -import org.w3c.dom.Document; -import org.dive4elements.river.utils.ThemeUtil; +import org.dive4elements.river.themes.ThemeDocument; /** * Marker that represents a highlighted interval. @@ -26,19 +25,19 @@ private final Color backgroundColor, backgroundColor2; - public StyledDomainMarker(double start, double end, Document theme) { + public StyledDomainMarker(double start, double end, ThemeDocument theme) { super(start, end); - backgroundColor = ThemeUtil.parseColor( - ThemeUtil.getAreaBackgroundColorString(theme)); + backgroundColor = ThemeDocument.parseColor( + theme.getAreaBackgroundColorString()); backgroundColor2 = new Color( 255 - backgroundColor.getRed(), 255 - backgroundColor.getGreen(), 255 - backgroundColor.getBlue()); useSecondColor(false); - int alpha = 100 - ThemeUtil.parseInteger( - ThemeUtil.getAreaTransparencyString(theme), 50); + int alpha = 100 - ThemeDocument.parseInteger( + theme.getAreaTransparencyString(), 50); setAlpha(alpha / 100.0f); } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledTimeSeries.java Thu Aug 22 23:31:38 2013 +0200 @@ -9,8 +9,7 @@ package org.dive4elements.river.jfree; import org.apache.log4j.Logger; - -import org.w3c.dom.Document; +import org.dive4elements.river.themes.ThemeDocument; import org.jfree.data.time.TimeSeries; @@ -27,7 +26,7 @@ protected Style style; - public StyledTimeSeries(String key, Document theme) { + public StyledTimeSeries(String key, ThemeDocument theme) { super(key); setStyle(new XYStyle(theme)); } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/StyledValueMarker.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledValueMarker.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledValueMarker.java Thu Aug 22 23:31:38 2013 +0200 @@ -8,13 +8,12 @@ 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; import org.jfree.chart.plot.ValueMarker; -import org.w3c.dom.Document; /** * Marker that represents a single value. @@ -24,16 +23,16 @@ private static final long serialVersionUID = -3607777705307785140L; - public StyledValueMarker(double value, Document theme) { + public StyledValueMarker(double value, ThemeDocument theme) { super(value); - Color color = ThemeUtil.parseAreaBackgroundColor(theme); + Color color = theme.parseAreaBackgroundColor(); if(color == null) { color = Color.BLACK; } this.setPaint(color); - int size = ThemeUtil.parsePointWidth(theme); + int size = theme.parsePointWidth(); setStroke(new BasicStroke(size)); } } diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java --- a/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java Thu Aug 22 15:38:57 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/jfree/StyledXYSeries.java Thu Aug 22 23:31:38 2013 +0200 @@ -11,8 +11,7 @@ import java.util.List; import org.apache.log4j.Logger; - -import org.w3c.dom.Document; +import org.dive4elements.river.themes.ThemeDocument; import org.jfree.data.xy.XYDataItem; import org.jfree.data.xy.XYSeries; @@ -30,13 +29,13 @@ protected String label; - public StyledXYSeries(String key, Document theme) { + public StyledXYSeries(String key, ThemeDocument theme) { this(key, true, theme); this.label = key.toString(); } - public StyledXYSeries(String key, Document theme, XYSeries unstyledSeries) { + public StyledXYSeries(String key, ThemeDocument theme, XYSeries unstyledSeries) { this(key, theme); add(unstyledSeries); } @@ -47,7 +46,7 @@ * to one extrema which can cause problems in certain * algorithms. */ - public StyledXYSeries(String key, boolean sorted, Document theme) { + public StyledXYSeries(String key, boolean sorted, ThemeDocument theme) { super(key, sorted); setStyle(new XYStyle(theme)); this.label = key.toString(); @@ -57,7 +56,7 @@ String key, boolean sorted, boolean allowDuplicateXValues, - Document theme + ThemeDocument theme ) { super(key, sorted, allowDuplicateXValues); setStyle(new XYStyle(theme)); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/jfree/XYStyle.java --- 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); diff -r d710bd3df387 -r 1b35b2ddfc28 artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/artifacts/src/main/java/org/dive4elements/river/themes/ThemeDocument.java Thu Aug 22 23:31:38 2013 +0200 @@ -0,0 +1,181 @@ +/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU AGPL (>=v3) + * and comes with ABSOLUTELY NO WARRANTY! Check out the + * documentation coming with Dive4Elements River for details. + */ + +package org.dive4elements.river.themes; + +import java.awt.Color; +import java.awt.Font; + +import org.dive4elements.artifacts.CallMeta; +import org.w3c.dom.Document; + +public class ThemeDocument +{ + private Document document; + + public ThemeDocument() { + } + + public ThemeDocument(Document document) { + this.document = document; + } + + public Document getDocument() { + return document; + } + + public Color parseLineColorField() { + return null; + } + + public boolean parseShowLineLabel() { + return false; + } + + public boolean parseShowWidth() { + return false; + } + + public boolean parseShowLevel() { + return false; + } + + public boolean parseShowMiddleHeight() { + return false; + } + + public boolean parseLabelShowBackground() { + return false; + } + + public Font parseTextFont() { + return null; + } + + public Color parseTextColor() { + return null; + } + + public Color parseTextBackground() { + return null; + } + + public int parseLineWidth() { + return 0; + } + + public float [] parseLineStyle() { + return null; + } + + public int parsePointWidth() { + return 0; + } + + public Color parsePointColor() { + return null; + } + + public boolean parseShowPoints() { + return false; + } + + public boolean parseShowLine() { + return false; + } + + public boolean parseShowMinimum() { + return false; + } + + public boolean parseShowMaximum() { + return false; + } + + public TextStyle parseTextStyle() { + // from ThemeAccess + return null; + } + + public LineStyle parseComplexLineStyle() { + // from ThemeAccess + return null; + } + + public Color parseComplexLineColorField() { + return null; + } + + public boolean parseShowVerticalLine() { + return false; + } + + public boolean parseShowHorizontalLine() { + return false; + } + + public double parseBandWidth() { + return 0d; + } + + public int parseAreaTransparency() { + return 0; + } + + public static Color parseColor(String s) { + return null; + } + + public String getAreaBackgroundColorString() { + return null; + } + + public boolean parseAreaShowBorder() { + return false; + } + + public boolean parseShowArea() { + return false; + } + + public boolean parseShowPointLabel() { + return false; + } + + public boolean parseShowExtraMark() { + return false; + } + + public String createMapserverStyle() { + return null; + } + + public String createDynamicMapserverStyle( + float from, + float to, + float step, + CallMeta meta + ) { + return null; + } + + public Color parseAreaBackgroundColor() { + return null; + } + + public static int parseInteger(String s, int def) { + return def; + } + + public String getAreaTransparencyString() { + return null; + } + +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : +