changeset 4641:f3325079dacc

Improve the up and down arrows in the theme navigation panel Don't stretch the arrow icons and fit to their actual size. Also put the up buttons on the left and the down buttons on the right.
author Björn Ricks <bjoern.ricks@intevation.de>
date Tue, 04 Dec 2012 16:16:43 +0100
parents e3f28be45103
children ca18d8d06218
files flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java
diffstat 1 files changed, 28 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java	Tue Dec 04 16:08:04 2012 +0100
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java	Tue Dec 04 16:16:43 2012 +0100
@@ -5,6 +5,8 @@
 
 import com.google.gwt.core.client.GWT;
 
+import com.smartgwt.client.types.Alignment;
+import com.smartgwt.client.types.VerticalAlignment;
 import com.smartgwt.client.widgets.Canvas;
 import com.smartgwt.client.widgets.ImgButton;
 import com.smartgwt.client.widgets.events.ClickEvent;
@@ -22,8 +24,9 @@
 public class ThemeNavigationPanel extends Canvas {
 
     public static final int PANEL_MARGIN  = 5;
-    public static final int BUTTON_HEIGHT = 25;
+    public static final int BUTTON_HEIGHT = 20;
     public static final int BUTTON_MARGIN = 5;
+    private static final int BOTTON_WIDTH = 20;
 
 
     protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
@@ -43,16 +46,32 @@
         layout.setWidth100();
         layout.setHeight(BUTTON_HEIGHT);
         layout.setMembersMargin(BUTTON_MARGIN);
+        layout.setDefaultLayoutAlign(VerticalAlignment.CENTER);
+        layout.setDefaultLayoutAlign(Alignment.CENTER);
 
         Canvas cu = createButton(MSG.theme_top(), OnMoveEvent.TOP);
         Canvas u  = createButton(MSG.theme_up(), OnMoveEvent.UP);
         Canvas d  = createButton(MSG.theme_down(), OnMoveEvent.DOWN);
         Canvas cd = createButton(MSG.theme_bottom(), OnMoveEvent.BOTTOM);
 
-        layout.addMember(cu);
-        layout.addMember(u);
-        layout.addMember(d);
-        layout.addMember(cd);
+        HLayout left = new HLayout();
+        left.setMembersMargin(BUTTON_MARGIN);
+        left.setLayoutAlign(Alignment.LEFT);
+        left.setDefaultLayoutAlign(Alignment.LEFT);
+        left.setAlign(Alignment.LEFT);
+        left.addMember(cu);
+        left.addMember(u);
+
+        HLayout right = new HLayout();
+        right.setMembersMargin(BUTTON_MARGIN);
+        right.setLayoutAlign(Alignment.RIGHT);
+        right.setDefaultLayoutAlign(Alignment.RIGHT);
+        right.setAlign(Alignment.RIGHT);
+        right.addMember(d);
+        right.addMember(cd);
+
+        layout.addMember(left);
+        layout.addMember(right);
 
         addChild(layout);
     }
@@ -63,17 +82,17 @@
 
         ImgButton b = new ImgButton();
         b.setSrc(url);
+        b.setWidth(BOTTON_WIDTH);
         b.setHeight(BUTTON_HEIGHT);
-        b.setWidth(40);
-        b.setIconHeight(BUTTON_HEIGHT-10);
+        b.setIconHeight(BUTTON_HEIGHT);
+        b.setIconWidth(BOTTON_WIDTH);
         b.setShowDown(false);
         b.setShowRollOver(false);
         b.setShowDisabled(false);
         b.setShowDisabledIcon(true);
         b.setShowDownIcon(false);
         b.setShowFocusedIcon(false);
-        b.setBackgroundColor("f2f2f2");
-        b.setBorder("1px solid #A6ABB4");
+        b.setValign(VerticalAlignment.CENTER);
 
         b.addClickHandler(new ClickHandler() {
             public void onClick(ClickEvent event) {

http://dive4elements.wald.intevation.org