Mercurial > dive4elements > river
changeset 523:0785a8ba5e6d
Implemented the first step of a theme control panel for charts.
flys-client/trunk@2002 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 25 May 2011 11:34:34 +0000 |
parents | 2e02db03e576 |
children | ba238f917b94 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties 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/ChartThemePanel.java flys-client/src/main/java/de/intevation/flys/client/shared/model/FacetRecord.java |
diffstat | 8 files changed, 236 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/ChangeLog Wed May 25 11:34:34 2011 +0000 @@ -1,3 +1,20 @@ +2011-05-25 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/shared/model/FacetRecord.java: + New. This ListRecord is used to display facets in grids. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java: + New. This panel contains elements to control the themes of a chart. + + * src/main/java/de/intevation/flys/client/client/FLYSConstants.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties, + src/main/java/de/intevation/flys/client/client/FLYSConstants.java: + Added i18n strings for the ChartThemePanel. + + * src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java: + The left side of this panel is filled with the ChartThemePanel now. + 2011-05-25 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/server/meta/Converter.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Wed May 25 11:34:34 2011 +0000 @@ -168,6 +168,8 @@ String wst(); + String chart_themepanel_header_themes(); + // ERRORS String error_create_artifact();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Wed May 25 11:34:34 2011 +0000 @@ -80,6 +80,7 @@ dataexport = Datenexport csv = CSV wst = WST +chart_themepanel_header_themes = Theme error_empty_state = Required inputs are missing. error_invalid_double_value = Wrong format for a floating point number.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Wed May 25 11:34:34 2011 +0000 @@ -80,6 +80,7 @@ dataexport = Datenexport csv = CSV wst = WST +chart_themepanel_header_themes = Thema error_empty_state = Es wurden nicht alle ben\u00d6tigten Daten eingegeben. error_invalid_double_value = Falsches Format f\u00fc eine Flie\u00dfkommazahl.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Wed May 25 11:34:34 2011 +0000 @@ -50,7 +50,7 @@ wqQ = Q [m³/s] wqSingle = Single values wqRange = Range -untiWNN = W [NN+m] +unitWNN = W [NN+m] unitWSingle = cm unitWFrom = cm - unitWTo = cm a @@ -65,13 +65,22 @@ buttonNext = Next imageBack = images/back_en.png +imageSave = images/save.gif discharge_curve = Discharge Curves at Gauges computed_discharge_curve = Discharge Curve longitudinal_section = Longitudinal Section Curve duration_curve = Duration Curve +discharge_longitudinal_section = Discharge Longitudinal Section + waterlevel_export = Waterlevel Export -discharge_longitudinal_section = Discharge Longitudinal Section +computed_dischargecurve_export = Discharge Curve Export +discharge_longitudinal_section_export = Discharge Longitudinal Section Export +durationcurve_export = Duration Curve Export +dataexport = Datenexport +csv = CSV +wst = WST +chart_themepanel_header_themes = Theme error_empty_state = Required inputs are missing. error_invalid_double_value = Wrong format for a floating point number. @@ -83,7 +92,7 @@ error_create_collection = Error while creating a new collection. error_describe_collection = Error while fetching the projects state. error_no_rivers_found = Error while reading supported rivers. -error_no_such_user = Error - no such user. +error_no_such_user = Error - no such user found. error_not_logged_in = You need to log in before you are allowed to start your work. error_load_parameterization = Could not load the parameterization. @@ -97,3 +106,8 @@ error_feed_no_calculation_mode = No calculation method chosen. error_feed_no_such_river = The selected river is not provided. error_feed_no_river_selected = No river selected. +error_feed_no_wq_mode_selected = No W/Q mode selected. +error_feed_q_values_invalid = Selected Q values are outside the valid range. +error_feed_w_values_invalid = Selected W values are outside the valid range. + +error_no_meta_data_found = No meta data found.
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed May 25 11:30:46 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartOutputTab.java Wed May 25 11:34:34 2011 +0000 @@ -84,7 +84,7 @@ hLayout.addMember(right); right.addChild(createChartPanel()); - left.addChild(createThemeControlPanel()); + left.addChild(new ChartThemePanel(collection, mode)); tbarPanel.addChild( createTBarPanel(collectionView));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ChartThemePanel.java Wed May 25 11:34:34 2011 +0000 @@ -0,0 +1,144 @@ +package de.intevation.flys.client.client.ui.chart; + +import java.util.List; + +import com.google.gwt.core.client.GWT; + +import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.grid.events.EditCompleteEvent; +import com.smartgwt.client.widgets.grid.events.EditCompleteHandler; +import com.smartgwt.client.widgets.grid.ListGrid; +import com.smartgwt.client.widgets.grid.ListGridField; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.layout.VLayout; + +import de.intevation.flys.client.shared.model.Collection; +import de.intevation.flys.client.shared.model.Facet; +import de.intevation.flys.client.shared.model.FacetRecord; +import de.intevation.flys.client.shared.model.OutputMode; + +import de.intevation.flys.client.client.FLYSConstants; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class ChartThemePanel extends Canvas implements EditCompleteHandler { + + /** The interface that provides i18n messages. */ + private FLYSConstants MSG = GWT.create(FLYSConstants.class); + + public static final String GRID_FIELD_ACTIVE = "active"; + public static final String GRID_FIELD_NAME = "name"; + + + protected Collection collection; + + protected OutputMode mode; + + protected ListGrid list; + + + + public ChartThemePanel(Collection collection, OutputMode mode) { + this.collection = collection; + this.mode = mode; + this.list = new ListGrid(); + + initGrid(); + initLayout(); + + updateGrid(); + } + + + /** + * Initializes the layout of this panel. + */ + protected void initLayout() { + setWidth100(); + setHeight100(); + + VLayout layout = new VLayout(); + layout.setWidth100(); + layout.setHeight100(); + + layout.addMember(list); + + addChild(layout); + } + + + /** + * Initializes the components (columns) of the theme grid. + */ + protected void initGrid() { + list.setCanEdit(true); + list.setCanSort(false); + list.setShowRecordComponents(false); + list.setShowRecordComponentsByCell(true); + list.setShowHeader(true); + list.setShowHeaderContextMenu(false); + list.setWidth100(); + list.setHeight100(); + + list.addEditCompleteHandler(this); + + ListGridField active = new ListGridField(GRID_FIELD_ACTIVE, " ", 20); + active.setType(ListGridFieldType.BOOLEAN); + + ListGridField name = new ListGridField( + GRID_FIELD_NAME, MSG.chart_themepanel_header_themes()); + name.setType(ListGridFieldType.TEXT); + + list.setFields(active, name); + } + + + /** + * A method that removes all records from theme grid. + */ + protected void clearGrid() { + ListGridRecord[] records = list.getRecords(); + + if (records == null || records.length == 0) { + return; + } + + for (ListGridRecord record: records) { + list.removeData(record); + } + } + + + /** + * This method is used to clear the current theme grid and add new updated + * data. + */ + protected void updateGrid() { + clearGrid(); + + List<Facet> facets = mode.getFacets(); + + for (Facet facet: facets) { + list.addData(new FacetRecord(facet)); + } + } + + + /** + * This method is called after a cell in the theme grid has been modified. + * + * @param event The event that stores information about the modified record. + */ + public void onEditComplete(EditCompleteEvent event) { + GWT.log("Edited record."); + + int row = event.getRowNum(); + FacetRecord rec = (FacetRecord) list.getRecord(row); + + // TODO Save modified facets + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/FacetRecord.java Wed May 25 11:34:34 2011 +0000 @@ -0,0 +1,53 @@ +package de.intevation.flys.client.shared.model; + +import com.smartgwt.client.widgets.grid.ListGridRecord; + +import de.intevation.flys.client.shared.model.Facet; + + +/** + * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> + */ +public class FacetRecord extends ListGridRecord { + + protected boolean active; + + protected Facet facet; + + + public FacetRecord(Facet facet) { + this.facet = facet; + + setActive(true); + setName(facet.getName()); + } + + + public Facet getFacet() { + return facet; + } + + + public void setName(String name) { + // TODO Add a setter method setName() to Facet + // facet.setName(name); + setAttribute("name", name); + } + + + public String getName() { + return getAttribute("name"); + } + + + public boolean getActive() { + return getAttributeAsBoolean("active"); + } + + + public void setActive(boolean active) { + this.active = active; + setAttribute("active", active); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :