diff flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ThemeNavigationPanel.java @ 527:902609b5cc79

Added a navigation panel to the bottom of the theme control panel to move themes up/down (function not implemented yet). flys-client/trunk@2007 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 25 May 2011 16:23:16 +0000
parents
children 0ba7c43e7b62
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ThemeNavigationPanel.java	Wed May 25 16:23:16 2011 +0000
@@ -0,0 +1,91 @@
+package de.intevation.flys.client.client.ui.chart;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.google.gwt.core.client.GWT;
+
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
+
+import de.intevation.flys.client.client.event.OnMoveEvent;
+import de.intevation.flys.client.client.event.OnMoveHandler;
+
+
+/**
+ * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
+ */
+public class ThemeNavigationPanel extends Canvas {
+
+    public static final int PANEL_MARGIN  = 5;
+    public static final int BUTTON_HEIGHT = 20;
+    public static final int BUTTON_MARGIN = 5;
+
+
+    protected List<OnMoveHandler> handlers;
+
+
+    public ThemeNavigationPanel() {
+        this.handlers = new ArrayList<OnMoveHandler>();
+
+        setWidth100();
+        setHeight(BUTTON_HEIGHT);
+        setMargin(PANEL_MARGIN);
+
+        HLayout layout = new HLayout();
+        layout.setWidth100();
+        layout.setHeight(BUTTON_HEIGHT);
+        layout.setMembersMargin(BUTTON_MARGIN);
+
+        Canvas cu = createButton("CU", OnMoveEvent.TOP);
+        Canvas u  = createButton("U", OnMoveEvent.UP);
+        Canvas d  = createButton("D", OnMoveEvent.DOWN);
+        Canvas cd = createButton("CD", OnMoveEvent.BOTTOM);
+
+        layout.addMember(cu);
+        layout.addMember(u);
+        layout.addMember(d);
+        layout.addMember(cd);
+
+        addChild(layout);
+    }
+
+
+    protected Canvas createButton(final String type, final int moveType) {
+        Label b = new Label(type);
+        b.setBackgroundColor("#BED730");
+        b.setBorder("1px solid black");
+        b.setWidth(40);
+        b.setHeight(BUTTON_HEIGHT);
+        b.setAlign(Alignment.CENTER);
+
+        b.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                fireOnMoveEvent(moveType);
+            }
+        });
+
+        return b;
+    }
+
+
+    protected void addOnMoveHandler(OnMoveHandler handler) {
+        if (handler != null) {
+            handlers.add(handler);
+        }
+    }
+
+
+    protected void fireOnMoveEvent(int type) {
+        OnMoveEvent event = new OnMoveEvent(type);
+
+        for (OnMoveHandler handler: handlers) {
+            handler.onMove(event);
+        }
+    }
+}
+// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org