diff flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java @ 233:137daff2c732

Prepared UI elements for the location and distance input tables. flys-client/trunk@1777 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 29 Apr 2011 10:12:02 +0000
parents b92281182c6b
children 9f16ac843dda
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Fri Apr 29 10:12:02 2011 +0000
@@ -38,6 +38,11 @@
      * distance.*/
     public static final String FIELD_WIDTH = "step";
 
+    /** The textboxes */
+    protected FloatItem fromItem;
+    protected FloatItem toItem;
+    protected FloatItem stepItem;
+
 
     /**
      * Creates a new form with a single input field that displays an array of
@@ -54,9 +59,9 @@
         int width,
         BlurHandler handler)
     {
-        FloatItem fromItem = new FloatItem(FIELD_FROM);
-        FloatItem toItem   = new FloatItem(FIELD_TO);
-        FloatItem stepItem = new FloatItem(FIELD_WIDTH);
+        fromItem = new FloatItem(FIELD_FROM);
+        toItem   = new FloatItem(FIELD_TO);
+        stepItem = new FloatItem(FIELD_WIDTH);
 
         fromItem.addBlurHandler(handler);
         toItem.addBlurHandler(handler);
@@ -100,6 +105,22 @@
 
 
     /**
+     * This method takes distances values and sets them to the textboxes
+     * visualizied by this widget.
+     *
+     * @param from  The from value.
+     * @param to    The to value.
+     * @param steps The max steps.
+     */
+    public void setValues(double from, double to, double steps) {
+        NumberFormat f = NumberFormat.getDecimalFormat();
+
+        fromItem.setValue(f.format(from));
+        toItem.setValue(f.format(to));
+        stepItem.setValue(f.format(steps));
+    }
+
+    /**
      * This method validates the entered text in the input fields. If
      * there are values that doesn't represent a valid float, an error is
      * displayed.

http://dive4elements.wald.intevation.org