# HG changeset patch # User Ingo Weinzierl # Date 1327930596 0 # Node ID a38f43f626f5df10c0171cb5afc34b38fc0e64c9 # Parent e2124ca11adb8baa49267458fa32a30826a7ff00 Display the name of the reference gauge in the static ui of 'historical discharge curves' calculation. flys-artifacts/trunk@3832 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e2124ca11adb -r a38f43f626f5 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Mon Jan 30 13:33:18 2012 +0000 +++ b/flys-artifacts/ChangeLog Mon Jan 30 13:36:36 2012 +0000 @@ -1,3 +1,10 @@ +2012-01-30 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java: + Override getLabelFor() method defined in DefaultState to return the name + of a Gauge based on the official number which is stored in the + parameterization. + 2012-01-30 Felix Wolfsteller Allow manual points in more diagram types. diff -r e2124ca11adb -r a38f43f626f5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Mon Jan 30 13:33:18 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ReferenceGaugeState.java Mon Jan 30 13:36:36 2012 +0000 @@ -28,6 +28,9 @@ Logger.getLogger(ReferenceGaugeState.class); + public static final String DATA_NAME = "reference_gauge"; + + @Override protected Element[] createItems( XMLUtils.ElementCreator cr, @@ -56,5 +59,30 @@ return opts; } + + + @Override + protected String getLabelFor( + CallContext cc, + String name, + String value, + String type + ) { + if (name.equals(DATA_NAME)) { + try { + long number = Long.valueOf(value); + Gauge gauge = Gauge.getGaugeByOfficialNumber(number); + + if (gauge != null) { + return gauge.getName(); + } + } + catch (NumberFormatException nfe) { + // do nothing + } + } + + return super.getLabelFor(cc, name, value, type); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :