Mercurial > dive4elements > river
diff flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java @ 1991:0bd7c3cf0af1
Added axis sections into charts Settings.
flys-artifacts/trunk@3427 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 15 Dec 2011 17:10:42 +0000 |
parents | 156304542edf |
children | e1c9f28e2675 |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Dec 15 15:58:56 2011 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/LongitudinalSectionGenerator.java Thu Dec 15 17:10:42 2011 +0000 @@ -1,6 +1,8 @@ package de.intevation.flys.exports; import java.awt.Font; +import java.util.ArrayList; +import java.util.List; import org.apache.log4j.Logger; @@ -14,6 +16,7 @@ import org.w3c.dom.Document; import de.intevation.artifactdatabase.state.ArtifactAndFacet; +import de.intevation.artifactdatabase.state.Section; import de.intevation.artifactdatabase.state.Facet; import de.intevation.flys.artifacts.FLYSArtifact; @@ -191,16 +194,8 @@ @Override protected NumberAxis createYAxis(int index) { Font labelFont = new Font("Tahoma", Font.BOLD, 14); - String label = "default"; - if (index == YAXIS.W.idx) { - label = getWAxisLabel(); - } - else if (index == YAXIS.Q.idx) { - label = msg(getQAxisLabelKey(), getQAxisDefaultLabel()); - } - else if (index == YAXIS.D.idx) { - label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT); - } + String label = getYAxisLabel(index); + NumberAxis axis = new NumberAxis(label); // "Q" Axis shall include 0. if (index == YAXIS.Q.idx) { @@ -213,6 +208,24 @@ return axis; } + + protected String getYAxisLabel(int index) { + String label = "default"; + + if (index == YAXIS.W.idx) { + label = getWAxisLabel(); + } + else if (index == YAXIS.Q.idx) { + label = msg(getQAxisLabelKey(), getQAxisDefaultLabel()); + } + else if (index == YAXIS.D.idx) { + label = msg(I18N_WDIFF_YAXIS_LABEL, I18N_WDIFF_YAXIS_LABEL_DEFAULT); + } + + return label; + } + + /** * Get default value for the second Y-Axis' label (if no translation was * found). @@ -450,5 +463,28 @@ ? prefix + "(" + name +")" : name; } + + + @Override + protected List<Section> buildAxisSections() { + List<Section> axisSections = new ArrayList<Section>(); + + for (YAXIS axis: YAXIS.values()) { + String identifier = axis.toString(); + + AxisSection axisSection = new AxisSection(); + axisSection.setIdentifier(identifier); + axisSection.setLabel(getYAxisLabel(axis.idx)); + + // TODO font-size + // TODO fixation + // TODO lower + // TODO upper + + axisSections.add(axisSection); + } + + return axisSections; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :