changeset 83:4784ca718476

Improved the positioning of helper widgets and some layout specific stuff. flys-client/trunk@1593 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 28 Mar 2011 16:00:23 +0000
parents 4c5fa2b0086a
children b8acb6a615f2
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/LocationDistancePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.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/SelectProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java
diffstat 9 files changed, 70 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/ChangeLog	Mon Mar 28 16:00:23 2011 +0000
@@ -1,3 +1,23 @@
+2011-03-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProvider.java,
+	  src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java:
+	  A UIProvider might now have a panel that can be used to render helper
+	  widgets. E.g. the river selection will render its river map into this
+	  panel. It is injected and can be placed somewhere around the
+	  application.
+
+	* src/main/java/de/intevation/flys/client/client/ui/ParameterList.java:
+	  Injected the right panel of the parameter panel into the UIProvider.
+	  Helper widgets are rendered into this panel now!
+
+	* src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/MapSelection.java,
+	  src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java:
+	  Some layout improvements (heights, position of elements and so far).
+
 2011-03-28  Raimund Renkert <rrenkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/MainMenu.java: The project
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java	Mon Mar 28 16:00:23 2011 +0000
@@ -41,6 +41,9 @@
     /** The StepForwardHandlers.*/
     protected List<StepBackHandler> backHandlers;
 
+    /** The container that is used to position helper widgets.*/
+    protected Canvas helperContainer;
+
 
     /**
      * Creates a new UIProvider instance of this class.
@@ -150,6 +153,17 @@
 
 
     /**
+     * This method injects a container that is used to position helper widgets.
+     *
+     * @param helperContainer A container that is used to position helper
+     * widgets.
+     */
+    public void setContainer(Canvas helperContainer) {
+        this.helperContainer = helperContainer;
+    }
+
+
+    /**
      * 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/LocationDistancePanel.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java	Mon Mar 28 16:00:23 2011 +0000
@@ -100,6 +100,7 @@
      */
     public Canvas create(DataList data) {
         VLayout layout = new VLayout();
+        layout.setMembersMargin(10);
 
         initDefaults(data);
 
@@ -107,6 +108,7 @@
         Canvas widget = createWidget(data);
         Canvas submit = getNextButton();
 
+        widget.setHeight(50);
         label.setHeight(25);
 
         layout.addMember(label);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java	Mon Mar 28 16:00:23 2011 +0000
@@ -57,7 +57,7 @@
         // TODO implement event handling in the river map
 
         h.addMember(form);
-        h.addMember(map);
+        helperContainer.addChild(map);
 
         return h;
     }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java	Mon Mar 28 16:00:23 2011 +0000
@@ -4,6 +4,7 @@
 
 import com.google.gwt.core.client.GWT;
 
+import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
 import com.smartgwt.client.widgets.form.DynamicForm;
@@ -71,11 +72,14 @@
     public Canvas create(DataList data) {
         VLayout newLayout = new VLayout();
         newLayout.setMembersMargin(10);
+        //newLayout.setAlign(VerticalAlignment.TOP);
 
         Canvas moduleSelection = createWidget();
         Canvas riverSelection  = super.createWidget(data);
         Canvas go              = getNextButton();
+        //go.setLayoutAlign(VerticalAlignment.TOP);
 
+        riverSelection.setHeight(25);
         moduleSelection.setHeight(25);
 
         newLayout.addMember(moduleSelection);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Mon Mar 28 16:00:23 2011 +0000
@@ -76,6 +76,7 @@
 
     protected VLayout oldItems;
     protected VLayout currentItems;
+    protected Canvas  helperPanel;
 
     public ParameterList(FLYS flys, CollectionView cView) {
         this.cView = cView;
@@ -95,9 +96,11 @@
 
         VLayout left = new VLayout();
 
-        oldItems.setHeight(20);
+        if (old == null || old.size() == 0) {
+            oldItems.setHeight(0);
+        }
+
         oldItems.setMembersMargin(10);
-        currentItems.setHeight("*");
         currentItems.setAlign(VerticalAlignment.TOP);
 
         left.setMembersMargin(20);
@@ -107,10 +110,10 @@
         left.addMember(currentItems);
 
         // This canvas is used to render helper widgets
-        Canvas right = new Canvas();
+        helperPanel = new Canvas();
 
         addMember(left);
-        addMember(right);
+        addMember(helperPanel);
 
         Canvas moduleSelection = renderNew();
         moduleSelection.setLayoutAlign(VerticalAlignment.TOP);
@@ -174,6 +177,8 @@
         ModuleSelection widget         = new ModuleSelection();
         HasStepForwardHandlers handler = (HasStepForwardHandlers) widget;
 
+        widget.setContainer(helperPanel);
+
         handler.addStepForwardHandler(new StepForwardHandler() {
             public void onStepForward(StepForwardEvent event) {
                 Data[] data = event.getData();
@@ -379,6 +384,10 @@
     public void onParameterChange(ParameterChangeEvent event) {
         GWT.log("ParameterList.onParameterChange");
 
+        for (Canvas c: helperPanel.getChildren()) {
+            helperPanel.removeChild(c);
+        }
+
         Artifact art             = event.getNewValue();
         ArtifactDescription desc = art.getArtifactDescription();
 
@@ -388,6 +397,8 @@
             String uiProvider   = currentData.getUIProvider();
             UIProvider provider = UIProviderFactory.getProvider(uiProvider);
 
+            provider.setContainer(helperPanel);
+
             ((HasStepForwardHandlers) provider).addStepForwardHandler(this);
             ((HasStepBackHandlers) provider).addStepBackHandler(this);
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/SelectProvider.java	Mon Mar 28 16:00:23 2011 +0000
@@ -49,6 +49,7 @@
      */
     public Canvas create(DataList data) {
         VLayout v = new VLayout();
+        v.setMembersMargin(10);
 
         Canvas content = createWidget(data);
         Canvas button  = getNextButton();
@@ -103,6 +104,8 @@
         GWT.log("SelectProvider - create()");
 
         VLayout layout   = new VLayout();
+        layout.setAlign(VerticalAlignment.TOP);
+        layout.setHeight(25);
 
         form = new DynamicForm();
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProvider.java	Mon Mar 28 16:00:23 2011 +0000
@@ -35,5 +35,13 @@
      * @return a Canvas displaying the Data.
      */
     public Canvas createOld(DataList dataList);
+
+
+    /**
+     * This method injects a container that is used to position helper widgets.
+     *
+     * @param container A container that is used to position helper widgets.
+     */
+    public void setContainer(Canvas container);
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Mon Mar 28 15:23:51 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java	Mon Mar 28 16:00:23 2011 +0000
@@ -125,8 +125,11 @@
         Label   label  = new Label(MSG.wqTitle());
 
         label.setHeight(25);
+        widget.setHeight(65);
 
         VLayout layout = new VLayout();
+        layout.setMembersMargin(10);
+
         layout.addMember(label);
         layout.addMember(widget);
         layout.addMember(submit);

http://dive4elements.wald.intevation.org