diff artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java @ 9175:34dc0163ad2d

DistancePanel Berechnungsstrecke->Darstellungsbereich Refactoring
author gernotbelger
date Mon, 25 Jun 2018 17:58:11 +0200
parents 8c0d1542c1d8
children baef46792354
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java	Mon Jun 25 16:07:41 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/ComputationRangeState.java	Mon Jun 25 17:58:11 2018 +0200
@@ -40,7 +40,9 @@
 
         final Element label = ProtocolUtils.createArtNode(cr, "label", null, null);
 
-        label.setTextContent(Resources.getMsg(context.getMeta(), getID(), getID()));
+        final String msg = getTitle(context);
+
+        label.setTextContent(msg);
         // VORHER: data.getName(), data.getName())) (entsprach "ld_from", "ld_to" - unterschied zu jetzt: description wird
         // anders gesetzt ("Wahl der Berechnungsstrecke")
         // label bleibt "ld_from", "ld_to"; unklar, wo das gesetzt wird. unklar, warum das Element "label" die Description
@@ -54,6 +56,16 @@
         return select;
     }
 
+    // REMARK: allows to overwrite the titel which is shown on the client side.
+    // TODO: instead of a fixed string, we should translate the 'id', but in that case we need to change all old workflows
+    // (reason is, that we have different texts for the title and the 'old' title, which in turn is the translation of
+    // 'description').
+
+    protected String getTitle(final CallContext context) {
+        // REMARK: that is how it should be: return Resources.getMsg(context.getMeta(), getID());
+        return Resources.getMsg(context.getMeta(), "state.title.distance_state");
+    }
+
     @Override
     protected Element[] createItems(final XMLUtils.ElementCreator cr, final Artifact artifact, final String name, final CallContext context) {
         final double[] minmax = getMinMax(artifact);

http://dive4elements.wald.intevation.org