Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemeNavigationPanel.java @ 4198:1cdbd8a0c994
Added two new tables ClickableQDTable and ClickableWTable and made Ws and Qs clickable in historical discharge calculation.
The new tables define listener interfaces (clicked lower or upper icon) to listen to user clicks.
In addition to this, there is an enum ClickMode with NONE, SINGLE and RANGE options, which allows to
specifiy, which icons are displayed in the tables. NONE means no icon for user clicks, SINGLE has 1
icon, RANGE 2 icons for lower and upper.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 22 Oct 2012 13:31:25 +0200 |
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 :