Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java @ 3847:f3b821735e39
Calculate the info url via i18n
Don't fetch the info url from the artifact service and use i18n to calculate the
url by using the official gauge and river number.
flys-client/trunk@5582 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 24 Sep 2012 08:39:22 +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 :