Mercurial > dive4elements > river
changeset 533:34103ab9fe60
Moved the toolbar stuff of the chart panel into an own class.
flys-client/trunk@2024 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 27 May 2011 13:48:25 +0000 |
parents | 0ba7c43e7b62 |
children | e08777967bad |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java |
diffstat | 3 files changed, 87 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri May 27 13:10:09 2011 +0000 +++ b/flys-client/ChangeLog Fri May 27 13:48:25 2011 +0000 @@ -1,3 +1,11 @@ +2011-05-27 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + Moved the toolbar code into an own class. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java: + New. The toolbar used for chart panels. + 2011-05-27 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/MainMenu.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Fri May 27 13:10:09 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Fri May 27 13:48:25 2011 +0000 @@ -4,7 +4,6 @@ import com.google.gwt.core.client.GWT; -import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.Label; @@ -12,22 +11,15 @@ import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.events.CloseClickHandler; -import com.smartgwt.client.widgets.events.CloseClientEvent; import com.smartgwt.client.widgets.events.ResizedEvent; import com.smartgwt.client.widgets.events.ResizedHandler; -import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.OutputMode; import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.event.OutputParameterChangeEvent; import de.intevation.flys.client.client.event.OutputParameterChangeHandler; import de.intevation.flys.client.client.ui.CollectionView; -import de.intevation.flys.client.client.ui.DatacageWindow; import de.intevation.flys.client.client.ui.OutputTab; @@ -44,8 +36,6 @@ public static final int THEMEPANEL_MIN_WIDTH = 200; - protected FLYSConstants MSG = GWT.create(FLYSConstants.class); - /** The canvas that wraps the chart toolbar.*/ protected Canvas tbarPanel; @@ -72,12 +62,10 @@ ){ super(title, collection, mode); - tbarPanel = new Canvas(); left = new Canvas(); right = new Canvas(); + tbarPanel = new ChartToolbar(collectionView); - tbarPanel.setBorder("1px solid black"); - tbarPanel.setHeight(30); left.setBorder("1px solid black"); left.setWidth(THEMEPANEL_MIN_WIDTH); left.setMinWidth(THEMEPANEL_MIN_WIDTH); @@ -99,8 +87,6 @@ right.addChild(createChartPanel()); left.addChild(ctp); - tbarPanel.addChild( - createTBarPanel(collectionView)); vLayout.addMember(tbarPanel); vLayout.addMember(hLayout); @@ -143,41 +129,6 @@ } - protected Canvas createTBarPanel( - final CollectionView collectionView - ) { - HLayout hLayout = new HLayout(); - hLayout.setWidth100(); - hLayout.setHeight100(); - hLayout.setMembersMargin(10); - - Button datacage = new Button(MSG.databasket()); - datacage.setHeight(20); - - hLayout.setMargin(5); - hLayout.addMember(datacage); - datacage.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent event) { - GWT.log("Clicked 'datacage' button."); - openDatacageWindow( - collectionView.getArtifact()); - } - }); - - return hLayout; - } - - protected void openDatacageWindow(Artifact artifact) { - final DatacageWindow dc = new DatacageWindow(artifact); - dc.addCloseClickHandler(new CloseClickHandler() { - public void onCloseClick(CloseClientEvent event) { - dc.destroy(); - } - }); - dc.show(); - } - - protected Canvas createChartPanel() { return createChartPanel(DEFAULT_CHART_WIDTH, DEFAULT_CHART_HEIGHT); }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartToolbar.java Fri May 27 13:48:25 2011 +0000 @@ -0,0 +1,78 @@ +package de.intevation.flys.client.client.ui.chart; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.widgets.Button; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import com.smartgwt.client.widgets.events.CloseClickHandler; +import com.smartgwt.client.widgets.events.CloseClientEvent; + +import de.intevation.flys.client.shared.model.Artifact; + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.ui.CollectionView; +import de.intevation.flys.client.client.ui.DatacageWindow; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ChartToolbar extends HLayout { + + protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); + + + public static final int PANEL_HEIGHT = 30; + + + protected CollectionView view; + + protected Button datacage; + + + public ChartToolbar(CollectionView view) { + super(); + + this.view = view; + + datacage = new Button(MSG.databasket()); + datacage.addClickHandler(new ClickHandler() { + public void onClick(ClickEvent event) { + GWT.log("Clicked 'datacage' button."); + openDatacageWindow(getArtifact()); + } + }); + + initLayout(); + } + + + public Artifact getArtifact() { + return view.getArtifact(); + } + + + protected void initLayout() { + setWidth100(); + setHeight(PANEL_HEIGHT); + setMembersMargin(10); + setPadding(5); + setBorder("1px solid black"); + + addMember(datacage); + } + + + protected void openDatacageWindow(Artifact artifact) { + final DatacageWindow dc = new DatacageWindow(artifact); + dc.addCloseClickHandler(new CloseClickHandler() { + public void onCloseClick(CloseClientEvent event) { + dc.destroy(); + } + }); + dc.show(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :