Mercurial > dive4elements > river
diff artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java @ 7084:f0731aa7b735 generator-refactoring
Implement Label handling
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 20 Sep 2013 19:18:04 +0200 |
parents | 48e30e2c5db9 |
children | 41567bf1e131 |
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Fri Sep 20 19:17:49 2013 +0200 +++ b/artifacts/src/main/java/org/dive4elements/river/exports/ChartGenerator2.java Fri Sep 20 19:18:04 2013 +0200 @@ -204,12 +204,7 @@ */ protected abstract String getDefaultChartTitle(); - /** - * Returns the default Y-Axis label of a chart. - * - * @return the default Y-Axis label of a chart. - */ - protected abstract String getDefaultYAxisLabel(int index); + protected abstract String getDefaultYAxisLabel(String axisName); /** @@ -345,7 +340,7 @@ } - InfoGeneratorHelper helper = new InfoGeneratorHelper(this); + InfoGeneratorHelper2 helper = new InfoGeneratorHelper2(this); Document doc = helper.createInfoDocument(chart, info); XMLUtils.toStream(doc, out); @@ -903,33 +898,7 @@ return new int[] { 600, 400 }; } - - /** - * Returns the Y-Axis label of a chart at position <i>pos</i>. - * - * @return the Y-Axis label of a chart at position <i>0</i>. - */ - protected String getYAxisLabel(int pos) { - return "TODO lalal"; - /* - ChartSettings chartSettings = getChartSettings(); - if (chartSettings == null) { - return getDefaultYAxisLabel(pos); - } - - YAxisWalker walker = getYAxisWalker(); - AxisSection as = chartSettings.getAxisSection(walker.getId(pos)); - if (as != null) { - String label = as.getLabel(); - - if (label != null) { - return label; - } - } - - return getDefaultYAxisLabel(pos);*/ - } - + protected abstract String getYAxisLabel(String axisName); /** * This method searches for a specific axis in the <i>settings</i> if @@ -1086,7 +1055,7 @@ * @param def default, returned if lookup failed. * @return value found in i18n dictionary, \param def if no value found. */ - protected String msg(String key, String def) { + public String msg(String key, String def) { return Resources.getMsg(context.getMeta(), key, def); } @@ -1095,11 +1064,11 @@ * @param key key for which to find i18nd version. * @return value found in i18n dictionary, key itself if failed. */ - protected String msg(String key) { + public String msg(String key) { return Resources.getMsg(context.getMeta(), key, key); } - protected String msg(String key, String def, Object[] args) { + public String msg(String key, String def, Object[] args) { return Resources.getMsg(context.getMeta(), key, def, args); } @@ -1484,9 +1453,10 @@ Font.BOLD, getYAxisFontSize(index)); + String axisName = axisIndexToName(index); + IdentifiableNumberAxis axis = new IdentifiableNumberAxis( - axisIndexToName(index), - getYAxisLabel(index)); + axisName, getYAxisLabel(axisName)); axis.setAutoRangeIncludesZero(false); axis.setLabelFont(labelFont);