changeset 2485:26fc6163643d

Replace spinnerItem by custom implementation to switch km in cross sections, but regress. flys-client/trunk@4261 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Wed, 18 Apr 2012 09:17:42 +0000
parents 6f30bbd98618
children 8d27d2d33d70
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
diffstat 2 files changed, 66 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Apr 18 09:03:08 2012 +0000
+++ b/flys-client/ChangeLog	Wed Apr 18 09:17:42 2012 +0000
@@ -1,12 +1,22 @@
 2012-04-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
-	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java:
+	Improve km-Spinner behaviour but regressing on input-possibility (no
+    direct text input possible).
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
+	  (KmSpinner): New inner class.
+	  (createGrid): Use new inner class as experiment (old code commented).
+
+2012-04-18	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
 	  (closest): Fix bug that prevented that always the closest km was fetched.
 
 2012-04-18  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java:
 	  Open the ManualDatePointsEditor from context menu.
+
 2012-04-18  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Wed Apr 18 09:03:08 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Wed Apr 18 09:17:42 2012 +0000
@@ -520,6 +520,56 @@
 
 
     /**
+     * SpinnerItem-like element with text label and up/down buttons.
+     */
+    public class KmSpinner extends HLayout {
+        protected Label label;
+
+        protected FacetRecord facetRecord;
+
+        protected double currentValue;
+
+        public KmSpinner(FacetRecord facetRecord) {
+            super(2);
+            this.facetRecord = facetRecord;
+            final FacetRecord _facetRecord = facetRecord;
+            currentValue = Double.valueOf(facetRecord.getTheme()
+                .getCollectionItem().getData().get(CS_KM));
+            // Buttons and labels.
+            int height = 10;
+            // MinusButton shall ask service for previous available cs.
+            Button minusButton = new Button("-");
+            minusButton.setWidth(10);
+            minusButton.setHeight(height);
+            minusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+                public void onClick(ClickEvent evt) {
+                    spinnerValueEntered(null, currentValue - 0.1d, _facetRecord);
+                }
+            });
+            // TODO i18n
+            label = new Label(Double.toString(currentValue));
+            label.setWidth(10);
+            label.setHeight(height);
+            // PlusButton shall ask service for next available cs.
+            Button plusButton = new Button("+");
+            plusButton.setWidth(10);
+            plusButton.setHeight(height);
+            plusButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
+                public void onClick(ClickEvent evt) {
+                    spinnerValueEntered(null, currentValue + 0.1d, _facetRecord);
+                }
+            });
+            this.addMember(minusButton);
+            this.addMember(label);
+            this.addMember(plusButton);
+
+            this.setHeight(height*2);
+        }
+
+    }
+
+
+    /**
      * Create and configure the Grid to display.
      * @return ListGrid with Themes and related controls inside.
      */
@@ -542,6 +592,7 @@
                     String fieldName = this.getFieldName(colNum);
 
                     if (fieldName.equals(GRID_FIELD_ACTIONS)) {
+                        /*
                         HLayout recordCanvas = new HLayout(3);
                         recordCanvas.setHeight(22);
                         recordCanvas.setAlign(Alignment.CENTER);
@@ -570,6 +621,7 @@
                         if (facetRecord.getTheme().getActive() != 1) {
                             spinnerItem.disable();
                         }
+                        */
                         
                         /*
                         // To have visual representation of synchronous
@@ -580,12 +632,13 @@
                         }
                         */
 
+                        /*
                         DynamicForm formWrap = new DynamicForm();
                         formWrap.setFields(spinnerItem);
                         formWrap.setTitlePrefix("");
                         formWrap.setTitleSuffix("");
-                        recordCanvas.addMember(formWrap);
-                        return recordCanvas;
+                        */
+                        return new KmSpinner(facetRecord);
                     }
                     else {
                         return null;

http://dive4elements.wald.intevation.org