Mercurial > dive4elements > river
changeset 3173:0cf647fe2a96
FixA: Finished I18N for km chart service.
flys-artifacts/trunk@4786 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Mon, 25 Jun 2012 16:28:26 +0000 |
parents | 36806f6e23fb |
children | 6bde7c90dc93 |
files | flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java flys-artifacts/src/main/java/de/intevation/flys/jfree/ShapeRenderer.java flys-artifacts/src/main/resources/messages.properties flys-artifacts/src/main/resources/messages_de.properties flys-artifacts/src/main/resources/messages_de_DE.properties flys-artifacts/src/main/resources/messages_en.properties |
diffstat | 8 files changed, 59 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Jun 25 16:28:26 2012 +0000 @@ -1,3 +1,20 @@ +2012-06-25 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java: + Finished I18N. + + * src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java: + Accept callback to label legend items. + + * src/main/java/de/intevation/flys/jfree/ShapeRenderer.java: Added interface + LabelGenerator to create labels for entries. + + * src/main/resources/messages.properties, + src/main/resources/messages_de_DE.properties, + src/main/resources/messages_en.properties, + src/main/resources/messages_de.properties: + Added strings. + 2012-06-25 Sascha L. Teichmann <sascha.teichmann@intevation.de> * src/main/java/de/intevation/flys/artifacts/model/fixings/FixLongitudinalReferenceFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/FixingsKMChartService.java Mon Jun 25 16:28:26 2012 +0000 @@ -24,6 +24,8 @@ import de.intevation.flys.backend.SessionHolder; +import de.intevation.flys.jfree.ShapeRenderer; + import de.intevation.flys.utils.Formatter; import de.intevation.flys.utils.Pair; @@ -111,6 +113,17 @@ public static final String DEFAULT_W_AXIS = "W [NN + m]"; + public static final String I18N_MEASURED = + "fix.km.chart.meassured"; + + public static final String DEFAULT_MEASURED = + "measured"; + + public static final String I18N_INTERPOLATED = + "fix.km.chart.interpolated"; + + public static final String DEFAULT_INTERPOLATED = + "interpolated"; public static final String DEFAULT_FORMAT = "png"; @@ -312,8 +325,19 @@ area.getMaxY() + wInset)); } + final String measuredS = Resources.getMsg( + callMeta, I18N_MEASURED, DEFAULT_MEASURED); + + final String interpolatedS = Resources.getMsg( + callMeta, I18N_INTERPOLATED, DEFAULT_INTERPOLATED); + LegendItemCollection lic = plot.getLegendItems(); - dataset.addLegendItems(lic); + dataset.addLegendItems(lic, new ShapeRenderer.LabelGenerator() { + @Override + public String createLabel(ShapeRenderer.Entry entry) { + return entry.getFilled() ? measuredS : interpolatedS; + } + }); plot.setFixedLegendItems(lic); applyQSectorMarkers(plot, river, km, callMeta);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/QWSeriesCollection.java Mon Jun 25 16:28:26 2012 +0000 @@ -213,14 +213,13 @@ Color.white); } - public void addLegendItems(LegendItemCollection lic) { + public void addLegendItems( + LegendItemCollection lic, + ShapeRenderer.LabelGenerator lg + ) { for (ShapeRenderer.Entry entry: knownShapes.keySet()) { - // TODO: i18n - String label = entry.getFilled() - ? "gemessene Werte" - : "interpolierte Werte"; lic.add(legendItem( - label, + lg.createLabel(entry), entry.getPaint(), entry.getShape(), entry.getFilled()));
--- a/flys-artifacts/src/main/java/de/intevation/flys/jfree/ShapeRenderer.java Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/jfree/ShapeRenderer.java Mon Jun 25 16:28:26 2012 +0000 @@ -111,6 +111,10 @@ } } // class Entry + public interface LabelGenerator { + String createLabel(Entry entry); + } // interface EntryLabelGenerator + protected Entry [] entries; protected List<Rectangle2D> labelBoundingBoxes;
--- a/flys-artifacts/src/main/resources/messages.properties Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages.properties Mon Jun 25 16:28:26 2012 +0000 @@ -367,3 +367,5 @@ fix.km.chart.title=Fixings {0} km {1,number,#.###} fix.km.chart.q.axis=Q [m\u00b3/s] fix.km.chart.w.axis=W [NN + m] +fix.km.chart.measured=measured +fix.km.chart.interpolated=interpolated
--- a/flys-artifacts/src/main/resources/messages_de.properties Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de.properties Mon Jun 25 16:28:26 2012 +0000 @@ -368,3 +368,5 @@ fix.km.chart.title=Fixierungen {0} km {1,number,#.###} fix.km.chart.q.axis=Q [m\u00b3/s] fix.km.chart.w.axis=W [NN + m] +fix.km.chart.measured=gemessen +fix.km.chart.interpolated=interpoliert
--- a/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_de_DE.properties Mon Jun 25 16:28:26 2012 +0000 @@ -367,3 +367,5 @@ fix.km.chart.title=Fixierungen {0} km {1,number,#.###} fix.km.chart.q.axis=Q [m\u00b3/s] fix.km.chart.w.axis=W [NN + m] +fix.km.chart.measured=gemessen +fix.km.chart.interpolated=interpoliert
--- a/flys-artifacts/src/main/resources/messages_en.properties Mon Jun 25 16:04:08 2012 +0000 +++ b/flys-artifacts/src/main/resources/messages_en.properties Mon Jun 25 16:28:26 2012 +0000 @@ -367,3 +367,5 @@ fix.km.chart.title=Fixings {0} km {1,number,#.###} fix.km.chart.q.axis=Q [m\u00b3/s] fix.km.chart.w.axis=W [NN + m] +fix.km.chart.measured=measured +fix.km.chart.interpolated=interpolated