diff flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java @ 3715:8d3e48f189d2

Add first draft for the gauge overview info ui flys-client/trunk@5472 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Fri, 14 Sep 2012 14:07:48 +0000
parents 08f8524a81ad
children 4e33aa341e51
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 14 14:03:12 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ParameterList.java	Fri Sep 14 14:07:48 2012 +0000
@@ -13,6 +13,7 @@
 import com.smartgwt.client.types.VisibilityMode;
 import com.smartgwt.client.util.SC;
 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.SectionStack;
 import com.smartgwt.client.widgets.layout.SectionStackSection;
@@ -21,6 +22,7 @@
 import com.smartgwt.client.widgets.tab.events.TabSelectedHandler;
 
 import de.intevation.flys.client.shared.model.Artifact;
+import de.intevation.flys.client.shared.model.WINFOArtifact;
 import de.intevation.flys.client.shared.model.ArtifactDescription;
 import de.intevation.flys.client.shared.model.Collection;
 import de.intevation.flys.client.shared.model.Data;
@@ -109,6 +111,7 @@
     protected VLayout report;
     protected VLayout helperPanel;
     protected VLayout tablePanel;
+    protected GaugePanel gaugePanel;
     protected Canvas  reportPanel;
 
     public ParameterList(FLYS flys, CollectionView cView, String title) {
@@ -207,6 +210,23 @@
         stack.setCanResizeSections(true);
         stack.setVisibilityMode(VisibilityMode.MULTIPLE);
 
+        final SectionStackSection gaugeSection = new SectionStackSection();
+        gaugeSection.setExpanded(false);
+        gaugeSection.setTitle(MSG.gaugePanelTitle());
+        gaugePanel = new GaugePanel(gaugeSection) {
+            public void addMember(Canvas component) {
+                super.addMember(component);
+                gaugeSection.setExpanded(true);
+            }
+
+            public void removeMembers(Canvas[] components) {
+                super.removeMembers(components);
+                gaugeSection.setExpanded(false);
+            }
+        };
+        gaugePanel.setWidth100();
+        gaugePanel.setHeight("20%");
+
         // This canvas is used to render helper widgets.
         final SectionStackSection helperSection = new SectionStackSection();
         helperSection.setExpanded(false);
@@ -245,7 +265,7 @@
         tablePanel.setWidth100();
         tableSection.setItems(tablePanel);
 
-        stack.setSections(helperSection, tableSection);
+        stack.setSections(gaugeSection, helperSection, tableSection);
 
         return stack;
     }
@@ -682,6 +702,11 @@
             helperPanel.removeMembers(c);
         }
 
+        c = gaugePanel.getMembers();
+        if (c != null && c.length > 0) {
+            gaugePanel.removeMembers(c);
+        }
+
         Artifact art             = event.getNewValue();
         ArtifactDescription desc = art.getArtifactDescription();
 
@@ -723,6 +748,10 @@
                 setCurrentData(null, null);
             }
         }
+        if (art instanceof WINFOArtifact) {
+            renderGaugeInfo(desc.getRiver());
+            gaugePanel.show();
+        }
 
         addOldDatas(
             desc.getOldData(),
@@ -895,5 +924,12 @@
     protected void unlockUI() {
         cView.unlockUI();
     }
+
+
+    private void renderGaugeInfo(String river) {
+        gaugePanel.setRiver(river);
+        gaugePanel.show();
+    }
+
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org