Mercurial > dive4elements > river
comparison 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 |
comparison
equal
deleted
inserted
replaced
7083:74ebe5e7fa69 | 7084:f0731aa7b735 |
---|---|
202 * | 202 * |
203 * @return the default title of a chart. | 203 * @return the default title of a chart. |
204 */ | 204 */ |
205 protected abstract String getDefaultChartTitle(); | 205 protected abstract String getDefaultChartTitle(); |
206 | 206 |
207 /** | 207 protected abstract String getDefaultYAxisLabel(String axisName); |
208 * Returns the default Y-Axis label of a chart. | |
209 * | |
210 * @return the default Y-Axis label of a chart. | |
211 */ | |
212 protected abstract String getDefaultYAxisLabel(int index); | |
213 | 208 |
214 | 209 |
215 /** | 210 /** |
216 * Returns the default X-Axis label of a chart. | 211 * Returns the default X-Axis label of a chart. |
217 * | 212 * |
343 logger.debug("Rendering info took: " + | 338 logger.debug("Rendering info took: " + |
344 (stopTime-startTime) + "ms"); | 339 (stopTime-startTime) + "ms"); |
345 } | 340 } |
346 | 341 |
347 | 342 |
348 InfoGeneratorHelper helper = new InfoGeneratorHelper(this); | 343 InfoGeneratorHelper2 helper = new InfoGeneratorHelper2(this); |
349 Document doc = helper.createInfoDocument(chart, info); | 344 Document doc = helper.createInfoDocument(chart, info); |
350 | 345 |
351 XMLUtils.toStream(doc, out); | 346 XMLUtils.toStream(doc, out); |
352 } | 347 } |
353 | 348 |
901 } | 896 } |
902 | 897 |
903 return new int[] { 600, 400 }; | 898 return new int[] { 600, 400 }; |
904 } | 899 } |
905 | 900 |
906 | 901 protected abstract String getYAxisLabel(String axisName); |
907 /** | |
908 * Returns the Y-Axis label of a chart at position <i>pos</i>. | |
909 * | |
910 * @return the Y-Axis label of a chart at position <i>0</i>. | |
911 */ | |
912 protected String getYAxisLabel(int pos) { | |
913 return "TODO lalal"; | |
914 /* | |
915 ChartSettings chartSettings = getChartSettings(); | |
916 if (chartSettings == null) { | |
917 return getDefaultYAxisLabel(pos); | |
918 } | |
919 | |
920 YAxisWalker walker = getYAxisWalker(); | |
921 AxisSection as = chartSettings.getAxisSection(walker.getId(pos)); | |
922 if (as != null) { | |
923 String label = as.getLabel(); | |
924 | |
925 if (label != null) { | |
926 return label; | |
927 } | |
928 } | |
929 | |
930 return getDefaultYAxisLabel(pos);*/ | |
931 } | |
932 | |
933 | 902 |
934 /** | 903 /** |
935 * This method searches for a specific axis in the <i>settings</i> if | 904 * This method searches for a specific axis in the <i>settings</i> if |
936 * <i>settings</i> is set. If the axis was found, this method returns the | 905 * <i>settings</i> is set. If the axis was found, this method returns the |
937 * specified axis range if the axis range is fixed. Otherwise, this method | 906 * specified axis range if the axis range is fixed. Otherwise, this method |
1084 * Look up \param key in i18n dictionary. | 1053 * Look up \param key in i18n dictionary. |
1085 * @param key key for which to find i18nd version. | 1054 * @param key key for which to find i18nd version. |
1086 * @param def default, returned if lookup failed. | 1055 * @param def default, returned if lookup failed. |
1087 * @return value found in i18n dictionary, \param def if no value found. | 1056 * @return value found in i18n dictionary, \param def if no value found. |
1088 */ | 1057 */ |
1089 protected String msg(String key, String def) { | 1058 public String msg(String key, String def) { |
1090 return Resources.getMsg(context.getMeta(), key, def); | 1059 return Resources.getMsg(context.getMeta(), key, def); |
1091 } | 1060 } |
1092 | 1061 |
1093 /** | 1062 /** |
1094 * Look up \param key in i18n dictionary. | 1063 * Look up \param key in i18n dictionary. |
1095 * @param key key for which to find i18nd version. | 1064 * @param key key for which to find i18nd version. |
1096 * @return value found in i18n dictionary, key itself if failed. | 1065 * @return value found in i18n dictionary, key itself if failed. |
1097 */ | 1066 */ |
1098 protected String msg(String key) { | 1067 public String msg(String key) { |
1099 return Resources.getMsg(context.getMeta(), key, key); | 1068 return Resources.getMsg(context.getMeta(), key, key); |
1100 } | 1069 } |
1101 | 1070 |
1102 protected String msg(String key, String def, Object[] args) { | 1071 public String msg(String key, String def, Object[] args) { |
1103 return Resources.getMsg(context.getMeta(), key, def, args); | 1072 return Resources.getMsg(context.getMeta(), key, def, args); |
1104 } | 1073 } |
1105 | 1074 |
1106 | 1075 |
1107 protected String getRiverName() { | 1076 protected String getRiverName() { |
1482 Font labelFont = new Font( | 1451 Font labelFont = new Font( |
1483 DEFAULT_FONT_NAME, | 1452 DEFAULT_FONT_NAME, |
1484 Font.BOLD, | 1453 Font.BOLD, |
1485 getYAxisFontSize(index)); | 1454 getYAxisFontSize(index)); |
1486 | 1455 |
1456 String axisName = axisIndexToName(index); | |
1457 | |
1487 IdentifiableNumberAxis axis = new IdentifiableNumberAxis( | 1458 IdentifiableNumberAxis axis = new IdentifiableNumberAxis( |
1488 axisIndexToName(index), | 1459 axisName, getYAxisLabel(axisName)); |
1489 getYAxisLabel(index)); | |
1490 | 1460 |
1491 axis.setAutoRangeIncludesZero(false); | 1461 axis.setAutoRangeIncludesZero(false); |
1492 axis.setLabelFont(labelFont); | 1462 axis.setLabelFont(labelFont); |
1493 axis.setTickLabelFont(labelFont); | 1463 axis.setTickLabelFont(labelFont); |
1494 | 1464 |