changeset 901:3ef7205b814e

Added stubs for two datacage panels - one for choosing waterlevels, one for choosing DEMs. flys-client/trunk@2749 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 14 Sep 2011 14:53:04 +0000
parents c580a336438c
children 470912f16876
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java
diffstat 5 files changed, 133 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Wed Sep 14 14:43:46 2011 +0000
+++ b/flys-client/ChangeLog	Wed Sep 14 14:53:04 2011 +0000
@@ -1,3 +1,17 @@
+2011-09-14  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java:
+	  New. Two concrete subclasses of DatacagePanel - one for choosing a dem
+	  and one for choosing a waterlevel.
+
+	* src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java:
+	  Some refactoring that makes it able to subclass the DatacagePanel. Now,
+	  this class is abstract and needs to be subclassed.
+
+	* src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java:
+	  Registered the DemDatacagePanel and WspDatacagePanel as new UIProviders.
+
 2011-09-14  Raimund Renkert <raimund.renkert@intevation.de>
 
 	Issue313
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java	Wed Sep 14 14:43:46 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java	Wed Sep 14 14:53:04 2011 +0000
@@ -1,45 +1,54 @@
 package de.intevation.flys.client.client.ui;
 
-import com.google.gwt.core.client.GWT;
+import java.util.ArrayList;
+import java.util.List;
 
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
 
 import de.intevation.flys.client.shared.model.Data;
-import de.intevation.flys.client.shared.model.DataItem;
-import de.intevation.flys.client.shared.model.DefaultData;
-import de.intevation.flys.client.shared.model.DefaultDataItem;
 import de.intevation.flys.client.shared.model.DataList;
-
-import de.intevation.flys.client.client.FLYSConstants;
+import de.intevation.flys.client.shared.model.User;
 
 
 /**
  * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
  */
-public class DatacagePanel extends TextProvider {
-
-    protected static FLYSConstants MSG = GWT.create(FLYSConstants.class);
+public abstract class DatacagePanel extends TextProvider {
 
     protected String dataName;
 
+    protected User user;
+
+    protected DatacageWidget widget;
+
+
+
+    public DatacagePanel() {
+        super();
+    }
+
+
+    public DatacagePanel(User user) {
+        super();
+        this.user = user;
+    }
+
 
     @Override
     public Canvas create(DataList dataList) {
         Data   data   = dataList.get(0);
         this.dataName = data.getLabel();
 
-        Canvas label  = new Label(data.getDescription());
-        Canvas widget = createWidget();
-        Canvas submit = getNextButton();
+        createWidget();
 
+        Canvas label   = new Label(data.getDescription());
+        Canvas submit  = getNextButton();
         VLayout layout = new VLayout();
         label.setHeight(25);
 
         layout.addMember(label);
-        layout.addMember(widget);
         layout.addMember(submit);
         layout.setMembersMargin(10);
 
@@ -47,27 +56,25 @@
     }
 
 
-    public Canvas createWidget() {
-        HLayout layout = new HLayout();
-        layout.setMembersMargin(10);
+    protected void createWidget() {
+        widget = new DatacageWidget(
+            artifact,
+            user,
+            getOuts(),
+            false);
 
-        layout.addMember(createForm());
-        // TODO: fetch current user!
-        // TODO: fetch collection view!
-        layout.addMember(
-            new DatacageButton(
-                MSG.databasket(), artifact, null, null));
+        widget.setHeight100();
 
-        return layout;
+        helperContainer.addMember(widget);
     }
 
 
     @Override
-    protected Data[] getData() {
-        String value  = "TODO:FIND VALUE";
-        DataItem item = new DefaultDataItem(dataName, dataName, value);
-        return new Data[] { new DefaultData(
-            dataName, null, null, new DataItem[] { item }) };
+    public List<String> validate() {
+        return new ArrayList<String>();
     }
+
+
+    public abstract String getOuts();
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java	Wed Sep 14 14:53:04 2011 +0000
@@ -0,0 +1,39 @@
+package de.intevation.flys.client.client.ui;
+
+import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
+import de.intevation.flys.client.shared.model.DefaultData;
+import de.intevation.flys.client.shared.model.DefaultDataItem;
+import de.intevation.flys.client.shared.model.User;
+
+
+public class DemDatacagePanel extends DatacagePanel {
+
+    public static final String WATERLEVEL_OUTS = "longitudinal_section";
+
+
+    public DemDatacagePanel() {
+        super();
+    }
+
+
+    public DemDatacagePanel(User user) {
+        super(user);
+    }
+
+
+    @Override
+    public String getOuts() {
+        return WATERLEVEL_OUTS;
+    }
+
+
+    @Override
+    protected Data[] getData() {
+        String value  = "TODO:FIND VALUE";
+        DataItem item = new DefaultDataItem(dataName, dataName, value);
+        return new Data[] { new DefaultData(
+            dataName, null, null, new DataItem[] { item }) };
+    }
+}
+// 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/UIProviderFactory.java	Wed Sep 14 14:43:46 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java	Wed Sep 14 14:53:04 2011 +0000
@@ -39,8 +39,11 @@
         else if (uiProvider.equals("continue")) {
             return new ContinuePanel();
         }
-        else if (uiProvider.equals("datacage_panel")) {
-            return new DatacagePanel();
+        else if (uiProvider.equals("wsp_datacage_panel")) {
+            return new WspDatacagePanel(user);
+        }
+        else if (uiProvider.equals("dgm_datacage_panel")) {
+            return new DemDatacagePanel(user);
         }
         else if (uiProvider.equals("datacage_twin_panel")) {
             return new DatacageTwinPanel(user);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java	Wed Sep 14 14:53:04 2011 +0000
@@ -0,0 +1,39 @@
+package de.intevation.flys.client.client.ui;
+
+import de.intevation.flys.client.shared.model.Data;
+import de.intevation.flys.client.shared.model.DataItem;
+import de.intevation.flys.client.shared.model.DefaultData;
+import de.intevation.flys.client.shared.model.DefaultDataItem;
+import de.intevation.flys.client.shared.model.User;
+
+
+public class WspDatacagePanel extends DatacagePanel {
+
+    public static final String WATERLEVEL_OUTS = "longitudinal_section";
+
+
+    public WspDatacagePanel() {
+        super();
+    }
+
+
+    public WspDatacagePanel(User user) {
+        super(user);
+    }
+
+
+    @Override
+    public String getOuts() {
+        return WATERLEVEL_OUTS;
+    }
+
+
+    @Override
+    protected Data[] getData() {
+        String value  = "TODO:FIND VALUE";
+        DataItem item = new DefaultDataItem(dataName, dataName, value);
+        return new Data[] { new DefaultData(
+            dataName, null, null, new DataItem[] { item }) };
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org