# HG changeset patch # User Ingo Weinzierl # Date 1306340596 0 # Node ID 902609b5cc795fab416440ae0eccf551e860512f # Parent 96e60e0a4345240a3b6bea8e76b68109f9fe297a 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 diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/ChangeLog --- a/flys-client/ChangeLog Wed May 25 14:58:42 2011 +0000 +++ b/flys-client/ChangeLog Wed May 25 16:23:16 2011 +0000 @@ -1,3 +1,44 @@ +2011-05-25 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/event/OnMoveHandler.java, + src/main/java/de/intevation/flys/client/client/event/OnMoveEvent.java: + New. Necessary classes and interfaces for a listener mechanism that is + used to inform handlers about a movement. E.g. the movement of a theme. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ThemeNavigationPanel.java: + New. A panel that consist of four buttons that throw OnMoveEvents after + pushing it. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java: + In addition, it implements the OnMoveHandler interface to listen to move + events. + + NOTE: We need to implement the code that moves themes up/down. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + Set the minimum width of the theme panel to 200px. + +2011-05-25 Ingo Weinzierl + + * src/main/java/de/intevation/flys/client/client/services/CollectionAttributeService.java, + src/main/java/de/intevation/flys/client/client/services/CollectionAttributeServiceAsync.java, + src/main/java/de/intevation/flys/client/server/CollectionAttributeServiceImpl.java: + New. This service should be used to modify/update the attribute of a + collection. + + NOTE: The update process needs to be implemented! Currently, the only + thing this service does is, that is waits 5sec and fetches a new + description right after this ;-) + + * src/main/java/de/intevation/flys/client/shared/model/ThemeList.java: + Added methods to remove and add themes. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java: + Changes in the theme panel will now trigger the update process of the + collection's attribute using the CollectionAttributeService. + + * src/main/webapp/WEB-INF/web.xml: Registered the new service. + 2011-05-25 Ingo Weinzierl * src/main/java/de/intevation/flys/client/shared/model/DefaultTheme.java: diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/src/main/java/de/intevation/flys/client/client/event/OnMoveEvent.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/event/OnMoveEvent.java Wed May 25 16:23:16 2011 +0000 @@ -0,0 +1,27 @@ +package de.intevation.flys.client.client.event; + + +/** + * @author Ingo Weinzierl + */ +public class OnMoveEvent { + + public static final int TOP = 0; + public static final int UP = 1; + public static final int DOWN = 2; + public static final int BOTTOM = 3; + + + protected int type; + + + public OnMoveEvent(int type) { + this.type = type; + } + + + public int getType() { + return type; + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/src/main/java/de/intevation/flys/client/client/event/OnMoveHandler.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/event/OnMoveHandler.java Wed May 25 16:23:16 2011 +0000 @@ -0,0 +1,11 @@ +package de.intevation.flys.client.client.event; + + +/** + * @author Ingo Weinzierl + */ +public interface OnMoveHandler { + + void onMove(OnMoveEvent event); +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed May 25 14:58:42 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed May 25 16:23:16 2011 +0000 @@ -37,6 +37,9 @@ public static final int DEFAULT_CHART_WIDTH = 600; public static final int DEFAULT_CHART_HEIGHT = 500; + public static final int THEMEPANEL_MIN_WIDTH = 200; + + /** The canvas that wraps the chart toolbar.*/ protected Canvas tbarPanel; @@ -69,7 +72,8 @@ tbarPanel.setBorder("1px solid black"); tbarPanel.setHeight(30); left.setBorder("1px solid black"); - left.setWidth("25%"); + left.setWidth(THEMEPANEL_MIN_WIDTH); + left.setMinWidth(THEMEPANEL_MIN_WIDTH); right.setWidth("*"); VLayout vLayout = new VLayout(); diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java Wed May 25 14:58:42 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java Wed May 25 16:23:16 2011 +0000 @@ -3,6 +3,7 @@ import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; @@ -21,6 +22,8 @@ import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.OnMoveEvent; +import de.intevation.flys.client.client.event.OnMoveHandler; import de.intevation.flys.client.client.services.CollectionAttributeService; import de.intevation.flys.client.client.services.CollectionAttributeServiceAsync; @@ -28,8 +31,10 @@ /** * @author Ingo Weinzierl */ -public class ChartThemePanel extends Canvas implements EditCompleteHandler { - +public class ChartThemePanel +extends Canvas +implements EditCompleteHandler, OnMoveHandler +{ /** The interface that provides i18n messages. */ private FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -49,12 +54,16 @@ protected ListGrid list; + protected ThemeNavigationPanel navigation; + public ChartThemePanel(Collection collection, OutputMode mode) { this.collection = collection; this.mode = mode; this.list = new ListGrid(); + this.navigation = new ThemeNavigationPanel(); + this.navigation.addOnMoveHandler(this); initGrid(); initLayout(); @@ -75,6 +84,7 @@ layout.setHeight100(); layout.addMember(list); + layout.addMember(navigation); addChild(layout); } @@ -243,5 +253,12 @@ } }); } + + + public void onMove(OnMoveEvent event) { + GWT.log("ChartThemePanel.onMove: " + event.getType()); + + // TODO IMPLEMENT ME + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 96e60e0a4345 -r 902609b5cc79 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ThemeNavigationPanel.java --- /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 Ingo Weinzierl + */ +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 handlers; + + + public ThemeNavigationPanel() { + this.handlers = new ArrayList(); + + 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 :