changeset 75:571843833129

Added a panel that will be used to display chart output. flys-client/trunk@1578 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 28 Mar 2011 07:55:39 +0000
parents c5586446f3c0
children 1c0731f69dc6
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java
diffstat 4 files changed, 102 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon Mar 28 07:09:34 2011 +0000
+++ b/flys-client/ChangeLog	Mon Mar 28 07:55:39 2011 +0000
@@ -1,3 +1,18 @@
+2011-03-28  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/ChartOutputTab.java:
+	  An OutputTab with two panels. The left one is not implemented yet
+	  (ThemeEditor). The right one will display an image.
+
+	* src/main/java/de/intevation/flys/client/client/ui/OutputTab.java: The
+	  content pane is set in the constructor.
+
+	* src/main/java/de/intevation/flys/client/client/ui/CollectionView.java:
+	  New output tabs will use the ChartOutputTab.
+
+	  NOTE: We should move the code that constructs the concrete output tabs
+	  into a factory class that decides which OutputTab has to be used.
+
 2011-03-28  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/CollectionView.java:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ChartOutputTab.java	Mon Mar 28 07:55:39 2011 +0000
@@ -0,0 +1,83 @@
+package de.intevation.flys.client.client.ui;
+
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import de.intevation.flys.client.shared.model.Collection;
+import de.intevation.flys.client.shared.model.OutputMode;
+import de.intevation.flys.client.client.Config;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ChartOutputTab extends OutputTab {
+
+    /** The canvas that wraps the theme editor.*/
+    protected Canvas left;
+
+    /** The canvas that wraps the chart.*/
+    protected Canvas right;
+
+
+    /**
+     * The default constructor to create a new ChartOutputTab.
+     *
+     * @param title The title of this tab.
+     * @param collection The Collection which this chart belongs to.
+     * @param mode The OutputMode.
+     */
+    public ChartOutputTab(String title, Collection collection, OutputMode mode){
+        super(title, collection, mode);
+
+        left   = new Canvas();
+        right  = new Canvas();
+
+        left.setWidth("25%");
+        right.setWidth("*");
+
+        HLayout hLayout = new HLayout();
+        hLayout.setWidth100();
+        hLayout.setHeight100();
+        hLayout.setMembersMargin(10);
+
+        hLayout.addMember(left);
+        hLayout.addMember(right);
+
+        Label todo = new Label("TODO: Implement theme editor.");
+        Img chart  = getChartImg();
+
+        left.addChild(todo);
+        right.addChild(chart);
+
+        setPane(hLayout);
+    }
+
+
+    /**
+     * Builds the chart image and returns it.
+     *
+     * @return the chart image.
+     */
+    protected Img getChartImg() {
+        return new Img(getImgUrl());
+    }
+
+
+    /**
+     * Builds the URL that points to the chart image.
+     *
+     * @return the URL to the chart image.
+     */
+    protected String getImgUrl() {
+        Config config = Config.getInstance();
+        String server = config.getServerUrl();
+
+        // TODO Build the correct url that points to the OUT() resource of the
+        // collection.
+        return server;
+    }
+}
+// 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/CollectionView.java	Mon Mar 28 07:09:34 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java	Mon Mar 28 07:55:39 2011 +0000
@@ -306,7 +306,10 @@
      */
     protected void addOutputTab(String name, OutputMode out) {
         GWT.log("Add new output tab for '" + name + "'");
-        OutputTab tab = new OutputTab(name, getCollection(), out);
+
+        // TODO Source this out to a factory that creates the different
+        // OutputTabs.
+        OutputTab tab = new ChartOutputTab(name, getCollection(), out);
         outputTabs.put(name, tab);
     }
 
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java	Mon Mar 28 07:09:34 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/OutputTab.java	Mon Mar 28 07:55:39 2011 +0000
@@ -30,15 +30,6 @@
         this.collection = collection;
         this.mode       = mode;
 
-        init();
-    }
-
-
-    /**
-     * Method that is called at the end of a constructor to initialize the view
-     * of this widget.
-     */
-    protected void init() {
         setPane(new Label("Implement concrete subclasses to vary the output."));
     }
 }

http://dive4elements.wald.intevation.org