changeset 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 bc5f7d8084e2
children 27f5afc4dbde
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java
diffstat 6 files changed, 89 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/ChangeLog	Fri Apr 29 10:12:02 2011 +0000
@@ -1,3 +1,17 @@
+2011-04-29  Raimund Renkert <rrenkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java:
+	  Added setter for the location and distance values.
+
+	* src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java,
+	  src/main/java/de/intevation/flys/client/client/ui/UIProvider.java:
+	  Added setter for an artifact.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Set the current artifact to the provider to make the old data available
+	  for the other widgets.
+
 2011-04-28  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/FLYSConstants.properties,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Fri Apr 29 10:12:02 2011 +0000
@@ -20,7 +20,7 @@
 import de.intevation.flys.client.client.event.StepForwardHandler;
 import de.intevation.flys.client.shared.model.Data;
 import de.intevation.flys.client.shared.model.DataList;
-
+import de.intevation.flys.client.shared.model.Artifact;
 
 /**
  * An abstract UIProvider that provides some basic methods.
@@ -44,6 +44,8 @@
     /** The container that is used to position helper widgets.*/
     protected Canvas helperContainer;
 
+    /** The artifact that contains status information.*/
+    protected Artifact artifact;
 
     /**
      * Creates a new UIProvider instance of this class.
@@ -165,6 +167,16 @@
 
 
     /**
+     * This method injects an artifact that contains the status information.
+     *
+     * @param art An artifact containing status information.
+     */
+    public void setArtifact(Artifact art) {
+        this.artifact = art;
+    }
+
+
+    /**
      * This method needs to be implemented by concrete subclasses. It should
      * create a new Canvas object with a representation of <i>data</i>.
      *
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java	Fri Apr 29 10:12:02 2011 +0000
@@ -20,6 +20,7 @@
     /** The message class that provides i18n strings.*/
     protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
 
+    protected TextItem ti;
 
     /** The constant input field name.*/
     public static final String FIELD_NAME = "doublearray";
@@ -39,7 +40,7 @@
         double[] values,
         BlurHandler handler)
     {
-        TextItem ti        = new TextItem(FIELD_NAME);
+        ti                 = new TextItem(FIELD_NAME);
         StaticTextItem sti = new StaticTextItem("staticarray");
 
         ti.setShowTitle(false);
@@ -76,6 +77,32 @@
 
 
     /**
+     * This method takes the double array to set the values to the textbox.
+     *
+     * @param values The double values.
+     */
+    public void setValues(double[] values) {
+        NumberFormat f = NumberFormat.getDecimalFormat();
+
+        StringBuilder text = new StringBuilder();
+        boolean firstItem  = true;
+
+        for (double val: values) {
+            if (!firstItem) {
+                text.append(" ");
+            }
+
+            text.append(f.format(val));
+
+            firstItem = false;
+        }
+
+        ti.clearValue();
+        ti.setValue(text.toString());
+    }
+
+
+    /**
      * This method validates the entered text in the location input field. If
      * there are values that doesn't represent a valid location, an error is
      * displayed.
--- 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.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Apr 29 10:12:02 2011 +0000
@@ -452,6 +452,7 @@
             UIProvider provider = UIProviderFactory.getProvider(uiProvider);
 
             provider.setContainer(helperPanel);
+            provider.setArtifact(art);
 
             ((HasStepForwardHandlers) provider).addStepForwardHandler(this);
             ((HasStepBackHandlers) provider).addStepBackHandler(this);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Thu Apr 28 12:50:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Fri Apr 29 10:12:02 2011 +0000
@@ -5,7 +5,7 @@
 import com.smartgwt.client.widgets.Canvas;
 
 import de.intevation.flys.client.shared.model.DataList;
-
+import de.intevation.flys.client.shared.model.Artifact;
 
 /**
  * This interface describes a method that creates a Canvas element displaying
@@ -43,5 +43,13 @@
      * @param container A container that is used to position helper widgets.
      */
     public void setContainer(Canvas container);
+
+
+    /**
+     * Sets an artifact that contains the status data information for a project.
+     *
+     * @param artifact The artifact containing status information.
+     */
+    public void setArtifact(Artifact artifact);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org