Mercurial > dive4elements > river
changeset 4133:c722c08cf502
Merged heads.
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 15 Oct 2012 09:31:50 +0200 |
parents | f6c73ee1b7f1 (current diff) 360e22afb98b (diff) |
children | 9c78264109ad |
files | 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/GaugeTimeRangePanel.java |
diffstat | 44 files changed, 1316 insertions(+), 382 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/ChangeLog Mon Oct 15 09:31:50 2012 +0200 @@ -1,3 +1,62 @@ +2012-10-13 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Improve on issue945/6 + + * flys-artifacts/doc/conf/meta-data.xml: Add nodes for W/Q-only + mainvalues. + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java: + Create only W/Q values if corresponding data given. + +2012-10-13 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Improve on issue945/1 + + * flys-artifacts/doc/conf/meta-data.xml: Recommend main values + in computed discharge curves. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Improve on issue943/4 + + * flys-artifacts/doc/conf/meta-data.xml: Do not show double + annotation entry in LS DC. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Improve on issue943/4 + + * flys-artifacts/doc/conf/meta-data.xml: Show an "all" node in DC + for annotations per type. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + Fix issue943/3 + + * flys-artifacts/doc/conf/meta-data.xml: Add Floodprotections to + LS non-recommendations. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java: + Help future developers. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RiverAccess.java: + Improve code drastically. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-artifacts/doc/conf/artifacts/winfo.xml: Include new state and + transition for extreme value q input per segment. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java: + New, initial Input state for Q input per segment in extreme analysis + path. + 2012-10-12 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java:
--- a/flys-artifacts/doc/conf/artifacts/winfo.xml Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/doc/conf/artifacts/winfo.xml Mon Oct 15 09:31:50 2012 +0200 @@ -178,6 +178,11 @@ <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition"> <from state="state.winfo.extreme.percent"/> + <to state="state.winfo.extreme.qinput"/> + </transition> + + <transition transition="de.intevation.flys.artifacts.transitions.DefaultTransition"> + <from state="state.winfo.extreme.qinput"/> <to state="state.winfo.extreme.curve"/> </transition> @@ -594,6 +599,12 @@ <data name="percent" type="Double"/> </state> + <state id="state.winfo.extreme.qinput" + description="state.winfo.extreme.qinput" + state="de.intevation.flys.artifacts.states.extreme.ExtremeQInput"> + <data name="ranges" type="Double[]"/> + </state> + <state id="state.winfo.extreme.curve" description="state.winfo.extreme.curve" state="de.intevation.flys.artifacts.states.extreme.ExtremeCompute" helpText="https://flys-intern.intevation.de/Flys-3.0"> <outputmodes> <outputmode name="longitudinal_section" description="output.longitudinal_section" mime-type="image/png" type="chart">
--- a/flys-artifacts/doc/conf/meta-data.xml Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/doc/conf/meta-data.xml Mon Oct 15 09:31:50 2012 +0200 @@ -320,7 +320,7 @@ <column> <dc:attribute name="name" value="${prot_column_name}"/> <dc:attribute name="ids" value="additionals-wstv-${prot_rel_pos}-${prot_id}"/> - <dc:attribute name="factory" value="staticwkms"/> + <dc:attribute name="factory" value="staticwqkms"/> <dc:attribute name="info" value="${info}"/> </column> </dc:elements> @@ -490,24 +490,22 @@ <dc:attribute name="name" value="${prot_description}"/> <dc:attribute name="db-id" value="${prot_id}"/> <dc:attribute name="factory" value="staticwkms"/> - <columns> - <dc:context> - <dc:statement> - SELECT id AS prot_column_id, - name AS prot_column_name, - position AS prot_rel_pos - FROM wst_columns WHERE wst_id = ${prot_id} - ORDER by position - </dc:statement> - <dc:elements> - <column> - <dc:attribute name="name" value="${prot_column_name}"/> - <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/> - <dc:attribute name="factory" value="staticwkms"/> - </column> - </dc:elements> - </dc:context> - </columns> + <dc:context> + <dc:statement> + SELECT id AS prot_column_id, + name AS prot_column_name, + position AS prot_rel_pos + FROM wst_columns WHERE wst_id = ${prot_id} + ORDER by position + </dc:statement> + <dc:elements> + <column> + <dc:attribute name="name" value="${prot_column_name}"/> + <dc:attribute name="ids" value="flood_protection-wstv-${prot_rel_pos}-${prot_id}"/> + <dc:attribute name="factory" value="staticwkms"/> + </column> + </dc:elements> + </dc:context> </flood_protection> </dc:elements> </dc:context> @@ -519,6 +517,14 @@ <dc:attribute name="factory" value="mainvalue"/> <dc:attribute name="ids" value="${river_id}"/> </mainvalue> + <wmainvalue> + <dc:attribute name="factory" value="mainvalue"/> + <dc:attribute name="ids" value="${river_id}:w"/> + </wmainvalue> + <qmainvalue> + <dc:attribute name="factory" value="mainvalue"/> + <dc:attribute name="ids" value="${river_id}:q"/> + </qmainvalue> </dc:macro> <dc:macro name="qsectors"> @@ -538,6 +544,11 @@ <dc:macro name="annotations_per_type"> <annotations> <dc:context> + <annotation> + <dc:attribute name="name" value="all_annotations"/> + <dc:attribute name="factory" value="annotations"/> + <dc:attribute name="ids" value="${river_id}"/> + </annotation> <dc:statement> SELECT id AS anno_id, name AS anno_description @@ -615,6 +626,9 @@ <dc:call-macro name="cross_sections"/> <dc:call-macro name="hyks"/> </dc:if> + <dc:if test="dc:contains($artifact-outs, 'computed_discharge_curve')"> + <dc:call-macro name="mainvalues"/> + </dc:if> <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> <dc:call-macro name="annotations"/> <dc:call-macro name="mainvalues"/> @@ -669,31 +683,33 @@ <dc:call-macro name="basedata_4_heightmarks-points"/> <dc:comment comment=" AMTL LINIEN ---------------------------"/> <dc:call-macro name="basedata_3_officials"/> + <dc:call-macro name="basedata_5_flood-protections"/> <dc:call-macro name="annotations_per_type"/> </dc:if> - <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> - <dc:call-macro name="annotations"/> - <!--dc:call-macro name="basedata_0"/--> - <dc:call-macro name="basedata_1_additionals-relative_point"/> - <dc:comment comment=" FIXATIONS ---------------------------"/> - <dc:call-macro name="basedata_2_fixations_relative_point"/> - <dc:comment comment=" HOEHENMARKEN ---------------------------"/> - <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/> - <dc:call-macro name="basedata_5_flood-protections_relative_points"/> - </dc:if> - <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')"> - <dc:call-macro name="basedata_0_wq"/> - <dc:call-macro name="basedata_1_additionals"/> - <dc:call-macro name="basedata_2_fixations"/> - <dc:call-macro name="basedata_3_officials"/> - <dc:call-macro name="basedata_4_heightmarks-points"/> - <dc:call-macro name="basedata_5_flood-protections_relative_points"/> - </dc:if> - <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')"> - </dc:if> - <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')"> - <dc:call-macro name="annotations"/> - </dc:if> + + <dc:if test="dc:contains($artifact-outs, 'reference_curve')"> + <dc:call-macro name="annotations"/> + <!--dc:call-macro name="basedata_0"/--> + <dc:call-macro name="basedata_1_additionals-relative_point"/> + <dc:comment comment=" FIXATIONS ---------------------------"/> + <dc:call-macro name="basedata_2_fixations_relative_point"/> + <dc:comment comment=" HOEHENMARKEN ---------------------------"/> + <dc:call-macro name="basedata_4_heightmarks-points-relative_points"/> + <dc:call-macro name="basedata_5_flood-protections_relative_points"/> + </dc:if> + <dc:if test="dc:contains($artifact-outs, 'fix_wq_curve')"> + <dc:call-macro name="basedata_0_wq"/> + <dc:call-macro name="basedata_1_additionals"/> + <dc:call-macro name="basedata_2_fixations_wqkms"/> + <dc:call-macro name="basedata_3_officials"/> + <dc:call-macro name="basedata_4_heightmarks-points"/> + <dc:call-macro name="basedata_5_flood-protections_relative_points"/> + </dc:if> + <dc:if test="dc:contains($artifact-outs, 'fix_deltawt_curve')"> + </dc:if> + <dc:if test="dc:contains($artifact-outs, 'fix_longitudinal_section_curve')"> + <dc:call-macro name="annotations"/> + </dc:if> <dc:comment comment="--- non-recommendations---"/> </dc:otherwise> </dc:choose> @@ -825,13 +841,6 @@ </discharge_table_nn> </dc:if> - <dc:if test="dc:contains($artifact-outs, 'longitudinal_section')"> - - <longitudinal_section> - <dc:call-macro name="annotations"/> - </longitudinal_section> - </dc:if> - <dc:if test="dc:contains($artifact-outs, 'map')"> <map> <dc:choose>
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/MainValuesArtifact.java Mon Oct 15 09:31:50 2012 +0200 @@ -36,7 +36,7 @@ /** - * Artifact to access names of Points Of Interest along a segment of a river. + * Artifact to access main and extreme values of a river. * This artifact neglects (Static)FLYSArtifacts capabilities of interaction * with the StateEngine by overriding the getState*-methods. */ @@ -96,27 +96,41 @@ logger.debug("MainValuesArtifact.setup"); state = new StaticState(STATIC_STATE_NAME); - Facet qfacet0 = new MainValuesQFacet( - DURATION_MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - false); - Facet qfacet1 = new MainValuesQFacet( - COMPUTED_DISCHARGE_MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - false); - Facet qfacet2 = new MainValuesQFacet( - MAINVALUES_Q, - Resources.getMsg( - callMeta, - "facet.discharge_curves.mainvalues.q", - "facet.discharge_curves.mainvalues.q"), - true); + List<Facet> fs = new ArrayList<Facet>(); + facets.put(state.getID(), fs); + spawnState(); + super.setup(identifier, factory, context, callMeta, data); + String restriction = getDatacageIDValue(data); + logger.debug("mainvalue restriction " + restriction); + boolean restricted = restriction.endsWith("q") || restriction.endsWith("w"); + if (!restricted || restriction.endsWith("q")) { + Facet qfacet0 = new MainValuesQFacet( + DURATION_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + false); + Facet qfacet1 = new MainValuesQFacet( + COMPUTED_DISCHARGE_MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + false); + Facet qfacet2 = new MainValuesQFacet( + MAINVALUES_Q, + Resources.getMsg( + callMeta, + "facet.discharge_curves.mainvalues.q", + "facet.discharge_curves.mainvalues.q"), + true); + + fs.add(qfacet0); + fs.add(qfacet1); + fs.add(qfacet2); + } + if (!restricted || restriction.endsWith("w")) { Facet wfacet1 = new MainValuesWFacet( COMPUTED_DISCHARGE_MAINVALUES_W, Resources.getMsg( @@ -131,17 +145,9 @@ "facet.discharge_curves.mainvalues.w", "facet.discharge_curves.mainvalues.w"), true); - - List<Facet> fs = new ArrayList<Facet>(); - fs.add(qfacet0); - fs.add(qfacet1); - fs.add(qfacet2); - fs.add(wfacet1); - fs.add(wfacet2); - - facets.put(state.getID(), fs); - spawnState(); - super.setup(identifier, factory, context, callMeta, data); + fs.add(wfacet1); + fs.add(wfacet2); + } }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RiverAccess.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/RiverAccess.java Mon Oct 15 09:31:50 2012 +0200 @@ -4,13 +4,17 @@ import org.apache.log4j.Logger; +/** Access to river data of an artifact. */ public class RiverAccess extends Access { + /** Private logger. */ private static Logger log = Logger.getLogger(RiverAccess.class); + /** River name. */ protected String river; + public RiverAccess() { } @@ -18,6 +22,8 @@ super(artifact); } + + /** Get River name. */ public String getRiver() { if (river == null) { river = getString("river");
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTable.java Mon Oct 15 09:31:50 2012 +0200 @@ -1253,6 +1253,8 @@ return result; } + + /** Find ranges that are between km1 and km2 (inclusive?) */ public List<Range> findSegments(double km1, double km2) { return columns.length != 0 ? columns[columns.length-1].getQRangeTree().findSegments(km1, km2)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/extreme/ExtremeQInput.java Mon Oct 15 09:31:50 2012 +0200 @@ -0,0 +1,245 @@ +package de.intevation.flys.artifacts.states.extreme; + +import java.util.ArrayList; +import java.util.List; +import java.util.Comparator; +import java.util.Collections; + +import org.apache.log4j.Logger; + +import org.w3c.dom.Element; + +import de.intevation.artifacts.Artifact; +import de.intevation.artifacts.CallContext; + +import de.intevation.flys.artifacts.access.ExtremeAccess; + +import de.intevation.artifactdatabase.ProtocolUtils; +import de.intevation.artifactdatabase.data.StateData; + +import de.intevation.artifacts.common.utils.XMLUtils; + +import de.intevation.flys.artifacts.model.RiverFactory; +import de.intevation.flys.artifacts.model.WstValueTable; +import de.intevation.flys.model.Gauge; +import de.intevation.flys.artifacts.model.Range; +import de.intevation.flys.model.River; +import de.intevation.flys.model.Wst; + +import de.intevation.flys.artifacts.FLYSArtifact; + +import de.intevation.flys.artifacts.model.RangeWithValues; +import de.intevation.flys.artifacts.states.DefaultState; +import de.intevation.flys.artifacts.model.WstValueTableFactory; +import de.intevation.flys.utils.FLYSUtils; + + +/** TODO Subclass WQAdapted. */ + +/** + * State to input Q data in segments for extreme value calculations.. + * The data item ranges is expected to have this format <from1>;<to1>;<value1>:<from2>;<to2>;<value2>:... + * (;;;:;;;:;;;:...) + */ +public class ExtremeQInput extends DefaultState { + + /** The logger used in this state.*/ + private static Logger logger = Logger.getLogger(ExtremeQInput.class); + + + /** Trivial, empty constructor. */ + public ExtremeQInput() { + } + + + /** + * Create one element for each 'segment' of the selected river that + * is within the given kilometer range (TODO). Each element is a tuple of + * (from;to) where <i>from</i> is the lower bounds of the segment or the + * lower kilometer range. <i>to</i> is the upper bounds of the segment or + * the upper kilometer range. + * + * @param cr The ElementCreator. + * @param artifact The FLYS artifact. + * @param name The name of the data item. + * @param context The CallContext. + * + * @return a list of elements that consist of tuples of the intersected + * segments of the selected river. + */ + @Override + protected Element[] createItems( + XMLUtils.ElementCreator cr, + Artifact artifact, + String name, + CallContext context) + { + logger.debug("ExtremeQInput.createItems: " + name); + + FLYSArtifact flysArtifact = (FLYSArtifact) artifact; + + ExtremeAccess access = new ExtremeAccess(flysArtifact); + River river = RiverFactory.getRiver(access.getRiver()); + WstValueTable wstValueTable = WstValueTableFactory.getTable(river); + + List<Range> ranges = wstValueTable.findSegments(access.getFrom(), + access.getTo()); + + int num = ranges != null ? ranges.size() : 0; + + if (num == 0) { + logger.warn("Selected distance matches no segments."); + return null; + } + + List<Element> elements = new ArrayList<Element>(); + + for (Range range: ranges) { + elements.add(createItem( + cr, new String[] { range.getStart() + ";" + range.getEnd(), ""}, new double[] {0,100000})); + } + + Element[] els = new Element[elements.size()]; + + return elements.toArray(els); + } + + + /** Create sub-item ('row') of data thing. */ + protected Element createItem( + XMLUtils.ElementCreator cr, + Object obj, + double[] q + ) + { + Element item = ProtocolUtils.createArtNode(cr, "item", null, null); + Element label = ProtocolUtils.createArtNode(cr, "label", null, null); + Element value = ProtocolUtils.createArtNode(cr, "value", null, null); + + String[] arr = (String[]) obj; + + label.setTextContent(arr[0]); + value.setTextContent(arr[1]); + + item.appendChild(label); + item.appendChild(value); + + if (q != null) { + Element qRange = createRangeElement(cr, q, "Q"); + item.appendChild(qRange); + } + + return item; + } + + + /** + * Create elements to set min and max values of segments q (just min makes + * sense for extremes. + */ + protected Element createRangeElement( + XMLUtils.ElementCreator cr, + double[] mm, + String type) + { + Element range = ProtocolUtils.createArtNode( + cr, "range", + new String[] {"type"}, + new String[] {type}); + + Element min = ProtocolUtils.createArtNode(cr, "min", null, null); + min.setTextContent(String.valueOf(mm[0])); + + Element max = ProtocolUtils.createArtNode(cr, "max", null, null); + max.setTextContent(String.valueOf(mm[1])); + + range.appendChild(min); + range.appendChild(max); + + return range; + } + + + @Override + protected String getUIProvider() { + return "q_segmented_panel"; + } + + + /** Validate given data (return true). */ + @Override + public boolean validate(Artifact artifact) + throws IllegalArgumentException + { + logger.debug("ExtremeQInput.validate"); + + FLYSArtifact flys = (FLYSArtifact) artifact; + logger.debug("ExtremeQInput: " + getData(flys, "ranges")); + + /* + // TODO sort out what has to be validated (prevent negative values?). + RangeWithValues[] rwvs = extractInput(getData(flys, "ranges")); + + if (rwvs == null) { + throw new IllegalArgumentException("error_missing_wq_data"); + } + + List<Gauge> gauges = FLYSUtils.getGauges(flys); + River river = FLYSUtils.getRiver(flys); + Wst wst = WstFactory.getWst(river); + + for (Gauge gauge: gauges) { + Range range = gauge.getRange(); + double lower = range.getA().doubleValue(); + double upper = range.getB().doubleValue(); + + for (RangeWithValues rwv: rwvs) { + if (lower <= rwv.getStart() && upper >= rwv.getEnd()) { + compareQsWithGauge(wst, gauge, rwv.getValues()); + } + } + } + */ + + return true; + } + + + /** Form RangeWithValue-Array from state data. */ + protected RangeWithValues[] extractInput(StateData data) { + if (data == null) { + return null; + } + + String dataString = (String) data.getValue(); + String[] ranges = dataString.split(":"); + + List<RangeWithValues> rwv = new ArrayList<RangeWithValues>(); + + for (String range: ranges) { + String[] parts = range.split(";"); + + double lower = Double.parseDouble(parts[0]); + double upper = Double.parseDouble(parts[1]); + + String[] values = parts[2].split(","); + + int num = values.length; + double[] res = new double[num]; + + for (int i = 0; i < num; i++) { + try { + res[i] = Double.parseDouble(values[i]); + } + catch (NumberFormatException nfe) { + logger.warn(nfe, nfe); + } + } + + rwv.add(new RangeWithValues(lower, upper, res)); + } + + return rwv.toArray(new RangeWithValues[rwv.size()]); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :
--- a/flys-client/ChangeLog Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/ChangeLog Mon Oct 15 09:31:50 2012 +0200 @@ -1,3 +1,72 @@ +2012-10-15 Christian Lins <christian.lins@intevation.de> + + * 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/event/StepBackEvent.java, + flys-client/src/main/java/de/intevation/flys/client/client/event/StepForwardEvent.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/BooleanPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/ContinuePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DistanceOnlyPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTimeRangePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/LinkSelection.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/MultiPeriodPanel.java: + Squash warnings and TODOs. + +2012-10-14 Christian Lins <christian.lins@intevation.de> + + * 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/WspDatacagePanel.java: + Improve warning when user does not select a waterlevel calculation (#914). + +2012-10-14 Christian Lins <christian.lins@intevation.de> + + * flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java: + Fix for NPE that can occur when comparing Double with double. + +2012-10-14 Christian Lins <christian.lins@intevation.de> + + * flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java: + Fix for NPE in FLYSWorkspace.bringUp() (#933). + +2012-10-14 Christian Lins <christian.lins@intevation.de> + + * flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java, + flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java: + More fixes for #897: missing resource exceptions when handling other exceptions. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java: + Register new UI provider for Q input per segment. + +2012-10-12 Felix Wolfsteller <felix.wolfsteller@intevation.de> + + * flys-client/src/main/java/de/intevation/flys/client/client/ui/QSegmentedInputPanel.java: + New, initial GUI for Q input per segment. + 2012-10-12 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/GaugeTimeRangePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.java Mon Oct 15 09:31:50 2012 +0200 @@ -58,6 +58,10 @@ String warning_language(); + String warning_no_wsp_selected(); + + String warning_cannot_parse_date(); + String no_projects(); String load_projects();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants.properties Mon Oct 15 09:31:50 2012 +0200 @@ -331,7 +331,6 @@ error_no_feature_selected = No object selected. error_no_map_config = No Map configuration found. error_no_map_output_type = No Map output found. -warning_use_first_feature = You have more that one object selected. The first one is used. error_no_valid_gfi_url = No valid GetFeatureInfo response found. error_gfi_req_failed = GetFeatureInfo request failed. error_gfi_parsing_failed = Failed to read GetFeatureInfo response. @@ -350,6 +349,10 @@ error_values_needed = You must provide values. error_no_module_found = No modules found +warning_use_first_feature = You have more that one object selected. The first one is used. +warning_no_wsp_selected = No waterlevel selected! +warning_cannot_parse_date = Invalid date! + ## map related strings digitize = images/digitize.png pipe1 = Pipe1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_de.properties Mon Oct 15 09:31:50 2012 +0200 @@ -330,7 +330,6 @@ error_no_feature_selected = Kein Objekt ausgew\u00e4hlt. error_no_map_config = Es konnte keine Kartenkonfiguration gefunden werden. error_no_map_output_type = Es konnte kein Ausgabemodus f\u00fcr Karten gefunden werden. -warning_use_first_feature = Sie haben mehr als ein Objekt ausgew\u00e4hlt. Das erste Objekt wird benutzt. error_no_valid_gfi_url = Ung\u00fcltige GetFeatureInfo URL. error_gfi_req_failed = Die GetFeatureInfo Anfrage ist fehlgeschlagen. error_gfi_parsing_failed = Fehler beim Lesen der GetFeatureInfo Antwort. @@ -343,12 +342,16 @@ error_bad_dgm_river = Das gew\u00e4hlte DGM passt nicht zum gew\u00e4hlten Fluss. error_dialog_not_valid = Eine oder mehrere Daten sind nicht korrekt. error_invalid_date = Das eingegebene Datum ist nicht korrekt. -error_same_location = Der gewählte Ort ist der Bezugsort. +error_same_location = Der gew\u00e4hlte Ort ist der Bezugsort. error_contains_same_location = Zielorte beinhalten den Bezugsort. error_update_collection_attribute = Fehler beim Aktualisieren des Collection-Attributs. error_values_needed = Es muss mindestens ein Wert selektiert sein. error_no_module_found = Keine nutzbaren Module gefunden. +warning_use_first_feature = Sie haben mehr als ein Objekt ausgew\u00e4hlt. Das erste Objekt wird benutzt. +warning_no_wsp_selected = Kein Wasserstand ausgew\u00e4hlt! +warning_cannot_parse_date = Datum ist ung\u00fcltig! + ## map related strings digitize = images/digitize.png pipe1 = Rohr1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/FLYSConstants_en.properties Mon Oct 15 09:31:50 2012 +0200 @@ -331,7 +331,6 @@ error_no_feature_selected = No object selected. error_no_map_config = No Map configuration found. error_no_map_output_type = No Map output found. -warning_use_first_feature = You have more that one object selected. The first one is used. error_no_valid_gfi_url = No valid GetFeatureInfo response found. error_gfi_req_failed = GetFeatureInfo request failed. error_gfi_parsing_failed = Failed to read GetFeatureInfo response. @@ -350,6 +349,10 @@ error_values_needed = You must provide values. error_no_module_found = No modules found +warning_use_first_feature = You have more that one object selected. The first one is used. +warning_no_wsp_selected = No waterlevel selected! +warning_cannot_parse_date = Date is invalid! + ## map related strings digitize = images/digitize.png pipe1 = Pipe1
--- a/flys-client/src/main/java/de/intevation/flys/client/client/event/StepBackEvent.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/event/StepBackEvent.java Mon Oct 15 09:31:50 2012 +0200 @@ -8,6 +8,8 @@ */ public class StepBackEvent implements Serializable { + private static final long serialVersionUID = 7895180143662002198L; + /** The identifier of the target state.*/ protected String target;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/event/StepForwardEvent.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/event/StepForwardEvent.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,15 +1,17 @@ package de.intevation.flys.client.client.event; +import de.intevation.flys.client.shared.model.Data; + import java.io.Serializable; -import de.intevation.flys.client.shared.model.Data; - /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class StepForwardEvent implements Serializable { + private static final long serialVersionUID = -5527511690213770954L; + /** The selected data.*/ protected Data[] data;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AbstractUIProvider.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,6 +1,7 @@ package de.intevation.flys.client.client.ui; import com.google.gwt.core.client.GWT; + import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; @@ -38,6 +39,8 @@ implements UIProvider, HasStepForwardHandlers, ClickHandler, HasStepBackHandlers { + private static final long serialVersionUID = -1610874613377494184L; + /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/AutoIntegerPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -4,21 +4,22 @@ import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.form.validator.CustomValidator; import com.smartgwt.client.widgets.form.validator.Validator; -import com.smartgwt.client.widgets.form.validator.CustomValidator; import com.smartgwt.client.widgets.layout.VLayout; +import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.client.FLYSConstants; - /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class AutoIntegerPanel extends TextProvider { + private static final long serialVersionUID = -6525461829035465820L; + public static final String FIELD_NAME = "integer_field"; public static final String FIELD_DEFAULT_VALUE = "auto"; @@ -106,8 +107,7 @@ } try { - Integer anInt = Integer.parseInt(v); - + Integer.parseInt(v); return true; } catch (NumberFormatException nfe) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/BooleanPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/BooleanPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -14,6 +14,8 @@ */ public class BooleanPanel extends TextProvider { + private static final long serialVersionUID = -8448442865635399232L; + public static final String FIELD_NAME = "boolean_field"; public static final int TITLE_WIDTH = 0;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/CollectionView.java Mon Oct 15 09:31:50 2012 +0200 @@ -2,6 +2,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.VerticalAlignment; import com.smartgwt.client.util.SC; @@ -262,7 +263,7 @@ @Override public void onFailure(Throwable caught) { GWT.log("Could not create the new collection."); - SC.warn(messages.getString(caught.getMessage())); + SC.warn(FLYS.getExceptionString(messages, caught)); } @Override @@ -441,7 +442,7 @@ @Override public void onFailure(Throwable caught) { GWT.log("Could not DESCRIBE collection."); - SC.warn(messages.getString(caught.getMessage())); + SC.warn(FLYS.getExceptionString(messages, caught)); } @@ -664,7 +665,7 @@ @Override public void onFailure(Throwable caught) { GWT.log("An error occured while adding artifact."); - SC.warn(messages.getString(caught.getMessage())); + SC.warn(FLYS.getExceptionString(messages, caught)); } @Override @@ -692,7 +693,7 @@ setCollection(collection); GWT.log("An error occured while saving recommendations."); - // TODO POPUP WARNING + SC.warn(FLYS.getExceptionString(messages, caught)); } @Override @@ -742,6 +743,7 @@ public void onFailure(Throwable caught) { GWT.log("Error loading recommendations: " + caught.getMessage()); + SC.warn(FLYS.getExceptionString(messages, caught)); } @Override
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ContinuePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ContinuePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,8 +1,5 @@ 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; @@ -11,12 +8,14 @@ import com.smartgwt.client.widgets.form.fields.events.ClickEvent; import com.smartgwt.client.widgets.form.fields.events.ClickHandler; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.AdvanceHandler; import de.intevation.flys.client.shared.model.ArtifactDescription; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.event.AdvanceHandler; +import java.util.ArrayList; +import java.util.List; /** @@ -24,6 +23,8 @@ */ public class ContinuePanel extends AbstractUIProvider { + private static final long serialVersionUID = -5882814816875137397L; + protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); protected List<AdvanceHandler> advHandlers; @@ -43,6 +44,7 @@ final String[] reachable = desc.getReachableStates(); next.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent e) { fireOnAdvance(reachable[0]); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacagePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,8 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; - import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.layout.VLayout; @@ -11,12 +8,17 @@ import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.User; +import java.util.ArrayList; +import java.util.List; + /** * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public abstract class DatacagePanel extends TextProvider { + private static final long serialVersionUID = 6937994648371673222L; + protected String dataName; protected User user;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageTwinPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,45 +1,41 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Set; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.data.Record; import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.widgets.Canvas; -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.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; -import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickHandler; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.StepForwardEvent; +import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; +import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; +import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; -import de.intevation.flys.client.shared.model.DataList; -import de.intevation.flys.client.shared.model.User; - -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.event.StepForwardEvent; import de.intevation.flys.client.shared.model.Recommendation; import de.intevation.flys.client.shared.model.Recommendation.Facet; import de.intevation.flys.client.shared.model.Recommendation.Filter; +import de.intevation.flys.client.shared.model.User; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.services.LoadArtifactService; -import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; -import de.intevation.flys.client.client.services.RemoveArtifactService; -import de.intevation.flys.client.client.services.RemoveArtifactServiceAsync; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; // TODO Probably better to branch off AbstractUIProvider. // TODO Merge with other datacage-widget impls. @@ -50,6 +46,8 @@ public class DatacageTwinPanel extends TextProvider { + private static final long serialVersionUID = 8906629596491827857L; + protected static FLYSConstants MSG = GWT.create(FLYSConstants.class); protected String dataName; @@ -247,6 +245,7 @@ capitalField, removeField}); differencesList.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(final RecordClickEvent event) { // Just handle remove-clicks if(!event.getField().getName().equals(removeField.getName())) { @@ -370,9 +369,11 @@ uuid, locale, new AsyncCallback<Collection>() { + @Override public void onFailure(Throwable caught) { GWT.log("RemoveArtifact (" + uuid + ") failed."); } + @Override public void onSuccess(Collection collection) { GWT.log("RemoveArtifact succeeded"); } @@ -387,9 +388,11 @@ null, locale, new AsyncCallback<Artifact[]>() { + @Override public void onFailure(Throwable caught) { GWT.log("Failure of cloning with factories!"); } + @Override public void onSuccess(Artifact[] artifacts) { GWT.log("Successfully cloned " + toClone.length + " with factories.");
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DatacageWidget.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,48 +1,35 @@ package de.intevation.flys.client.client.ui; -import de.intevation.flys.client.client.event.DatacageHandler; -import de.intevation.flys.client.client.event.DatacageDoubleClickHandler; - import com.google.gwt.core.client.GWT; - import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.SelectionStyle; +import com.smartgwt.client.types.TreeModelType; import com.smartgwt.client.util.SC; - import com.smartgwt.client.widgets.Button; - +import com.smartgwt.client.widgets.events.ClickEvent; +import com.smartgwt.client.widgets.events.ClickHandler; +import com.smartgwt.client.widgets.grid.HoverCustomizer; +import com.smartgwt.client.widgets.grid.ListGridRecord; +import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent; +import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler; +import com.smartgwt.client.widgets.layout.VLayout; import com.smartgwt.client.widgets.tree.Tree; import com.smartgwt.client.widgets.tree.TreeGrid; import com.smartgwt.client.widgets.tree.TreeNode; -import com.smartgwt.client.types.SelectionStyle; -import com.smartgwt.client.types.TreeModelType; - -import com.smartgwt.client.widgets.layout.VLayout; - -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.events.ClickEvent; - -import com.smartgwt.client.widgets.grid.ListGridRecord; - -import com.smartgwt.client.widgets.grid.events.RecordDoubleClickEvent; -import com.smartgwt.client.widgets.grid.events.RecordDoubleClickHandler; - -import com.smartgwt.client.widgets.grid.HoverCustomizer; - -import de.intevation.flys.client.shared.model.Artifact; -import de.intevation.flys.client.shared.model.User; -import de.intevation.flys.client.shared.model.ToLoad; - +import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.Config; - +import de.intevation.flys.client.client.event.DatacageDoubleClickHandler; +import de.intevation.flys.client.client.event.DatacageHandler; import de.intevation.flys.client.client.services.MetaDataService; import de.intevation.flys.client.client.services.MetaDataServiceAsync; - +import de.intevation.flys.client.shared.model.Artifact; +import de.intevation.flys.client.shared.model.AttrList; +import de.intevation.flys.client.shared.model.DataCageNode; import de.intevation.flys.client.shared.model.DataCageTree; -import de.intevation.flys.client.shared.model.DataCageNode; -import de.intevation.flys.client.shared.model.AttrList; +import de.intevation.flys.client.shared.model.ToLoad; +import de.intevation.flys.client.shared.model.User; import java.util.ArrayList; import java.util.List; @@ -259,7 +246,7 @@ return toLoad; } - ListGridRecord [] selection = treeGrid.getSelection(); + ListGridRecord [] selection = treeGrid.getSelectedRecords(); if (selection != null) { for (ListGridRecord record: selection) { @@ -281,7 +268,7 @@ return new String[] {}; } - ListGridRecord [] selection = treeGrid.getSelection(); + ListGridRecord [] selection = treeGrid.getSelectedRecords(); if (selection == null) { return new String[] {}; @@ -401,11 +388,13 @@ outs, parameters, new AsyncCallback<DataCageTree>() { + @Override public void onFailure(Throwable caught) { GWT.log("Could not load meta data."); SC.warn(caught.getMessage()); } + @Override public void onSuccess(DataCageTree dcTree) { GWT.log("Successfully loaded meta data."); IdGenerator idGenerator = new IdGenerator();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DemDatacagePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,8 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DefaultData; @@ -11,9 +8,14 @@ import de.intevation.flys.client.shared.model.ToLoad; import de.intevation.flys.client.shared.model.User; +import java.util.ArrayList; +import java.util.List; + public class DemDatacagePanel extends DatacagePanel { + private static final long serialVersionUID = -2301633938080411687L; + public static final String OUT = "floodmap"; public static final String PARAMETERS = "dem:true";
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DigitizePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -50,6 +50,8 @@ extends SelectProvider implements TabSelectedHandler, VisibilityChangedHandler { + private static final long serialVersionUID = 3529775660871273314L; + protected MapInfoServiceAsync mapInfo = GWT.create(MapInfoService.class); protected FloodMap floodMap; @@ -132,7 +134,7 @@ layout.setAlign(VerticalAlignment.TOP); layout.setHeight(25); - LinkedHashMap initial = new LinkedHashMap(); + LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); form = new DynamicForm(); @@ -286,7 +288,6 @@ params.setIsTransparent(!x); WMSOptions opts = new WMSOptions(); - opts.setTransitionEffect("null"); opts.setProjection(proj); opts.setSingleTile(true); opts.setRatio(1);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistanceOnlyPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistanceOnlyPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,14 +1,17 @@ package de.intevation.flys.client.client.ui; -import java.util.List; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; +import java.util.List; + public class DistanceOnlyPanel extends DistancePanel { + private static final long serialVersionUID = -5794138573892656947L; + + public DistanceOnlyPanel() { this("right"); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DistancePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,39 +1,42 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; -import java.util.LinkedHashMap; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; +import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.Criterion; -import com.smartgwt.client.data.AdvancedCriteria; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.types.Alignment; import com.smartgwt.client.types.OperatorId; - -import com.smartgwt.client.data.Record; import com.smartgwt.client.util.SC; -import com.smartgwt.client.types.Alignment; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.StaticTextItem; -import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; -import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; +import com.smartgwt.client.widgets.form.fields.events.BlurEvent; import com.smartgwt.client.widgets.form.fields.events.BlurHandler; -import com.smartgwt.client.widgets.form.fields.events.BlurEvent; +import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; +import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; +import com.smartgwt.client.widgets.grid.ListGrid; +import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickHandler; -import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.tab.TabSet; import com.smartgwt.client.widgets.tab.Tab; +import com.smartgwt.client.widgets.tab.TabSet; +import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; -import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.FilterHandler; +import de.intevation.flys.client.client.event.RangeFilterEvent; +import de.intevation.flys.client.client.event.StringFilterEvent; +import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; +import de.intevation.flys.client.client.ui.range.LocationsTable; +import de.intevation.flys.client.client.ui.range.RangeTable; import de.intevation.flys.client.shared.model.ArtifactDescription; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; @@ -41,19 +44,16 @@ import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; -import de.intevation.flys.client.client.ui.range.RangeTable; -import de.intevation.flys.client.client.ui.range.LocationsTable; -import de.intevation.flys.client.client.event.FilterHandler; -import de.intevation.flys.client.client.event.StringFilterEvent; -import de.intevation.flys.client.client.event.RangeFilterEvent; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; public class DistancePanel extends AbstractUIProvider implements BlurHandler, FilterHandler { + private static final long serialVersionUID = -883142387908664588L; + public static final int DEFAULT_STEP_WIDTH = 100; public static final String FIELD_LOWER = "ld_from"; @@ -93,8 +93,6 @@ @Override public Canvas create(DataList data) { - Data d = data.get(0); - VLayout layout = new VLayout(); layout.setMembersMargin(10); @@ -412,7 +410,7 @@ protected double getDefaultStep() { - return (double) DEFAULT_STEP_WIDTH; + return DEFAULT_STEP_WIDTH; } @@ -442,6 +440,7 @@ url, river, "locations")); distancesTable.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(RecordClickEvent e) { Record r = e.getRecord(); @@ -459,6 +458,7 @@ }); locationsTable.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(RecordClickEvent e) { Record r = e.getRecord(); int field = e.getFieldNum(); @@ -511,6 +511,7 @@ filterCriteria.setShowTitle(false); filterCriteria.setWidth(100); filterCriteria.addChangedHandler(new ChangedHandler() { + @Override public void onChanged(ChangedEvent e) { if(e.getValue().toString().equals("range")) { filterRange.setVisible(true); @@ -544,6 +545,7 @@ filterLayout.addMember(filterRange); filterLayout.setHeight(30); tabs.addTabSelectedHandler(new TabSelectedHandler() { + @Override public void onTabSelected(TabSelectedEvent evt) { filterDescription.clear(); filterRange.clear(); @@ -562,6 +564,7 @@ } + @Override public void onFilterCriteriaChanged(StringFilterEvent event) { String search = event.getFilter(); @@ -579,6 +582,7 @@ } + @Override public void onFilterCriteriaChanged(RangeFilterEvent event) { Float from = event.getFrom() - 0.001f; Float to = event.getTo() + 0.001f;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleArrayPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,7 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.Map; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; @@ -14,6 +12,8 @@ import de.intevation.flys.client.client.FLYSConstants; +import java.util.Map; + public class DoubleArrayPanel extends DynamicForm { @@ -156,6 +156,7 @@ * * @param item The FormItem. */ + @SuppressWarnings("unchecked") protected boolean validateForm(FormItem item) { if (item instanceof StaticTextItem) { return true; @@ -174,8 +175,9 @@ return valid; } - NumberFormat f = NumberFormat.getDecimalFormat(); - Map errors = getErrors(); + NumberFormat nf = NumberFormat.getDecimalFormat(); + @SuppressWarnings("rawtypes") + Map errors = getErrors(); try { for (String part: parts) { @@ -184,7 +186,7 @@ continue; } - double location = f.parse(part); + nf.parse(part); } errors.remove(item.getFieldName());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleInputPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,10 +1,8 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; + import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; @@ -20,6 +18,9 @@ import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; +import java.util.ArrayList; +import java.util.List; + /** * This UIProvider creates a panel for location or distance input. * @@ -28,6 +29,9 @@ public class DoubleInputPanel extends AbstractUIProvider { + + private static final long serialVersionUID = 2006773072352563622L; + /** The message class that provides i18n strings. */ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -40,6 +44,7 @@ } + @Override public Canvas create(DataList list) { VLayout layout = new VLayout(); @@ -120,6 +125,7 @@ * * @return the selected/inserted data. */ + @Override public Data[] getData() { List<Data> data = new ArrayList<Data>();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,7 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.Map; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; @@ -14,6 +12,7 @@ import de.intevation.flys.client.client.FLYSConstants; +import java.util.Map; /** @@ -166,6 +165,7 @@ * * @param item The FormItem. */ + @SuppressWarnings("unchecked") protected boolean validateForm(FormItem item) { if (item instanceof StaticTextItem) { return true; @@ -176,6 +176,7 @@ String v = (String) item.getValue(); NumberFormat f = NumberFormat.getDecimalFormat(); + @SuppressWarnings("rawtypes") Map errors = getErrors(); try { @@ -183,7 +184,7 @@ throw new NumberFormatException("empty"); } - double value = f.parse(v); + f.parse(v); errors.remove(item.getFieldName()); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/FLYSWorkspace.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,5 +1,7 @@ package de.intevation.flys.client.client.ui; +import com.google.gwt.core.client.GWT; + import com.smartgwt.client.widgets.Canvas; import java.util.HashMap; @@ -59,8 +61,13 @@ public void bringUp(String uuid) { CollectionView view = views.get(uuid); - view.show(); - view.restore(); + if (view != null) { + view.show(); + view.restore(); + } + else { + GWT.log("FLYSWorkspace.bringUp() failed!"); + } }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -21,7 +21,7 @@ import de.intevation.flys.client.shared.model.RiverInfo; /** - * The GaugePanel is intendet to be used within a SectionStackSection + * The GaugePanel is intended to be used within a SectionStackSection * It extends the VLayout by two methods to show and hide the * section stack section. * @@ -38,8 +38,6 @@ /** The message class that provides i18n strings.*/ protected FLYSConstants MSG = GWT.create(FLYSConstants.class); - private FLYS flys; - protected GaugeOverviewInfoServiceAsync gaugeOverviewInfoService = GWT.create(GaugeOverviewInfoService.class); @@ -86,10 +84,12 @@ */ public void refresh() { gaugeOverviewInfoService.getRiverInfo(this.river, new AsyncCallback<RiverInfo>() { + @Override public void onFailure(Throwable e) { GWT.log("Could not load the river info." + e); } + @Override public void onSuccess(RiverInfo riverinfo) { GWT.log("Loaded river info"); renderGaugeOverviewInfo(riverinfo); @@ -128,6 +128,7 @@ /** * Hide the section stack section. */ + @Override public void hide() { GWT.log("GaugePanel - hide"); this.sectionStack.setHidden(true); @@ -136,6 +137,7 @@ /** * Show the section stack section. */ + @Override public void show() { GWT.log("GaugePanel - show"); this.sectionStack.setHidden(false);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTimeRangePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTimeRangePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,13 +1,11 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.DateTimeFormat; + import com.smartgwt.client.data.Record; import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; @@ -31,11 +29,17 @@ import de.intevation.flys.client.shared.model.LongRangeData; import de.intevation.flys.client.shared.model.RangeData; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a> */ public class GaugeTimeRangePanel extends RangePanel { + private static final long serialVersionUID = -157571967010594739L; + /** The message class that provides i18n strings. */ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); @@ -72,7 +76,6 @@ this.maxLower = maxLower; } - public Canvas create(DataList data) { setDataName(data); @@ -126,6 +129,8 @@ Date dl = new Date((Long)((LongRangeData)data).getLower()); Date du = new Date((Long)((LongRangeData)data).getUpper()); + + @SuppressWarnings("deprecation") DateTimeFormat dtf = DateTimeFormat.getMediumDateFormat(); Label value = new Label(dtf.format(dl) + " - " + dtf.format(du)); value.setHeight(20); @@ -196,7 +201,7 @@ } catch (NumberFormatException nfe) { GWT.log("could not parse lower date."); - //TODO: Messagebox with error. + SC.warn(MESSAGES.warning_cannot_parse_date()); } } @@ -209,7 +214,7 @@ } catch (NumberFormatException nfe) { GWT.log("could not parse upper date."); - //TODO: Messagebox with error. + SC.warn(MESSAGES.warning_cannot_parse_date()); } } @@ -221,6 +226,7 @@ long value = Long.valueOf(raw); Date date = new Date(value); + @SuppressWarnings("deprecation") DateTimeFormat dtf = DateTimeFormat.getMediumDateFormat(); return dtf.format(date); @@ -238,6 +244,7 @@ yearTable.setCanReorderFields(false); CellFormatter cf = new CellFormatter() { + @Override public String format( Object value, ListGridRecord record, @@ -264,6 +271,7 @@ addstart.setWidth (20); addstart.setCellIcon(baseUrl + MESSAGES.markerGreen()); addstart.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(RecordClickEvent e) { Record r = e.getRecord(); if (r.getAttribute("start").equals("-1")) { @@ -280,6 +288,7 @@ addend.setWidth (20); addend.setCellIcon(baseUrl + MESSAGES.markerRed()); addend.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(RecordClickEvent e) { Record r = e.getRecord(); if (r.getAttribute("end").equals("-1")) {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,9 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; -import java.util.Iterator; - import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; @@ -20,13 +16,16 @@ import de.intevation.flys.client.client.FLYS; import de.intevation.flys.client.client.FLYSConstants; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.GaugeInfo; import de.intevation.flys.client.shared.model.RiverInfo; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + public class GaugeTree extends ScrollPanel { @@ -276,12 +275,16 @@ } } else { - GWT.log("GaugeTree - openOnDistance gitem " + gitem.getStart() + " " + gitem.getEnd()); - if ((start >= gitem.getStart() && start <= gitem.getEnd()) || - (end >= gitem.getStart() && end <= gitem.getEnd()) || - (start <= gitem.getStart() && end >= gitem.getEnd())) { - setstate = true; - } + // as getStart()/getEnd() return Double objects, they can be null and + // can cause NPEs when comparing with double... strange... + if (gitem.getStart() != null && gitem.getEnd() != null) { + GWT.log("GaugeTree - openOnDistance gitem " + gitem.getStart() + " " + gitem.getEnd()); + if ((start >= gitem.getStart() && start <= gitem.getEnd()) || + (end >= gitem.getStart() && end <= gitem.getEnd()) || + (start <= gitem.getStart() && end >= gitem.getEnd())) { + setstate = true; + } + } } item.setState(setstate); } @@ -413,6 +416,7 @@ addClickHandler(this); } + @Override public void onClick(ClickEvent ev) { GWT.log("GaugeCurveAnchor - onClick " + gauge.getRiverName() + " " + gauge.getOfficialNumber());
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/IntegerRangePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -12,6 +12,8 @@ public class IntegerRangePanel extends RangePanel { + private static final long serialVersionUID = -7471199535764887461L; + protected Integer maxLower; protected Integer maxUpper;
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LinkSelection.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LinkSelection.java Mon Oct 15 09:31:50 2012 +0200 @@ -30,6 +30,9 @@ public class LinkSelection extends MapSelection { + + private static final long serialVersionUID = -7138270638349711024L; + /** The message class that provides i18n strings.*/ protected FLYSConstants messages = GWT.create(FLYSConstants.class);
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LoadingPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,8 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -30,9 +27,14 @@ import de.intevation.flys.client.shared.model.CalculationMessage; import de.intevation.flys.client.shared.model.DataList; +import java.util.ArrayList; +import java.util.List; + public class LoadingPanel extends Canvas implements HasStepBackHandlers { + private static final long serialVersionUID = -7806425431408987601L; + public static final int UPDATE_INTERVAL = 1000 * 3; public static final DescribeArtifactServiceAsync describe = @@ -197,12 +199,14 @@ final String locale = config.getLocale(); describe.describe(locale, artifact, new AsyncCallback<Artifact>() { + @Override public void onFailure(Throwable t) { GWT.log("Error while DESCRIBE artifact: " + t.getMessage()); startTimer(); } + @Override public void onSuccess(Artifact artifact) { GWT.log("Successfully DESCRIBE artifact.");
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,67 +1,62 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; +import com.smartgwt.client.data.AdvancedCriteria; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.Criterion; -import com.smartgwt.client.data.AdvancedCriteria; +import com.smartgwt.client.data.Record; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.types.OperatorId; - import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.form.fields.FormItem; +import com.smartgwt.client.widgets.form.fields.RadioGroupItem; +import com.smartgwt.client.widgets.form.fields.SelectItem; +import com.smartgwt.client.widgets.form.fields.StaticTextItem; import com.smartgwt.client.widgets.form.fields.events.BlurEvent; +import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; -import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; -import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; import com.smartgwt.client.widgets.form.fields.events.ChangedEvent; - -import com.smartgwt.client.widgets.form.fields.FormItem; -import com.smartgwt.client.widgets.form.fields.SelectItem; -import com.smartgwt.client.widgets.form.fields.RadioGroupItem; -import com.smartgwt.client.widgets.form.fields.StaticTextItem; -import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.form.fields.events.ChangedHandler; +import com.smartgwt.client.widgets.grid.CellFormatter; 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.grid.CellFormatter; -import com.smartgwt.client.widgets.grid.events.RecordClickHandler; +import com.smartgwt.client.widgets.grid.events.CellClickEvent; +import com.smartgwt.client.widgets.grid.events.CellClickHandler; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; -import com.smartgwt.client.widgets.grid.events.CellClickHandler; -import com.smartgwt.client.widgets.grid.events.CellClickEvent; -import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; +import com.smartgwt.client.widgets.grid.events.RecordClickHandler; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.tab.Tab; +import com.smartgwt.client.widgets.tab.TabSet; import com.smartgwt.client.widgets.tab.events.TabSelectedEvent; +import com.smartgwt.client.widgets.tab.events.TabSelectedHandler; -import com.smartgwt.client.widgets.tab.TabSet; -import com.smartgwt.client.widgets.tab.Tab; -import com.smartgwt.client.data.Record; - -import com.smartgwt.client.types.ListGridFieldType; -import com.smartgwt.client.types.Alignment; - +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.FilterHandler; +import de.intevation.flys.client.client.event.RangeFilterEvent; +import de.intevation.flys.client.client.event.StringFilterEvent; +import de.intevation.flys.client.client.services.DistanceInfoService; +import de.intevation.flys.client.client.services.DistanceInfoServiceAsync; +import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; +import de.intevation.flys.client.shared.model.ArtifactDescription; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; import de.intevation.flys.client.shared.model.DistanceInfoObject; -import de.intevation.flys.client.shared.model.ArtifactDescription; -import de.intevation.flys.client.client.services.DistanceInfoService; -import de.intevation.flys.client.client.services.DistanceInfoServiceAsync; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.event.FilterHandler; -import de.intevation.flys.client.client.event.StringFilterEvent; -import de.intevation.flys.client.client.event.RangeFilterEvent; -import de.intevation.flys.client.client.ui.range.DistanceInfoDataSource; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; /** @@ -73,6 +68,8 @@ extends AbstractUIProvider implements ChangeHandler, BlurHandler, FilterHandler { + private static final long serialVersionUID = -10820092176039372L; + /** The message class that provides i18n strings. */ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); @@ -183,6 +180,7 @@ * * @return a panel. */ + @Override public Canvas create(DataList data) { VLayout layout = new VLayout(); layout.setMembersMargin(10); @@ -224,6 +222,7 @@ distanceTable.setCanReorderFields(false); CellFormatter cf = new CellFormatter() { + @Override public String format( Object value, ListGridRecord record, @@ -245,6 +244,7 @@ addDistance.setType (ListGridFieldType.ICON); addDistance.setWidth (20); addDistance.addRecordClickHandler (new RecordClickHandler () { + @Override public void onRecordClick (RecordClickEvent e) { if (!isLocationMode ()) { Record r = e.getRecord(); @@ -339,6 +339,7 @@ locationsTable.setCanReorderFields(false); CellFormatter cf = new CellFormatter() { + @Override public String format( Object value, ListGridRecord record, @@ -363,6 +364,7 @@ addLocation.setWidth (20); addLocation.addRecordClickHandler (new RecordClickHandler () { + @Override public void onRecordClick (RecordClickEvent e) { Record record = e.getRecord(); double[] selected; @@ -435,6 +437,7 @@ locationDistanceTable.setCanReorderFields(false); CellFormatter cf = new CellFormatter() { + @Override public String format( Object value, ListGridRecord record, @@ -463,6 +466,7 @@ addto2.setCellIcon(baseUrl + MESSAGES.markerRed()); locationDistanceTable.addCellClickHandler (new CellClickHandler () { + @Override public void onCellClick (CellClickEvent e) { if (e.getColNum() == 0) { Record r = e.getRecord (); @@ -521,6 +525,7 @@ } + @Override public Canvas createOld(DataList dataList) { List<Data> items = dataList.getAll(); @@ -705,6 +710,7 @@ inputTables = new TabSet(); inputTables.addTabSelectedHandler(new TabSelectedHandler() { + @Override public void onTabSelected(TabSelectedEvent evt) { filterDescription.clear(); filterRange.clear(); @@ -746,6 +752,7 @@ filterCriteria.setShowTitle(false); filterCriteria.setWidth(100); filterCriteria.addChangedHandler(new ChangedHandler() { + @Override public void onChanged(ChangedEvent e) { if(e.getValue().toString().equals("range")) { filterRange.setVisible(true); @@ -795,6 +802,7 @@ } + @Override public void onFilterCriteriaChanged(StringFilterEvent event) { String search = event.getFilter(); @@ -815,6 +823,7 @@ } + @Override public void onFilterCriteriaChanged(RangeFilterEvent event) { Float from = event.getFrom() - 0.001f; Float to = event.getTo() + 0.001f; @@ -974,10 +983,11 @@ * * @return the selected/inserted data. */ + @Override public Data[] getData() { List<Data> data = new ArrayList<Data>(); - // XXX If we have entered a value and click right afterwards on the + // If we have entered a value and click right afterwards on the // 'next' button, the BlurEvent is not fired, and the values are not // saved. So, we gonna save those values explicitly. if (isLocationMode()) { @@ -1158,6 +1168,7 @@ * * @param event The click event fired by a RadioButtonGroupItem. */ + @Override public void onChange(ChangeEvent event) { String value = (String) event.getValue(); @@ -1211,6 +1222,7 @@ * @param event The BlurEvent that gives information about the FormItem that * has been modified and its value. */ + @Override public void onBlur(BlurEvent event) { FormItem item = event.getItem(); String field = item.getFieldName(); @@ -1305,11 +1317,11 @@ radio.setVertical(false); radio.setWrap(false); - LinkedHashMap values = new LinkedHashMap(); + LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); values.put(FIELD_VALUE_LOCATION, MESSAGES.location()); values.put(FIELD_VALUE_DISTANCE, MESSAGES.distance()); - LinkedHashMap initial = new LinkedHashMap(); + LinkedHashMap<String, String> initial = new LinkedHashMap<String, String>(); initial.put(FIELD_MODE, FIELD_VALUE_DISTANCE); radio.setValueMap(values); @@ -1325,7 +1337,6 @@ protected void createDistanceInputPanel() { Config config = Config.getInstance(); String url = config.getServerUrl(); - String locale = config.getLocale (); String river = ""; ArtifactDescription adescr = artifact.getArtifactDescription(); @@ -1355,21 +1366,6 @@ } -/* protected void updateDistanceInfo(DistanceInfoObject[] di) { - int i = 0; - for (DistanceInfoObject dio: di) { - if (dio.getTo() != null) { - distanceTable.addData(new DistanceInfoRecord(dio)); - } - else { - locationsTable.addData(new DistanceInfoRecord(dio)); - locationDistanceTable.addData(new DistanceInfoRecord(dio)); - } - } - return; - }*/ - - protected double getFrom() { return from; }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,34 +1,34 @@ package de.intevation.flys.client.client.ui; -import java.util.ArrayList; -import java.util.List; - +import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.NumberFormat; +import com.smartgwt.client.data.Record; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.form.fields.FormItem; import com.smartgwt.client.widgets.form.fields.events.BlurEvent; -import com.smartgwt.client.widgets.form.fields.FormItem; - +import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.grid.events.RecordClickEvent; - -import com.smartgwt.client.data.Record; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; +import java.util.ArrayList; +import java.util.List; + /** * This UIProvider serves as base for UI Providers to enter a single location (km). */ public abstract class LocationPanel extends AbstractUIProvider { + private static final long serialVersionUID = -5306604428440015046L; + /** A container that will contain the location or the distance panel. */ protected HLayout inputLayout; @@ -106,6 +106,7 @@ * This method creates a Canvas element showing the old Data objects in the * DataList <i>data</i>. */ + @Override public Canvas createOld(DataList dataList) { findDataItemName(dataList); @@ -142,40 +143,18 @@ protected void initDefaults(DataList list) { Data data = list.get(0); - /* - // Compatibility with MinMax- DataItems: - RangeData rangeData = null; - - for (int i = 0, n = list.size(); i < n; i++) { - Data tmp = list.get(i); + DataItem[] items = data.getItems(); + DataItem iMin = getDataItem(items, "min"); + DataItem iMax = getDataItem(items, "max"); - if (tmp instanceof RangeData) { - rangeData = (RangeData) tmp; - } - } - - if (rangeData != null) { - min = Double.parseDouble(rangeData.getDefaultLower().toString()); - max = Double.parseDouble(rangeData.getDefaultUpper().toString()); - // catch ..? + try { + min = Double.parseDouble(iMin.getStringValue()); + max = Double.parseDouble(iMax.getStringValue()); } - */ - - if (false) {} - else { - DataItem[] items = data.getItems(); - DataItem iMin = getDataItem(items, "min"); - DataItem iMax = getDataItem(items, "max"); - - try { - min = Double.parseDouble(iMin.getStringValue()); - max = Double.parseDouble(iMax.getStringValue()); - } - catch (NumberFormatException nfe) { - SC.warn(MSG.error_read_minmax_values()); - min = -Double.MAX_VALUE; - max = Double.MAX_VALUE; - } + catch (NumberFormatException nfe) { + SC.warn(MSG.error_read_minmax_values()); + min = -Double.MAX_VALUE; + max = Double.MAX_VALUE; } DataItem def = data.getDefault(); @@ -186,7 +165,8 @@ setLocationValues(new double[] { d } ); } catch (NumberFormatException nfe) { - // could not parse, dont know what to do else + // could not parse, don't know what else to do + GWT.log("LocationPanel", nfe); } } @@ -220,7 +200,8 @@ locationPanel = new DoubleArrayPanel( MSG.unitLocation(), getLocationValues(), - new BlurHandler(){public void onBlur(BlurEvent be) {}}); + new BlurHandler(){@Override + public void onBlur(BlurEvent be) {}}); // TODO Remove picker references, refactor such that subclasses can // easily use their picker if they want. @@ -284,29 +265,6 @@ } - - /** - * This method returns the selected data. - * - * @return the selected/inserted data. - // TODO we are abstract because of this. Refactor to use DATA_NAME and - // similar fields for ld_mode . - public Data[] getData() { - saveLocationValues(locationPanel); - double[] values = getLocationValues(); - Data[] data = new Data[values.length+1]; - - for (int i = 0; i < values.length; i++) { - data[i] = createDataArray(DATA_ITEM_NAME, - Double.valueOf(values[i]).toString()); - } - data[values.length] = createDataArray("ld_mode", "locations"); - - return data; - } - */ - - /** * Validates and stores all values entered in the location mode. * @@ -362,7 +320,7 @@ Double.parseDouble(record.getAttribute("from")); } catch(NumberFormatException nfe) { - // Is there anything else to do here? + GWT.log("onRecordClick", nfe); } setLocationValues(selected); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MapSelection.java Mon Oct 15 09:31:50 2012 +0200 @@ -6,7 +6,6 @@ import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.layout.HLayout; -import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataList; @@ -22,9 +21,6 @@ private static final long serialVersionUID = 1261822454641198692L; - /** The interface that provides the image resources. */ - private FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); - protected ModuleSelection moduleSelection; public MapSelection() {
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ModuleSelection.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,7 +1,5 @@ package de.intevation.flys.client.client.ui; -import java.util.LinkedHashMap; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -14,6 +12,8 @@ import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYSConstants; import de.intevation.flys.client.client.services.ModuleService; import de.intevation.flys.client.client.services.ModuleServiceAsync; import de.intevation.flys.client.shared.model.Data; @@ -23,8 +23,7 @@ import de.intevation.flys.client.shared.model.DefaultDataItem; import de.intevation.flys.client.shared.model.Module; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.FLYSConstants; +import java.util.LinkedHashMap; /** * The ModuleSelection combines the river selection and the module selection in @@ -36,6 +35,8 @@ */ public class ModuleSelection extends MapSelection { + private static final long serialVersionUID = -5634831815175543328L; + /** The message class that provides i18n strings.*/ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class); @@ -65,6 +66,7 @@ * * @return the module selection combined with the river selection. */ + @Override public Canvas create(DataList data) { GWT.log("ModuleSelection - create()"); VLayout newLayout = new VLayout(); @@ -100,7 +102,7 @@ } private void setModules() { - LinkedHashMap values = new LinkedHashMap(); + LinkedHashMap<String, String> values = new LinkedHashMap<String, String>(); if (this.modules!= null) { for(Module module : this.modules) { @@ -158,6 +160,7 @@ * * @return the Data that was chosen in this widget. */ + @Override protected Data[] getData() { String module = radio.getValueAsString();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultiPeriodPanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/MultiPeriodPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,38 +1,32 @@ package de.intevation.flys.client.client.ui; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.DateTimeFormat; -import com.smartgwt.client.data.Record; - +import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.Canvas; import com.smartgwt.client.widgets.Label; -import com.smartgwt.client.widgets.Button; import com.smartgwt.client.widgets.events.ClickEvent; import com.smartgwt.client.widgets.events.ClickHandler; - 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.grid.events.RecordClickEvent; +import com.smartgwt.client.widgets.grid.events.RecordClickHandler; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.types.ListGridFieldType; - -import com.smartgwt.client.widgets.grid.events.RecordClickEvent; -import com.smartgwt.client.widgets.grid.events.RecordClickHandler; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; import de.intevation.flys.client.shared.model.DefaultData; import de.intevation.flys.client.shared.model.DefaultDataItem; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * This UIProvider creates a panel for location or distance input. * @@ -42,6 +36,8 @@ extends PeriodPanel { + private static final long serialVersionUID = 1811025931934462457L; + protected ListGrid elements; protected String values; @@ -54,6 +50,7 @@ super(startName, endName); } + @Override public Canvas createWidget(DataList data) { HLayout input = new HLayout(); VLayout root = new VLayout(); @@ -63,6 +60,7 @@ elements = new ListGrid(); add.addClickHandler(new ClickHandler() { + @Override public void onClick(ClickEvent ce) { Date f = inputPanel.getFromDate(); Date t = inputPanel.getToDate(); @@ -101,6 +99,7 @@ }}; elements.addRecordClickHandler(new RecordClickHandler() { + @Override public void onRecordClick(final RecordClickEvent event) { // Just handle remove-clicks if(!event.getField().getName().equals(removeField.getName())) { @@ -121,6 +120,7 @@ return root; } + @SuppressWarnings("deprecation") @Override public Canvas createOld(DataList dataList) { GWT.log("old............................"); @@ -166,6 +166,7 @@ * * @return the selected/inserted data. */ + @Override public Data[] getData() { List<Data> data = new ArrayList<Data>(); @@ -182,6 +183,7 @@ } + @Override protected boolean saveDateValues() { ListGridRecord[] lgr = elements.getRecords(); if (lgr.length == 0) { @@ -210,6 +212,7 @@ setTo(to); } + @SuppressWarnings("deprecation") public void setFrom(Date from) { this.from = from; setAttribute( @@ -218,6 +221,7 @@ } + @SuppressWarnings("deprecation") public void setTo(Date to) { this.to = to; setAttribute(
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/QSegmentedInputPanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -0,0 +1,486 @@ +package de.intevation.flys.client.client.ui; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; +import com.google.gwt.user.client.rpc.AsyncCallback; + +import com.smartgwt.client.types.TitleOrientation; +import com.smartgwt.client.types.VerticalAlignment; +import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Canvas; +import com.smartgwt.client.widgets.Label; +import com.smartgwt.client.widgets.form.DynamicForm; +import com.smartgwt.client.widgets.form.fields.RadioGroupItem; +import com.smartgwt.client.widgets.form.fields.events.BlurHandler; +import com.smartgwt.client.widgets.form.fields.events.BlurEvent; +import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; +import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; +import com.smartgwt.client.widgets.tab.TabSet; +import com.smartgwt.client.widgets.tab.Tab; + +import de.intevation.flys.client.shared.model.Data; +import de.intevation.flys.client.shared.model.DataItem; +import de.intevation.flys.client.shared.model.DataList; +import de.intevation.flys.client.shared.model.DefaultData; +import de.intevation.flys.client.shared.model.DefaultDataItem; +import de.intevation.flys.client.shared.model.WQDataItem; +import de.intevation.flys.client.shared.model.WQInfoObject; +import de.intevation.flys.client.shared.model.WQInfoRecord; +import de.intevation.flys.client.shared.model.ArtifactDescription; + + +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.services.WQInfoService; +import de.intevation.flys.client.client.services.WQInfoServiceAsync; +import de.intevation.flys.client.client.ui.wq.WTable; +import de.intevation.flys.client.client.ui.wq.QDTable; + + +/** + * This UIProvider creates a widget to enter Q values per segment. + */ +public class QSegmentedInputPanel +extends AbstractUIProvider +implements ChangeHandler, BlurHandler +{ + public static final String FIELD_WQ_MODE = "wq_isq"; + public static final String FIELD_WQ_Q = "Q"; + + public static final String GAUGE_SEPARATOR = ":"; + + public static final String GAUGE_PART_SEPARATOR = ";"; + + public static final String VALUE_SEPARATOR = ","; + + public static final int ROW_HEIGHT = 20; + + /** The constant field name for choosing single values or range.*/ + public static final String FIELD_MODE = "mode"; + + /** The constant field value for range input mode.*/ + public static final String FIELD_MODE_RANGE = "range"; + + protected WQInfoServiceAsync wqInfoService = + GWT.create(WQInfoService.class); + + /** The message class that provides i18n strings.*/ + protected FLYSConstants MSG = GWT.create(FLYSConstants.class); + + /** Stores the input panels related to their keys.*/ + protected Map<String, DoubleArrayPanel> wqranges; + + /** Stores the min/max values for each q range.*/ + protected Map<String, double[]> qranges; + + protected QDTable qdTable; + + protected WTable wTable; + + protected TabSet tabs; + + + public QSegmentedInputPanel() { + wqranges = new HashMap<String, DoubleArrayPanel>(); + qranges = new HashMap<String, double[]>(); + qdTable = new QDTable(); + wTable = new WTable(); + } + + + /** Create main UI Canvas. */ + public Canvas create(DataList data) { + initHelperPanel(); + + Canvas submit = getNextButton(); + Canvas widget = createWidget(data); + Label label = new Label(MSG.wqadaptedTitle()); + + label.setHeight(25); + + VLayout layout = new VLayout(); + layout.setMembersMargin(10); + layout.setWidth(350); + + layout.addMember(label); + layout.addMember(widget); + layout.addMember(submit); + + return layout; + } + + + protected void initHelperPanel() { + tabs = new TabSet(); + tabs.setWidth100(); + tabs.setHeight100(); + + // TODO i18n + Tab qTab = new Tab("Q / D"); + + qTab.setPane(qdTable); + qdTable.hideIconFields(); + + tabs.addTab(qTab, 1); + + helperContainer.addMember(tabs); + + // TODO Q only would suffice. + fetchWQData(); + } + + + /** Create display for passive mode. */ + public Canvas createOld(DataList dataList) { + List<Data> all = dataList.getAll(); + Data wqData = getData(all, "ranges"); + + Canvas back = getBackButton(dataList.getState()); + + HLayout valLayout = new HLayout(); + VLayout vlayout = new VLayout(); + Label wqLabel = new Label(dataList.getLabel()); + + wqLabel.setValign(VerticalAlignment.TOP); + + wqLabel.setWidth(200); + wqLabel.setHeight(25); + + valLayout.addMember(wqLabel); + valLayout.addMember(createOldWQValues(wqData)); + valLayout.addMember(back); + + vlayout.addMember(valLayout); + + return vlayout; + } + + + /** Create canvas showing previously entered values. */ + protected Canvas createOldWQValues(Data wqData) { + VLayout layout = new VLayout(); + + //TODO: Sort by first field, numerically. + + DataItem item = wqData.getItems()[0]; + String value = item.getStringValue(); + + String[] gauges = value.split(GAUGE_SEPARATOR); + + for (String gauge: gauges) { + HLayout h = new HLayout(); + + String[] parts = gauge.split(GAUGE_PART_SEPARATOR); + String[] values = parts[2].split(VALUE_SEPARATOR); + + Label l = new Label(parts[0] + " - " + parts[1] + ": "); + + StringBuilder sb = new StringBuilder(); + boolean first = true; + + for (String v: values) { + if (!first) { + sb.append(", "); + } + + sb.append(v); + + first = false; + } + + Label v = new Label(sb.toString()); + + l.setWidth(65); + v.setWidth(65); + + h.addMember(l); + h.addMember(v); + + layout.addMember(h); + } + + return layout; + } + + + protected Canvas createWidget(DataList dataList) { + VLayout layout = new VLayout(); + + Canvas list = createList(dataList); + + DataItem[] items = getWQItems(dataList); + int listHeight = ROW_HEIGHT * items.length; + + layout.addMember(list); + + layout.setHeight(25 + listHeight); + layout.setWidth(350); + + return layout; + } + + + @Override + public List<String> validate() { + List<String> errors = new ArrayList<String>(); + NumberFormat nf = NumberFormat.getDecimalFormat(); + + Iterator<String> iter = wqranges.keySet().iterator(); + + while (iter.hasNext()) { + List<String> tmpErrors = new ArrayList<String>(); + + String key = iter.next(); + DoubleArrayPanel dap = wqranges.get(key); + + if (!dap.validateForm()) { + errors.add(MSG.error_invalid_double_value()); + return errors; + } + + double[] mm = qranges.get(key); + if (mm == null) { + SC.warn(MSG.error_read_minmax_values()); + continue; + } + + double[] values = dap.getInputValues(); + // might geht npe here if one field not filled + double[] good = new double[values.length]; + + int idx = 0; + + for (double value: values) { + if (value < mm[0] || value > mm[1]) { + String tmp = MSG.error_validate_range(); + tmp = tmp.replace("$1", nf.format(value)); + tmp = tmp.replace("$2", nf.format(mm[0])); + tmp = tmp.replace("$3", nf.format(mm[1])); + tmpErrors.add(tmp); + } + else { + good[idx++] = value; + } + } + + double[] justGood = new double[idx]; + for (int i = 0; i < justGood.length; i++) { + justGood[i] = good[i]; + } + + if (!tmpErrors.isEmpty()) { + dap.setValues(justGood); + + errors.addAll(tmpErrors); + } + } + + return errors; + } + + + protected Canvas createList(DataList dataList) { + VLayout layout = new VLayout(); + + DataItem[] items = getWQItems(dataList); + + for (DataItem item: items) { + String title = item.getLabel(); + + DoubleArrayPanel dap = new DoubleArrayPanel( + createLineTitle(title), null, this, TitleOrientation.LEFT); + + wqranges.put(title, dap); + + if (item instanceof WQDataItem) { + WQDataItem wq = (WQDataItem) item; + double[] mmQ = wq.getQRange(); + double[] mmW = wq.getWRange(); + + qranges.put(title, mmQ); + } + + layout.addMember(dap); + } + + layout.setHeight(items.length * ROW_HEIGHT); + + return layout; + } + + + protected DataItem[] getWQItems(DataList dataList) { + List<Data> data = dataList.getAll(); + + for (Data d: data) { + String name = d.getLabel(); + + // TODO to be gone + if (name.equals(FIELD_WQ_MODE)) { + continue; + } + + return d.getItems(); + } + + return null; + } + + + + public String createLineTitle(String key) { + String[] splitted = key.split(";"); + + return splitted[0] + " - " + splitted[1]; + } + + + public Data[] getData() { + Data values = getWQValues(); + + return new Data[] { values }; + } + + + protected Data getWQValues() { + String wqvalue = null; + + Iterator<String> iter = wqranges.keySet().iterator(); + while (iter.hasNext()) { + String key = iter.next(); + DoubleArrayPanel dap = wqranges.get(key); + + double[] values = dap.getInputValues(); + if (wqvalue == null) { + wqvalue = createValueString(key, values); + } + else { + wqvalue += GAUGE_SEPARATOR + createValueString(key, values); + } + } + + // TODO probably ranges + DataItem valueItem = new DefaultDataItem( + "ranges", "ranges", wqvalue); + Data values = new DefaultData( + "ranges", null, null, new DataItem[] { valueItem }); + + return values; + } + + + protected String createValueString(String key, double[] values) { + StringBuilder sb = new StringBuilder(); + + boolean first = true; + + for (double value: values) { + if (!first) { + sb.append(","); + } + + sb.append(Double.toString(value)); + + first = false; + } + + return key + ";" + sb.toString(); + } + + + public void onChange(ChangeEvent event) { + // TODO IMPLEMENT ME + } + + + public void onBlur(BlurEvent event) { + DoubleArrayPanel dap = (DoubleArrayPanel) event.getForm(); + dap.validateForm(event.getItem()); + } + + + protected void fetchWQData() { + Config config = Config.getInstance(); + String locale = config.getLocale (); + + ArtifactDescription adescr = artifact.getArtifactDescription(); + DataList[] data = adescr.getOldData(); + + double[] mm = getMinMaxKM(data); + String river = getRiverName(data); + + wqInfoService.getWQInfo(locale, river, mm[0], mm[0], + new AsyncCallback<WQInfoObject[]>() { + public void onFailure(Throwable caught) { + GWT.log("Could not recieve wq informations."); + SC.warn(caught.getMessage()); + } + + public void onSuccess(WQInfoObject[] wqi) { + int num = wqi != null ? wqi.length :0; + GWT.log("Recieved " + num + " wq informations."); + + if (num == 0) { + return; + } + + addWQInfo(wqi); + + } + } + ); + } + + + protected void addWQInfo (WQInfoObject[] wqi) { + for(WQInfoObject wi: wqi) { + WQInfoRecord rec = new WQInfoRecord(wi); + + if (wi.getType().equals("W")) { + wTable.addData(rec); + } + else { + qdTable.addData(rec); + } + } + } + + + /** + * Determines the min and max kilometer value selected in a former state. A + * bit silly, but we need to run over each value of the "old data" to find + * such values because it is not available here. + * + * @param data The DataList which contains the whole data inserted for the + * current artifact. + * + * @return a double array with [min, max]. + */ + protected double[] getMinMaxKM(DataList[] data) { + ArtifactDescription adesc = artifact.getArtifactDescription(); + return adesc.getKMRange(); + } + + + /** + * Returns the name of the selected river. + * + * @param data The DataList with all data. + * + * @return the name of the current river. + */ + protected String getRiverName(DataList[] data) { + ArtifactDescription adesc = artifact.getArtifactDescription(); + return adesc.getRiver(); + } +} +// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/UIProviderFactory.java Mon Oct 15 09:31:50 2012 +0200 @@ -56,6 +56,9 @@ else if (uiProvider.equals("wq_panel_adapted")) { return new WQAdaptedInputPanel(); } + else if (uiProvider.equals("q_segmented_panel")) { + return new QSegmentedInputPanel(); + } else if (uiProvider.equals("river_panel")) { return new LinkSelection(); }
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java Mon Oct 15 09:29:25 2012 +0200 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WspDatacagePanel.java Mon Oct 15 09:31:50 2012 +0200 @@ -1,15 +1,17 @@ package de.intevation.flys.client.client.ui; -import java.util.List; -import java.util.Map; -import java.util.Set; - import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.events.ClickEvent; +import de.intevation.flys.client.client.Config; +import de.intevation.flys.client.client.FLYS; +import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.StepForwardEvent; +import de.intevation.flys.client.client.services.LoadArtifactService; +import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.Data; @@ -22,15 +24,15 @@ import de.intevation.flys.client.shared.model.ToLoad; import de.intevation.flys.client.shared.model.User; -import de.intevation.flys.client.client.Config; -import de.intevation.flys.client.client.FLYSConstants; -import de.intevation.flys.client.client.event.StepForwardEvent; -import de.intevation.flys.client.client.services.LoadArtifactService; -import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; +import java.util.List; +import java.util.Map; +import java.util.Set; public class WspDatacagePanel extends DatacagePanel { + private static final long serialVersionUID = 2494432743877141135L; + public static final String WATERLEVEL_OUTS = "waterlevels"; public static final FLYSConstants MSG = GWT.create(FLYSConstants.class); @@ -83,14 +85,23 @@ final Collection c = this.collection; final Recommendation r = getSelectedRecommendation(); + + if (r == null) { + SC.warn(MSG.warning_no_wsp_selected()); + return; + } + // 2) Create, load Artifact and fire event loadService.load( c, r, "winfo", locale, new AsyncCallback<Artifact>() { + @Override public void onFailure(Throwable caught) { - SC.warn(caught.getMessage()); + GWT.log("WspDatacagePanel", caught); + SC.warn(FLYS.getExceptionString(MSG, caught)); } + @Override public void onSuccess(Artifact artifact) { fireStepForwardEvent(new StepForwardEvent( getData(r, artifact)));