Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java @ 1607:64e3d4b024b1
Added Change accidentally ommitted to commit in rev 3960.
flys-client/trunk@3968 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 08 Feb 2012 13:56:28 +0000 |
parents | f43d06d6a4a2 |
children | f3325079dacc |
line wrap: on
line source
package de.intevation.flys.client.client.ui; import java.util.ArrayList; import java.util.List; import com.google.gwt.core.client.GWT; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.ImgButton; 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.FLYSConstants; 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 = 25; public static final int BUTTON_MARGIN = 5; protected FLYSConstants MSG = GWT.create(FLYSConstants.class); 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(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); addChild(layout); } protected Canvas createButton(final String title, final int moveType) { String url = GWT.getHostPageBaseURL() + title; ImgButton b = new ImgButton(); b.setSrc(url); b.setHeight(BUTTON_HEIGHT); b.setWidth(40); b.setIconHeight(BUTTON_HEIGHT-10); 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.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 :