[PATCH] uinfo.inundation_duration ui
Wald Commits
scm-commit at wald.intevation.org
Fri May 11 17:04:42 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1526051075 -7200
# Node ID b5d7a9d7983792418f1127de494c5b40493fdf33
# Parent 58af9b81a97b67a19538585812cb2615044b8f07
uinfo.inundation_duration ui
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/doc/conf/artifacts/uinfo.xml
--- a/artifacts/doc/conf/artifacts/uinfo.xml Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/doc/conf/artifacts/uinfo.xml Fri May 11 17:04:35 2018 +0200
@@ -104,6 +104,9 @@
</outputmode>
</outputmodes>
</state>
+
+
+
<!-- Calculation Mode: Inundation Duration -->
@@ -116,40 +119,40 @@
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
<from state="state.uinfo.distance_only" />
- <to state="state.uinfo.year_epoch" />
+ <to state="state.uinfo.year_totalepoch" />
<condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" />
</transition>
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
- <from state="state.uinfo.year_epoch" />
+ <from state="state.uinfo.year_totalepoch" />
<to state="state.uinfo.load.year" />
<condition data="ye_select" value="state.uinfo.year" operator="equal" />
</transition>
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
- <from state="state.uinfo.year_epoch" />
- <to state="state.uinfo.load.epoch" />
- <condition data="ye_select" value="state.uinfo.epoch" operator="equal" />
+ <from state="state.uinfo.year_totalepoch" />
+ <to state="state.uinfo.load.totalepoch" />
+ <condition data="ye_select" value="state.uinfo.totalepoch" operator="equal" />
</transition>
- <state id="state.uinfo.year_epoch" description="state.uinfo.year_epoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.YearChoice" helpText="help.state.uinfo.year">
+ <state id="state.uinfo.year_totalepoch" description="state.uinfo.year_totalepoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.YearChoice" helpText="help.state.uinfo.year">
<data name="ye_select" type="String" />
</state>
<state id="state.uinfo.load.year" description="state.uinfo.load.year" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadYearSelect" helpText="help.state.uinfo.load.year">
- <data name="years" type="String" />
+ <data name="singleyear" type="String" />
</state>
- <state id="state.uinfo.load.epoch" description="state.uinfo.load.epoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadEpochSelect" helpText="help.state.uinfo.load.epoch">
- <data name="epochs" type="String" />
+ <state id="state.uinfo.load.totalepoch" description="state.uinfo.load.totalepoch" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadEpochSelect" helpText="help.state.uinfo.load.epoch">
+ <data name="totalepoch" type="String" />
</state>
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
- <from state="state.uinfo.load.epoch" />
+ <from state="state.uinfo.load.totalepoch" />
<to state="state.uinfo.inundation.use_scenario" />
<condition data="calculation_mode" value="uinfo_inundation_duration" operator="equal" />
</transition>
@@ -179,11 +182,11 @@
</transition>
<state id="state.uinfo.inundation.scenario" description="state.uinfo.inundation.scenario" state="org.dive4elements.river.artifacts.uinfo.inundationduration.LoadScenarioSelect" helpText="help.state.uinfo.use_scenario">
- <data name="years" type="String" /> <!-- mittelwasserlage in cm! -->
- </state>
-
- <state id="state.uinfo.inundation.vegetation" description="state.uinfo.inundation.vegetation" state="org.dive4elements.river.artifacts.uinfo.salix.UseScenarioChoice" helpText="help.state.uinfo.use_scenario">
- <data name="vegetation" type="Boolean" />
+ <data name="sedimentheight" type="String" /> <!-- mittelwasserlage in cm! -->
+ </state>
+
+ <state id="state.uinfo.inundation.vegetation" description="state.uinfo.inundation.vegetation" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableState" helpText="help.state.uinfo.use_scenario">
+ <data name="vegzones" type="String" />
</state>
<transition transition="org.dive4elements.river.artifacts.transitions.ValueCompareTransition">
@@ -258,7 +261,7 @@
- <state id="state.uinfo.vegetation_zones.table" description="state.uinfo.vegetation_zones.table" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableState" helpText="help.state.uinfo.vegetation_zones">
+ <state id="state.uinfo.vegetation_zones.table" description="state.uinfo.vegetation_zones.table" state="org.dive4elements.river.artifacts.uinfo.vegetationzones.VegetationZonesTableEditState" helpText="help.state.uinfo.vegetation_zones">
<data name="vegzones" type="String" />
</state>
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/LoadYearSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/LoadYearSelect.java Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/collision/LoadYearSelect.java Fri May 11 17:04:35 2018 +0200
@@ -28,7 +28,7 @@
/** Year Select Widget. */
@Override
protected String getUIProvider() {
- return "minfo.sedimentload_year_select"; // TODO: eigenes Panel oder allgemeineren Code
+ return "uinfo.inundationduration.load_year_select";
}
@Override
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadEpochSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadEpochSelect.java Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadEpochSelect.java Fri May 11 17:04:35 2018 +0200
@@ -23,6 +23,6 @@
@Override
protected String getUIProvider() {
- return "uinfo.inundation_duration.load_epoch_select";
+ return "uinfo.inundationduration.load_totalepoch_select";
}
}
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/LoadScenarioSelect.java Fri May 11 17:04:35 2018 +0200
@@ -27,7 +27,7 @@
/** Year Select Widget. */
@Override
protected String getUIProvider() {
- return "minfo.sedimentload_year_select"; // TODO: eigenes Panel oder allgemeineren Code und an SCENARIO AUS DB ANPASSEN!
+ return "uinfo.sedimentheight_select"; // TODO: eigenes Panel oder allgemeineren Code und an SCENARIO AUS DB ANPASSEN!
}
@Override
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/YearChoice.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/YearChoice.java Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/inundationduration/YearChoice.java Fri May 11 17:04:35 2018 +0200
@@ -27,7 +27,7 @@
protected List<String> makeEntries() {
final List<String> entries = new ArrayList<>();
entries.add("state.uinfo.year");
- entries.add("state.uinfo.epoch");
+ entries.add("state.uinfo.totalepoch");
return entries;
}
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableEditState.java Fri May 11 17:04:35 2018 +0200
@@ -0,0 +1,25 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.artifacts.uinfo.vegetationzones;
+
+import org.dive4elements.river.artifacts.states.DefaultState;
+
+/**
+ * @author Domenico Nardi Tironi
+ */
+public class VegetationZonesTableEditState extends DefaultState {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected String getUIProvider() {
+ return "uinfo.vegetationzones.table.edit";
+ }
+}
\ No newline at end of file
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/vegetationzones/VegetationZonesTableState.java Wed May 09 16:36:55 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
- * Software engineering by
- * Björnsen Beratende Ingenieure GmbH
- * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-package org.dive4elements.river.artifacts.uinfo.vegetationzones;
-
-import org.dive4elements.river.artifacts.states.DefaultState;
-
-/**
- * @author Domenico Nardi Tironi
- */
-public class VegetationZonesTableState extends DefaultState {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected String getUIProvider() {
- return "uinfo.vegetationzones.table";
- }
-}
\ No newline at end of file
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/resources/messages.properties
--- a/artifacts/src/main/resources/messages.properties Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/resources/messages.properties Fri May 11 17:04:35 2018 +0200
@@ -77,11 +77,14 @@
state.uinfo.vegetation_zones.table = Einteilung der Vegetationszonen und \u00dcberflutungsdauern (\u00dcFD)
+state.uinfo.year_totalepoch = Year/Gesamter Zeitraum
state.uinfo.year_epoch = Year/Epoch
state.uinfo.load.year= Year
+state.uinfo.load.totalepoch=Gesamter Zeitraum
state.uinfo.load.epoch=Epoch
state.uinfo.year=Year
state.uinfo.epoch=Epoch
+state.uinfo.totalepoch=Total Epoch
state.sinfo.year_epoch = Year/Epoch
state.sinfo.load.year= Year(s)
diff -r 58af9b81a97b -r b5d7a9d79837 artifacts/src/main/resources/messages_de.properties
--- a/artifacts/src/main/resources/messages_de.properties Wed May 09 16:36:55 2018 +0200
+++ b/artifacts/src/main/resources/messages_de.properties Fri May 11 17:04:35 2018 +0200
@@ -77,11 +77,14 @@
state.uinfo.vegetation_zones.table = Einteilung der Vegetationszonen und \u00dcberflutungsdauern (\u00dcFD)
+state.uinfo.year_totalepoch = Jahr/Gesamter Zeitraum
state.uinfo.year_epoch = Jahr/Epoche
state.uinfo.load.year= Jahr
+state.uinfo.load.totalepoch=Gesamter Zeitraum
state.uinfo.load.epoch=Epoche
state.uinfo.year=Jahr
state.uinfo.epoch=Epoche
+state.uinfo.totalepoch=Gesamter Zeitraum
state.sinfo.year_epoch = Jahr/Epoche
state.sinfo.load.year= Jahr(e)
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java Wed May 09 16:36:55 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/AbstractUIProvider.java Fri May 11 17:04:35 2018 +0200
@@ -8,18 +8,11 @@
package org.dive4elements.river.client.client.ui;
-import com.google.gwt.core.client.GWT;
+import java.util.ArrayList;
+import java.util.List;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.Img;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
-
+import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.FLYSConstants;
-import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.event.HasStepBackHandlers;
import org.dive4elements.river.client.client.event.HasStepForwardHandlers;
import org.dive4elements.river.client.client.event.StepBackEvent;
@@ -35,19 +28,21 @@
import org.dive4elements.river.client.shared.model.DefaultData;
import org.dive4elements.river.client.shared.model.DefaultDataItem;
-import java.util.ArrayList;
-import java.util.List;
-
+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;
+import com.smartgwt.client.widgets.Img;
+import com.smartgwt.client.widgets.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
/**
* An abstract UIProvider that provides some basic methods.
*
* @author <a href="mailto:ingo.weinzierl at intevation.de">Ingo Weinzierl</a>
*/
-public abstract class AbstractUIProvider
-implements UIProvider, HasStepForwardHandlers, ClickHandler,
- HasStepBackHandlers
-{
+public abstract class AbstractUIProvider implements UIProvider, HasStepForwardHandlers, ClickHandler, HasStepBackHandlers {
private static final long serialVersionUID = -1610874613377494184L;
/** The message class that provides i18n strings. */
@@ -75,90 +70,87 @@
* Creates a new UIProvider instance of this class.
*/
public AbstractUIProvider() {
- forwardHandlers = new ArrayList<StepForwardHandler>();
- backHandlers = new ArrayList<StepBackHandler>();
+ this.forwardHandlers = new ArrayList<StepForwardHandler>();
+ this.backHandlers = new ArrayList<StepBackHandler>();
}
-
/**
* Appends a StepBackHandler that wants to listen to StepBackEvents.
*
- * @param handler A new StepBackHandler.
+ * @param handler
+ * A new StepBackHandler.
*/
@Override
- public void addStepBackHandler(StepBackHandler handler) {
+ public void addStepBackHandler(final StepBackHandler handler) {
if (handler != null) {
- backHandlers.add(handler);
+ this.backHandlers.add(handler);
}
}
-
/**
* Appends a StepForwardHandler that wants to listen to StepForwardEvents.
*
- * @param handler A new StepForwardHandler.
+ * @param handler
+ * A new StepForwardHandler.
*/
@Override
- public void addStepForwardHandler(StepForwardHandler handler) {
+ public void addStepForwardHandler(final StepForwardHandler handler) {
if (handler != null) {
- forwardHandlers.add(handler);
+ this.forwardHandlers.add(handler);
}
}
-
/**
* This method is called after the user has clicked one of the buttons to
* step back to a previous state.
*
- * @param e The StepBackEvent.
+ * @param e
+ * The StepBackEvent.
*/
- protected void fireStepBackEvent(StepBackEvent e) {
- GWT.log("AbstractUIProvider - fireStepBackEvent() handlers: "
- + backHandlers.size());
- for (StepBackHandler handler: backHandlers) {
+ protected void fireStepBackEvent(final StepBackEvent e) {
+ GWT.log("AbstractUIProvider - fireStepBackEvent() handlers: " + this.backHandlers.size());
+ for (final StepBackHandler handler : this.backHandlers) {
handler.onStepBack(e);
}
}
-
/**
* This method is called after the user has clicked on the 'next' button to
* step to the next state.
*
- * @param e The StepForwardEvent.
+ * @param e
+ * The StepForwardEvent.
*/
- protected void fireStepForwardEvent(StepForwardEvent e) {
- GWT.log("AbstractUIProvider - fireStepForwardEvent() handlers: "
- + forwardHandlers.size());
- for (StepForwardHandler handler: forwardHandlers) {
+ protected void fireStepForwardEvent(final StepForwardEvent e) {
+ GWT.log("AbstractUIProvider - fireStepForwardEvent() handlers: " + this.forwardHandlers.size());
+ for (final StepForwardHandler handler : this.forwardHandlers) {
handler.onStepForward(e);
}
}
-
/**
* This method is used to listen to click events on the 'next' button. The
* fireStepForwardEvent() method is called here.
*
- * @param e The click event.
+ * @param e
+ * The click event.
*/
@Override
- public void onClick(ClickEvent e) {
- List<String> errors = validate();
- if (errors == null || errors.isEmpty()) {
- Data[] data = getData();
- fireStepForwardEvent(new StepForwardEvent(data));
- }
- else {
- showErrors(errors);
- }
+ public void onClick(final ClickEvent e) {
+ final List<String> errors = validate();
+ // if (errors == null || errors.isEmpty()) {
+ final Data[] data = getData();
+ fireStepForwardEvent(new StepForwardEvent(data));
+ // }
+ // else {
+ // showErrors(errors);
+ // }
}
+ protected void showErrors(final List<String> errors) {
+ final StringBuilder sb = new StringBuilder();
- protected void showErrors(List<String> errors) {
- StringBuilder sb = new StringBuilder();
-
- for (String error: errors) {
+ for (final String error : errors) {
sb.append(error);
sb.append("<br>");
}
@@ -166,43 +158,41 @@
SC.warn(sb.toString());
}
-
/**
* Creates the 'next' button to step forward to the next state.
*
* @return the 'next' button.
*/
protected Canvas getNextButton() {
- Button next = new Button(MSG.buttonNext());
+ final Button next = new Button(this.MSG.buttonNext());
next.addClickHandler(this);
return next;
}
-
@Override
- public Canvas createHelpLink(DataList dataList, Data data, FLYS instance) {
- String iUrl = GWT.getHostPageBaseURL() + MSG.getFeatureInfo();
- String helpUrl = dataList.getHelpText();
+ public Canvas createHelpLink(final DataList dataList, final Data data, final FLYS instance) {
+ final String iUrl = GWT.getHostPageBaseURL() + this.MSG.getFeatureInfo();
+ final String helpUrl = dataList.getHelpText();
return new WikiImgLink(iUrl, helpUrl, 30, 30, instance);
}
-
/**
* Creates the 'back' button to step back to a previous state.
*
- * @param targetState The identifier of the target state.
+ * @param targetState
+ * The identifier of the target state.
*
* @return the 'back' button.
*/
protected Canvas getBackButton(final String targetState) {
- String url = GWT.getHostPageBaseURL() + MSG.imageBack();
- Img back = new Img(url, 16, 16);
+ final String url = GWT.getHostPageBaseURL() + this.MSG.imageBack();
+ final Img back = new Img(url, 16, 16);
back.addClickHandler(new ClickHandler() {
@Override
- public void onClick(ClickEvent event) {
+ public void onClick(final ClickEvent event) {
fireStepBackEvent(new StepBackEvent(targetState));
}
});
@@ -210,58 +200,56 @@
return back;
}
-
/**
* This method injects a container that is used to position helper widgets.
*
- * @param helperContainer A container that is used to position helper
- * widgets.
+ * @param helperContainer
+ * A container that is used to position helper
+ * widgets.
*/
@Override
- public void setContainer(VLayout helperContainer) {
+ public void setContainer(final VLayout helperContainer) {
this.helperContainer = helperContainer;
}
-
/**
* This method injects an artifact that contains the status information.
*
- * @param art An artifact containing status information.
+ * @param art
+ * An artifact containing status information.
*/
@Override
- public void setArtifact(Artifact art) {
+ public void setArtifact(final Artifact art) {
this.artifact = art;
}
-
@Override
- public void setCollection(Collection collection) {
+ public void setCollection(final Collection collection) {
this.collection = collection;
}
-
@Override
- public void setParameterList(ParameterList list) {
+ public void setParameterList(final ParameterList list) {
this.parameterList = list;
}
-
public Collection getCollection() {
- return collection;
+ return this.collection;
}
-
/**
* This method greps the Data with name <i>name</i> from the list and
* returns it.
*
- * @param items A list of Data.
- * @param name The name of the Data that we are searching for.
+ * @param items
+ * A list of Data.
+ * @param name
+ * The name of the Data that we are searching for.
*
* @return the Data with the name <i>name</i>.
*/
- protected Data getData(List<Data> data, String name) {
- for (Data d: data) {
+ protected Data getData(final List<Data> data, final String name) {
+ for (final Data d : data) {
if (name.equals(d.getLabel())) {
return d;
}
@@ -270,17 +258,16 @@
return null;
}
+ protected String getDataValue(final String state, final String name) {
+ final ArtifactDescription desc = this.artifact.getArtifactDescription();
- protected String getDataValue(String state, String name) {
- ArtifactDescription desc = artifact.getArtifactDescription();
+ final DataList[] old = desc.getOldData();
- DataList[] old = desc.getOldData();
-
- for (DataList list: old) {
+ for (final DataList list : old) {
if (list == null) {
continue;
}
- Data d = getData(list.getAll(), name);
+ final Data d = getData(list.getAll(), name);
if (d != null) {
return d.getItems()[0].getStringValue();
@@ -294,13 +281,15 @@
* This method greps the DataItem with name <i>name</i> from the list and
* returns it.
*
- * @param items A list of DataItems.
- * @param name The name of the DataItem that we are searching for.
+ * @param items
+ * A list of DataItems.
+ * @param name
+ * The name of the DataItem that we are searching for.
*
* @return the DataItem with the name <i>name</i>.
*/
- protected DataItem getDataItem(DataItem[] items, String name) {
- for (DataItem item: items) {
+ protected DataItem getDataItem(final DataItem[] items, final String name) {
+ for (final DataItem item : items) {
if (name.equals(item.getLabel())) {
return item;
}
@@ -311,6 +300,7 @@
/**
* Validates the selection.
+ *
* @return List of internationalized errror messages (if any).
*/
public List<String> validate() {
@@ -318,31 +308,24 @@
}
/** Create simple DefaultData with single DataItem inside. */
- public static DefaultData createDataArray(String name, String value) {
- DataItem item = new DefaultDataItem(
- name,
- name,
- value);
+ public static DefaultData createDataArray(final String name, final String value) {
+ final DataItem item = new DefaultDataItem(name, name, value);
- return new DefaultData(name,
- null,
- null,
- new DataItem[] {item});
+ return new DefaultData(name, null, null, new DataItem[] { item });
}
-
/**
* This method needs to be implemented by concrete subclasses. It should
* create a new Canvas object with a representation of <i>data</i>.
*
- * @param data The data that should be displayed.
+ * @param data
+ * The data that should be displayed.
*
* @return a Canvas object that displays <i>data</i>.
*/
@Override
public abstract Canvas create(DataList data);
-
/**
* This method needs to be implemented by concrete subclasses. It should
* return the selected data.
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/PanelHelper.java Fri May 11 17:04:35 2018 +0200
@@ -0,0 +1,39 @@
+/** Copyright (C) 2017 by Bundesanstalt für Gewässerkunde
+ * Software engineering by
+ * Björnsen Beratende Ingenieure GmbH
+ * Dr. Schumacher Ingenieurbüro für Wasser und Umwelt
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+package org.dive4elements.river.client.client.ui;
+
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.validator.Validator;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+/**
+ * @author Domenico Nardi Tironi
+ *
+ */
+public class PanelHelper {
+
+ public PanelHelper() {
+
+ }
+
+ public static final TextItem createItem(final String identifier, final String title, final int width, final Validator... validator) {
+ final TextItem item = new TextItem(identifier, title);
+ item.setWidth(width);
+ item.setWrapTitle(false);
+ item.setValidators(validator);
+ return item;
+ }
+
+ public static VLayout getSpacer(final int height) {
+ final VLayout spacer = new VLayout();
+ spacer.setHeight(height);
+ return spacer;
+ }
+}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RadioPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RadioPanel.java Wed May 09 16:36:55 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/RadioPanel.java Fri May 11 17:04:35 2018 +0200
@@ -35,14 +35,14 @@
public Canvas createOld(final DataList dataList) {
final Data data = dataList.get(0);
final DataItem[] items = data.getItems();
-
+ // hat Einfluss auf Layout in der Übersicht (oben) nach Setzen des Wertes für den State
final HLayout layout = new HLayout();
final Label label = new Label(dataList.getLabel());
final Label value = new Label(items[0].getLabel());
-
- layout.setHeight(35); // hat Einfluss auf Layout in der Übersicht (oben) nach Setzen des Wertes für den State
layout.setWidth(400);
- label.setWidth(200);
+ label.setWidth(200); // nicht ändern; scheint wohl ne Konstante zu sein!
+ value.setWidth(180); // änderbar
+ layout.setHeight(35);
layout.addMember(label);
layout.addMember(value);
@@ -60,7 +60,10 @@
final VLayout layout = new VLayout();
final Label label = new Label(data.getDescription());
+ label.setWrap(false);
final RadioGroupItem rgi = new RadioGroupItem("selection");
+ rgi.setWrapTitle(false);
+ rgi.setWrap(false);
rgi.setShowTitle(false);
GWT.log("items: " + items.length);
final LinkedHashMap<String, String> elems = new LinkedHashMap<String, String>();
@@ -76,6 +79,8 @@
layout.setMembersMargin(10);
layout.setHeight(35);
label.setHeight(35);
+ layout.setWidth(300);
+ label.setWidth(300);
layout.addMember(label);
layout.addMember(this.form);
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Wed May 09 16:36:55 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/UIProviderFactory.java Fri May 11 17:04:35 2018 +0200
@@ -27,9 +27,11 @@
import org.dive4elements.river.client.client.ui.sinfo.FlowDepthTwinPanel;
import org.dive4elements.river.client.client.ui.sq.SQPeriodPanel;
import org.dive4elements.river.client.client.ui.uinfo.InundationDurLoadEpochPanel;
+import org.dive4elements.river.client.client.ui.uinfo.LoadSedimentHeightPanel;
import org.dive4elements.river.client.client.ui.uinfo.LoadSingleEpochPanel;
import org.dive4elements.river.client.client.ui.uinfo.LoadSingleYearPanel;
-import org.dive4elements.river.client.client.ui.uinfo.VegetationzonesTable;
+import org.dive4elements.river.client.client.ui.uinfo.VegetationzonesTableEditPanel;
+import org.dive4elements.river.client.client.ui.uinfo.VegetationzonesTablePanel;
import org.dive4elements.river.client.shared.model.User;
/**
@@ -78,8 +80,10 @@
return new LinkSelection();
} else if (uiProvider.equals("continue")) {
return new ContinuePanel();
+ } else if (uiProvider.equals("uinfo.vegetationzones.table.edit")) {
+ return new VegetationzonesTableEditPanel();
} else if (uiProvider.equals("uinfo.vegetationzones.table")) {
- return new VegetationzonesTable();
+ return new VegetationzonesTablePanel();
} else if (uiProvider.equals("wsp_datacage_panel")) {
return new WspDatacagePanel(user);
} else if (uiProvider.equals("dgm_datacage_panel")) {
@@ -156,10 +160,12 @@
return new InundationDurLoadEpochPanel();
} else if (uiProvider.equals("uinfo.inundationduration.load_year_select")) {
return new LoadSingleYearPanel();
- } else if (uiProvider.equals("uinfo.inundationduration.load_epoch_select")) {
+ } else if (uiProvider.equals("uinfo.inundationduration.load_totalepoch_select")) {
return new LoadSingleEpochPanel();
} else if (uiProvider.equals("minfo.sedimentload_sqti_select")) {
return new SedLoadSQTiPanel();
+ } else if (uiProvider.equals("uinfo.sedimentheight_select")) {
+ return new LoadSedimentHeightPanel();
} else if (uiProvider.equals("hws_datacage_panel")) {
return new HWSDatacagePanel(user);
} else if (uiProvider.equals("user_rgd_panel")) {
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSedimentHeightPanel.java Fri May 11 17:04:35 2018 +0200
@@ -0,0 +1,288 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.client.client.ui.uinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dive4elements.river.client.client.Config;
+import org.dive4elements.river.client.client.FLYSConstants;
+import org.dive4elements.river.client.client.services.SedimentLoadInfoService;
+import org.dive4elements.river.client.client.services.SedimentLoadInfoServiceAsync;
+import org.dive4elements.river.client.client.ui.AbstractUIProvider;
+import org.dive4elements.river.client.shared.model.ArtifactDescription;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataItem;
+import org.dive4elements.river.client.shared.model.DataList;
+import org.dive4elements.river.client.shared.model.DefaultData;
+import org.dive4elements.river.client.shared.model.DefaultDataItem;
+import org.dive4elements.river.client.shared.model.SedimentLoadInfoObject;
+import org.dive4elements.river.client.shared.model.SedimentLoadInfoRecord;
+
+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.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;
+import com.smartgwt.client.widgets.form.fields.IntegerItem;
+import com.smartgwt.client.widgets.form.fields.StaticTextItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+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;
+
+public class LoadSedimentHeightPanel extends AbstractUIProvider {
+ private static final long serialVersionUID = 1L;
+
+ protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class); // TODO: find right datasource
+
+ private static final String datakey = "sedimentheight";
+ protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
+
+ private TextItem inputItem;
+
+ private ListGrid sedLoadTable;
+
+ protected List<String> validInputs;
+
+ public LoadSedimentHeightPanel() {
+ }
+
+ @Override
+ public Canvas createOld(final DataList dataList) {
+ final List<Data> items = dataList.getAll();
+ final Data item = getData(items, datakey);
+ final DataItem[] alreadySetItems = item.getItems();
+
+ final String v1 = alreadySetItems[0].getStringValue().replace(" ", ", ");
+
+ final Label old = new Label(v1);
+ final HLayout layout = new HLayout();
+ layout.setWidth("400px");
+
+ final Label label = new Label(dataList.getLabel());
+ label.setWidth("200px");
+
+ final Canvas back = getBackButton(dataList.getState());
+
+ layout.addMember(label);
+ layout.addMember(old);
+ layout.addMember(back);
+
+ return layout;
+ }
+
+ @Override
+ public List<String> validate() {
+ return validateYears();
+ }
+
+ @Override
+ public Canvas create(final DataList data) {
+ final VLayout layout = new VLayout();
+
+ final Canvas helper = createHelper();
+ this.helperContainer.addMember(helper);
+
+ final Canvas submit = getNextButton();
+ final Canvas widget = createWidget(data);
+
+ layout.addMember(widget);
+ layout.addMember(submit);
+
+ fetchSedimentLoadData();
+
+ return layout;
+ }
+
+ private Canvas createHelper() {
+ this.sedLoadTable = new ListGrid();
+ this.sedLoadTable.setShowHeaderContextMenu(false);
+ this.sedLoadTable.setWidth100();
+ this.sedLoadTable.setShowRecordComponents(true);
+ this.sedLoadTable.setShowRecordComponentsByCell(true);
+ this.sedLoadTable.setHeight100();
+ this.sedLoadTable.setEmptyMessage(this.MSG.empty_table());
+ this.sedLoadTable.setCanReorderFields(false);
+
+ final ListGridField date = new ListGridField("date", this.MSG.year());
+ date.setType(ListGridFieldType.TEXT);
+ date.setWidth(100);
+
+ final ListGridField descr = new ListGridField("description", this.MSG.description());
+ descr.setType(ListGridFieldType.TEXT);
+ descr.setWidth("*");
+
+ final String baseUrl = GWT.getHostPageBaseURL();
+ final ListGridField pinFrom = new ListGridField("fromIcon", this.MESSAGES.selection());
+ pinFrom.setWidth(60);
+ pinFrom.setType(ListGridFieldType.ICON);
+ pinFrom.setCellIcon(baseUrl + this.MESSAGES.markerGreen());
+
+ pinFrom.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(final RecordClickEvent e) {
+ final Record r = e.getRecord();
+ appendValue(r.getAttribute("date"));
+ }
+ });
+
+ this.sedLoadTable.setFields(pinFrom, date, descr);
+ return this.sedLoadTable;
+ }
+
+ public Canvas createWidget(final DataList data) {
+ final VLayout layout = new VLayout();
+
+ final Label title = new Label(data.get(0).getDescription());
+ title.setHeight("35px");
+
+ final DynamicForm form = new DynamicForm();
+ form.setNumCols(4);
+
+ final StaticTextItem textItem = new StaticTextItem("TEST");
+ textItem.setValue("cm");
+ textItem.setShowTitle(false);
+
+ this.inputItem = new IntegerItem(this.MSG.year());
+ this.inputItem.setShowTitle(false);
+ form.setFields(this.inputItem, textItem);
+
+ layout.addMember(title);
+ layout.addMember(form);
+
+ return layout;
+ }
+
+ @Override
+ protected Data[] getData() {
+ validateYears();
+ if (this.inputItem != null && !this.inputItem.getValueAsString().isEmpty()) {
+ final List<Data> data = new ArrayList<Data>();
+
+ final DataItem yearsdata = new DefaultDataItem(datakey, datakey, this.inputItem.getValueAsString().trim()); // DATA-STRING: years (in
+ // uinfo.xml)
+ data.add(new DefaultData(datakey, null, null, new DataItem[] { yearsdata }));
+
+ return data.toArray(new Data[data.size()]);
+ }
+ return new Data[0];
+ }
+
+ protected List<String> validateYears() {
+ final List<String> errors = new ArrayList<String>();
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
+
+ if (this.inputItem.getValueAsString() == null || this.inputItem.getValueAsString().trim().isEmpty()) {
+ errors.add(this.MESSAGES.empty_filter());
+ return errors;
+ }
+
+ final String sValue = this.inputItem.getValueAsString();// .trim().split(" ");
+ String filtered = "";
+ int goodValues = 0;
+
+ int value = 0;
+ try {
+ value = Integer.parseInt(sValue);
+ }
+ catch (final NumberFormatException e) {
+ errors.add(this.MESSAGES.wrongFormat() + ": " + sValue);
+
+ }
+ boolean isGood = false;
+ for (final String validYear : this.validInputs) {
+ /* No list contains for strings? */
+ if (sValue.equals(validYear)) {
+ isGood = true;
+ break;
+ }
+ }
+ if (!isGood) {
+ String tmp = this.MESSAGES.no_data_for_year();
+ tmp = tmp.replace("$1", sValue);
+ errors.add(tmp);
+ // continue;
+ }
+ goodValues++;
+ if (goodValues > 1) {
+ filtered += " " + Integer.toString(value);
+ } else {
+ filtered = Integer.toString(value);
+ }
+
+ return errors;
+ }
+
+ protected void fetchSedimentLoadData() {
+ final Config config = Config.getInstance();
+ final String locale = config.getLocale();
+
+ final ArtifactDescription adescr = this.artifact.getArtifactDescription();
+ final DataList[] data = adescr.getOldData();
+
+ final double[] km = this.artifact.getArtifactDescription().getKMRange();
+ final String river = this.artifact.getArtifactDescription().getRiver();
+
+ String sq_ti_id = "";
+ this.validInputs = new ArrayList<String>(data.length);
+ for (final DataList element : data) {
+ final Data str = getData(element.getAll(), "sq_ti_id");
+ if (str != null) {
+ final DataItem[] strItems = str.getItems();
+ sq_ti_id = strItems[0].getStringValue();
+ break;
+ }
+ }
+
+ if (sq_ti_id.isEmpty()) {
+ GWT.log("Failed to find sq time interval id in data.");
+ }
+
+ this.sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id, new AsyncCallback<SedimentLoadInfoObject[]>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not recieve sediment load informations.");
+ SC.warn(LoadSedimentHeightPanel.this.MSG.getString(caught.getMessage()));
+ }
+
+ @Override
+ public void onSuccess(final SedimentLoadInfoObject[] sedLoad) {
+ final int num = sedLoad != null ? sedLoad.length : 0;
+ GWT.log("Recieved " + num + " sediment load informations.");
+
+ if (num == 0) {
+ return;
+ }
+
+ addSedimentLoadInfo(sedLoad);
+ }
+ });
+ }
+
+ protected void addSedimentLoadInfo(final SedimentLoadInfoObject[] sedLoad) {
+ for (final SedimentLoadInfoObject sl : sedLoad) {
+ final SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
+ this.sedLoadTable.addData(rec);
+ this.validInputs.add(rec.getDate());
+ }
+ }
+
+ protected void appendValue(final String year) { // SINGLE-Input
+ final String oldYears = this.inputItem.getValueAsString();
+ this.inputItem.setValue(year);
+ }
+}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleEpochPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleEpochPanel.java Wed May 09 16:36:55 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleEpochPanel.java Fri May 11 17:04:35 2018 +0200
@@ -16,6 +16,7 @@
import org.dive4elements.river.client.client.services.SedimentLoadInfoService;
import org.dive4elements.river.client.client.services.SedimentLoadInfoServiceAsync;
import org.dive4elements.river.client.client.ui.AbstractUIProvider;
+import org.dive4elements.river.client.client.ui.PanelHelper;
import org.dive4elements.river.client.shared.model.ArtifactDescription;
import org.dive4elements.river.client.shared.model.Data;
import org.dive4elements.river.client.shared.model.DataItem;
@@ -30,23 +31,21 @@
import com.smartgwt.client.data.Record;
import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Button;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.Label;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.TextItem;
import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
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;
public class LoadSingleEpochPanel extends AbstractUIProvider {
+ private static final long serialVersionUID = 1L;
+
protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class);
protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
@@ -59,12 +58,9 @@
protected List<String> validYears;
public Canvas createWidget(final DataList data) {
- final HLayout input = new HLayout();
+ // final HLayout input = new HLayout();
final VLayout root = new VLayout();
- final VLayout grid = new VLayout();
- final VLayout intFields = new VLayout();
- final Button add = new Button(this.MSG.add_date());
- this.elements = new ListGrid();
+ // final VLayout intFields = new VLayout();
final Label title = new Label(data.get(0).getDescription());
title.setHeight("25px");
@@ -73,76 +69,23 @@
form.setNumCols(4);
this.start = new TextItem(this.MSG.from());
this.start.setWidth(60);
+ this.start.setValue(2000);// TODO: get minDate
+ this.start.setCanEdit(false);
this.start.setValidators(new IsIntegerValidator());
this.end = new TextItem(this.MSG.to());
this.end.setWidth(60);
this.end.setValidators(new IsIntegerValidator());
+ this.end.setCanEdit(false);
+ this.end.setValue(2005);// TODO: get maxDate
form.setFields(this.start, this.end);
- add.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent ce) {
- final String v1 = LoadSingleEpochPanel.this.start.getValueAsString();
- final String v2 = LoadSingleEpochPanel.this.end.getValueAsString();
- if (v1 == null || v2 == null) {
- return;
- }
- if (!isValidEpoch(v1, v2)) {
- return;
- }
- final ListGridRecord r = new ListGridRecord();
- r.setAttribute("from", v1);
- r.setAttribute("to", v2);
- LoadSingleEpochPanel.this.elements.addData(r);
- }
- });
- final Label sel = new Label(this.MSG.select());
- sel.setHeight(25);
- this.elements.setWidth(185);
- this.elements.setHeight(120);
- this.elements.setShowHeaderContextMenu(false);
- this.elements.setCanReorderFields(false);
- this.elements.setCanSort(false);
- this.elements.setCanEdit(false);
- final ListGridField from = new ListGridField("from", this.MSG.from());
- final ListGridField to = new ListGridField("to", this.MSG.to());
- from.setWidth(70);
- to.setWidth(70);
+ // intFields.addMember(form);
+ // input.addMember(intFields);
+ root.addMember(title);
+ root.addMember(PanelHelper.getSpacer(10));
+ root.addMember(form);
- final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") {
- {
- setType(ListGridFieldType.ICON);
- setIcon(GWT.getHostPageBaseURL() + LoadSingleEpochPanel.this.MSG.removeFeature());
- setCanEdit(false);
- setCanFilter(false);
- setCanSort(false);
- setCanGroupBy(false);
- setCanFreeze(false);
- setWidth(25);
- }
- };
-
- this.elements.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(final RecordClickEvent event) {
- // Just handle remove-clicks
- if (!event.getField().getName().equals(removeField.getName())) {
- return;
- }
- event.getViewer().removeData(event.getRecord());
- }
- });
-
- this.elements.setFields(from, to, removeField);
-
- intFields.addMember(form);
- intFields.addMember(add);
- grid.addMember(sel);
- grid.addMember(this.elements);
- input.addMember(intFields);
- input.addMember(grid);
- root.addMember(title);
- root.addMember(input);
+ // root.addMember(input);
return root;
}
@@ -158,7 +101,7 @@
label.setHeight(25);
final List<Data> items = dataList.getAll();
- final Data str = getData(items, "epochs");
+ final Data str = getData(items, "totalepoch");
final DataItem[] strItems = str.getItems();
final String[] pairs = strItems[0].getLabel().split(";");
@@ -194,7 +137,7 @@
}
private Canvas createHelper() {
- this.sedLoadTable = new ListGrid();
+ this.sedLoadTable = new ListGrid(); // TODO: get minMax from right datasource
this.sedLoadTable.setShowHeaderContextMenu(false);
this.sedLoadTable.setWidth100();
this.sedLoadTable.setShowRecordComponents(true);
@@ -219,7 +162,7 @@
@Override
public void onRecordClick(final RecordClickEvent e) {
final Record r = e.getRecord();
- LoadSingleEpochPanel.this.start.setValue(r.getAttribute("date"));
+ LoadSingleEpochPanel.this.start.setValue("darf nicht geändert werden");// r.getAttribute("date"));
}
});
@@ -227,7 +170,7 @@
@Override
public void onRecordClick(final RecordClickEvent e) {
final Record r = e.getRecord();
- LoadSingleEpochPanel.this.end.setValue(r.getAttribute("date"));
+ LoadSingleEpochPanel.this.end.setValue("darf nicht geändert werden");
}
});
@@ -247,19 +190,21 @@
protected Data[] getData() {
final List<Data> data = new ArrayList<Data>();
- final ListGridRecord[] lgr = this.elements.getRecords();
- if (lgr.length == 0) {
- return new Data[0];
- }
+ // final ListGridRecord[] lgr = this.elements.getRecords();
+ // if (lgr.length == 0) {
+ // return new Data[0];
+ // }
String d = "";
- for (final ListGridRecord element : lgr) {
- final Record r = element;
- d += r.getAttribute("from") + "," + r.getAttribute("to");
- d += ";";
- }
+ // // for (final ListGridRecord element : lgr) {
+ // final Record r = element;
+ // d += r.getAttribute("from") + "," + r.getAttribute("to");
+ // d += ";";
+ // }
- final DataItem item = new DefaultDataItem("epochs", null, d);
- data.add(new DefaultData("epochs", null, null, new DataItem[] { item }));
+ d = this.start.getValueAsString() + "," + this.end.getValueAsString() + ";";
+
+ final DataItem item = new DefaultDataItem("totalepoch", null, d);
+ data.add(new DefaultData("totalepoch", null, null, new DataItem[] { item }));
return data.toArray(new Data[data.size()]);
}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java Wed May 09 16:36:55 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/LoadSingleYearPanel.java Fri May 11 17:04:35 2018 +0200
@@ -11,24 +11,6 @@
import java.util.ArrayList;
import java.util.List;
-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.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;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridField;
-import com.smartgwt.client.widgets.layout.HLayout;
-import com.smartgwt.client.widgets.layout.VLayout;
-import com.smartgwt.client.widgets.grid.events.RecordClickHandler;
-import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
-
import org.dive4elements.river.client.client.Config;
import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.client.services.SedimentLoadInfoService;
@@ -43,40 +25,55 @@
import org.dive4elements.river.client.shared.model.SedimentLoadInfoObject;
import org.dive4elements.river.client.shared.model.SedimentLoadInfoRecord;
+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.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;
+import com.smartgwt.client.widgets.form.fields.IntegerItem;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+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;
-public class LoadSingleYearPanel
-extends AbstractUIProvider
-{
- protected SedimentLoadInfoServiceAsync sedLoadInfoService =
- GWT.create(SedimentLoadInfoService.class);
+public class LoadSingleYearPanel extends AbstractUIProvider {
+ protected SedimentLoadInfoServiceAsync sedLoadInfoService = GWT.create(SedimentLoadInfoService.class); // TODO: find right datasource
+ private static final String datakey = "singleyear";
protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
- private TextItem yearsItem;
+ private TextItem inputItem;
private ListGrid sedLoadTable;
- protected List<String> validYears;
+ protected List<String> validInputs;
- public LoadSingleYearPanel () {
+ public LoadSingleYearPanel() {
}
@Override
- public Canvas createOld(DataList dataList) {
- List<Data> items = dataList.getAll();
- Data years = getData(items, "years");
- DataItem[] yearsItems = years.getItems();
+ public Canvas createOld(final DataList dataList) {
+ final List<Data> items = dataList.getAll();
+ final Data item = getData(items, datakey);
+ final DataItem[] alreadySetItems = item.getItems();
- String v1 = yearsItems[0].getStringValue().replace(" ", ", ");
+ final String v1 = alreadySetItems[0].getStringValue().replace(" ", ", ");
- Label old = new Label(v1);
- HLayout layout = new HLayout();
+ final Label old = new Label(v1);
+ final HLayout layout = new HLayout();
layout.setWidth("400px");
- Label label = new Label(dataList.getLabel());
+ final Label label = new Label(dataList.getLabel());
label.setWidth("200px");
- Canvas back = getBackButton(dataList.getState());
+ final Canvas back = getBackButton(dataList.getState());
layout.addMember(label);
layout.addMember(old);
@@ -91,14 +88,14 @@
}
@Override
- public Canvas create(DataList data) {
- VLayout layout = new VLayout();
+ public Canvas create(final DataList data) {
+ final VLayout layout = new VLayout();
- Canvas helper = createHelper();
+ final Canvas helper = createHelper();
this.helperContainer.addMember(helper);
- Canvas submit = getNextButton();
- Canvas widget = createWidget(data);
+ final Canvas submit = getNextButton();
+ final Canvas widget = createWidget(data);
layout.addMember(widget);
layout.addMember(submit);
@@ -109,54 +106,52 @@
}
private Canvas createHelper() {
- sedLoadTable = new ListGrid();
- sedLoadTable.setShowHeaderContextMenu(false);
- sedLoadTable.setWidth100();
- sedLoadTable.setShowRecordComponents(true);
- sedLoadTable.setShowRecordComponentsByCell(true);
- sedLoadTable.setHeight100();
- sedLoadTable.setEmptyMessage(MSG.empty_table());
- sedLoadTable.setCanReorderFields(false);
+ this.sedLoadTable = new ListGrid();
+ this.sedLoadTable.setShowHeaderContextMenu(false);
+ this.sedLoadTable.setWidth100();
+ this.sedLoadTable.setShowRecordComponents(true);
+ this.sedLoadTable.setShowRecordComponentsByCell(true);
+ this.sedLoadTable.setHeight100();
+ this.sedLoadTable.setEmptyMessage(this.MSG.empty_table());
+ this.sedLoadTable.setCanReorderFields(false);
- ListGridField date = new ListGridField("date", MSG.year());
+ final ListGridField date = new ListGridField("date", this.MSG.year());
date.setType(ListGridFieldType.TEXT);
date.setWidth(100);
- ListGridField descr =
- new ListGridField("description", MSG.description());
+ final ListGridField descr = new ListGridField("description", this.MSG.description());
descr.setType(ListGridFieldType.TEXT);
descr.setWidth("*");
- String baseUrl = GWT.getHostPageBaseURL();
- ListGridField pinFrom = new ListGridField(
- "fromIcon", MESSAGES.selection());
- pinFrom.setWidth (60);
- pinFrom.setType (ListGridFieldType.ICON);
- pinFrom.setCellIcon(baseUrl + MESSAGES.markerGreen());
+ final String baseUrl = GWT.getHostPageBaseURL();
+ final ListGridField pinFrom = new ListGridField("fromIcon", this.MESSAGES.selection());
+ pinFrom.setWidth(60);
+ pinFrom.setType(ListGridFieldType.ICON);
+ pinFrom.setCellIcon(baseUrl + this.MESSAGES.markerGreen());
- pinFrom.addRecordClickHandler (new RecordClickHandler () {
+ pinFrom.addRecordClickHandler(new RecordClickHandler() {
@Override
- public void onRecordClick (RecordClickEvent e) {
- Record r = e.getRecord();
- appendYear(r.getAttribute("date"));
+ public void onRecordClick(final RecordClickEvent e) {
+ final Record r = e.getRecord();
+ appendValue(r.getAttribute("date"));
}
});
- sedLoadTable.setFields(pinFrom, date, descr);
- return sedLoadTable;
+ this.sedLoadTable.setFields(pinFrom, date, descr);
+ return this.sedLoadTable;
}
- public Canvas createWidget(DataList data) {
- VLayout layout = new VLayout();
+ public Canvas createWidget(final DataList data) {
+ final VLayout layout = new VLayout();
- Label title = new Label(data.get(0).getDescription());
+ final Label title = new Label(data.get(0).getDescription());
title.setHeight("25px");
- DynamicForm form = new DynamicForm();
+ final DynamicForm form = new DynamicForm();
form.setNumCols(4);
- yearsItem = new TextItem(MSG.years());
- yearsItem.setValidators(new IsIntegerValidator());
- form.setFields(yearsItem);
+ this.inputItem = new IntegerItem(this.MSG.year());
+ this.inputItem.setShowTitle(false);
+ form.setFields(this.inputItem);
layout.addMember(title);
layout.addMember(form);
@@ -167,16 +162,12 @@
@Override
protected Data[] getData() {
validateYears();
- if (yearsItem != null && !yearsItem.getValueAsString().isEmpty()) {
- List<Data> data = new ArrayList<Data>();
+ if (this.inputItem != null && !this.inputItem.getValueAsString().isEmpty()) {
+ final List<Data> data = new ArrayList<Data>();
- DataItem yearsdata = new DefaultDataItem(
- "years", "years", yearsItem.getValueAsString().trim());
- data.add(new DefaultData(
- "years",
- null,
- null,
- new DataItem[] { yearsdata }));
+ final DataItem yearsdata = new DefaultDataItem(datakey, datakey, this.inputItem.getValueAsString().trim()); // DATA-STRING: years (in
+ // uinfo.xml)
+ data.add(new DefaultData(datakey, null, null, new DataItem[] { yearsdata }));
return data.toArray(new Data[data.size()]);
}
@@ -184,113 +175,106 @@
}
protected List<String> validateYears() {
- List<String> errors = new ArrayList<String>();
- NumberFormat nf = NumberFormat.getDecimalFormat();
+ final List<String> errors = new ArrayList<String>();
+ final NumberFormat nf = NumberFormat.getDecimalFormat();
- if (yearsItem.getValueAsString() == null ||
- yearsItem.getValueAsString().trim().isEmpty()) {
- errors.add(MESSAGES.empty_filter());
+ if (this.inputItem.getValueAsString() == null || this.inputItem.getValueAsString().trim().isEmpty()) {
+ errors.add(this.MESSAGES.empty_filter());
return errors;
}
- String [] sValues = yearsItem.getValueAsString().trim().split(" ");
+ final String sValue = this.inputItem.getValueAsString();// .trim().split(" ");
String filtered = "";
int goodValues = 0;
- for (String sValue: sValues) {
- int value;
- try {
- value = Integer.parseInt(sValue);
- } catch (NumberFormatException e) {
- errors.add(MESSAGES.wrongFormat() + ": " + sValue);
- continue;
+
+ int value = 0;
+ try {
+ value = Integer.parseInt(sValue);
+ }
+ catch (final NumberFormatException e) {
+ errors.add(this.MESSAGES.wrongFormat() + ": " + sValue);
+
+ }
+ boolean isGood = false;
+ for (final String validYear : this.validInputs) {
+ /* No list contains for strings? */
+ if (sValue.equals(validYear)) {
+ isGood = true;
+ break;
}
- boolean isGood = false;
- for (String validYear: validYears) {
- /* No list contains for strings? */
- if (sValue.equals(validYear)) {
- isGood = true;
- break;
- }
- }
- if (!isGood) {
- String tmp = MESSAGES.no_data_for_year();
- tmp = tmp.replace("$1", sValue);
- errors.add(tmp);
- continue;
- }
- goodValues++;
- if (goodValues > 1) {
- filtered += " " + Integer.toString(value);
- } else {
- filtered = Integer.toString(value);
- }
+ }
+ if (!isGood) {
+ String tmp = this.MESSAGES.no_data_for_year();
+ tmp = tmp.replace("$1", sValue);
+ errors.add(tmp);
+ // continue;
+ }
+ goodValues++;
+ if (goodValues > 1) {
+ filtered += " " + Integer.toString(value);
+ } else {
+ filtered = Integer.toString(value);
}
return errors;
}
- protected void fetchSedimentLoadData() {
- Config config = Config.getInstance();
- String locale = config.getLocale ();
+ protected void fetchSedimentLoadData() {
+ final Config config = Config.getInstance();
+ final String locale = config.getLocale();
- ArtifactDescription adescr = artifact.getArtifactDescription();
- DataList[] data = adescr.getOldData();
+ final ArtifactDescription adescr = this.artifact.getArtifactDescription();
+ final DataList[] data = adescr.getOldData();
- double[] km = artifact.getArtifactDescription().getKMRange();
- String river = artifact.getArtifactDescription().getRiver();
+ final double[] km = this.artifact.getArtifactDescription().getKMRange();
+ final String river = this.artifact.getArtifactDescription().getRiver();
String sq_ti_id = "";
- validYears = new ArrayList<String>(data.length);
- for (int i = 0; i < data.length; i++) {
- Data str = getData(data[i].getAll(), "sq_ti_id");
+ this.validInputs = new ArrayList<String>(data.length);
+ for (final DataList element : data) {
+ final Data str = getData(element.getAll(), "sq_ti_id");
if (str != null) {
- DataItem[] strItems = str.getItems();
+ final DataItem[] strItems = str.getItems();
sq_ti_id = strItems[0].getStringValue();
break;
}
}
- if (sq_ti_id.isEmpty()){
+ if (sq_ti_id.isEmpty()) {
GWT.log("Failed to find sq time interval id in data.");
}
- sedLoadInfoService.getSedimentLoadInfo(
- locale, river, "single", km[0], km[1], sq_ti_id,
- new AsyncCallback<SedimentLoadInfoObject[]>() {
- public void onFailure(Throwable caught) {
- GWT.log("Could not recieve sediment load informations.");
- SC.warn(MSG.getString(caught.getMessage()));
+ this.sedLoadInfoService.getSedimentLoadInfo(locale, river, "single", km[0], km[1], sq_ti_id, new AsyncCallback<SedimentLoadInfoObject[]>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not recieve sediment load informations.");
+ SC.warn(LoadSingleYearPanel.this.MSG.getString(caught.getMessage()));
+ }
+
+ @Override
+ public void onSuccess(final SedimentLoadInfoObject[] sedLoad) {
+ final int num = sedLoad != null ? sedLoad.length : 0;
+ GWT.log("Recieved " + num + " sediment load informations.");
+
+ if (num == 0) {
+ return;
}
- public void onSuccess(SedimentLoadInfoObject[] sedLoad) {
- int num = sedLoad != null ? sedLoad.length :0;
- GWT.log("Recieved " + num + " sediment load informations.");
-
- if (num == 0) {
- return;
- }
-
- addSedimentLoadInfo(sedLoad);
- }
+ addSedimentLoadInfo(sedLoad);
}
- );
+ });
}
-
- protected void addSedimentLoadInfo (SedimentLoadInfoObject[] sedLoad) {
- for(SedimentLoadInfoObject sl: sedLoad) {
- SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
- sedLoadTable.addData(rec);
- validYears.add(rec.getDate());
+ protected void addSedimentLoadInfo(final SedimentLoadInfoObject[] sedLoad) {
+ for (final SedimentLoadInfoObject sl : sedLoad) {
+ final SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
+ this.sedLoadTable.addData(rec);
+ this.validInputs.add(rec.getDate());
}
}
- protected void appendYear (String year) {
- String oldYears = yearsItem.getValueAsString();
- if (oldYears != null && !oldYears.isEmpty()) {
- yearsItem.setValue(oldYears.trim() + " " + year);
- } else {
- yearsItem.setValue(year);
- }
+ protected void appendValue(final String year) { // SINGLE-Input
+ final String oldYears = this.inputItem.getValueAsString();
+ this.inputItem.setValue(year);
}
}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTable.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTable.java Wed May 09 16:36:55 2018 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
- * Software engineering by Intevation GmbH
- *
- * This file is Free Software under the GNU AGPL (>=v3)
- * and comes with ABSOLUTELY NO WARRANTY! Check out the
- * documentation coming with Dive4Elements River for details.
- */
-
-package org.dive4elements.river.client.client.ui.uinfo;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.dive4elements.river.client.client.ui.AbstractUIProvider;
-import org.dive4elements.river.client.shared.model.Data;
-import org.dive4elements.river.client.shared.model.DataItem;
-import org.dive4elements.river.client.shared.model.DataList;
-import org.dive4elements.river.client.shared.model.DefaultData;
-import org.dive4elements.river.client.shared.model.DefaultDataItem;
-
-import com.google.gwt.core.client.GWT;
-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.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.form.DynamicForm;
-import com.smartgwt.client.widgets.form.fields.TextItem;
-import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
-import com.smartgwt.client.widgets.form.validator.IsStringValidator;
-import com.smartgwt.client.widgets.form.validator.Validator;
-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;
-
-public class VegetationzonesTable extends AbstractUIProvider {
- private static final long serialVersionUID = 1L;
-
- protected ListGrid elements;
- private TextItem vegzone;
- private TextItem start;
- private TextItem end;
- private ListGrid table;
-
- private TextItem createItem(final String identifier, final String title, final int width, final Validator... validator) {
- final TextItem item = new TextItem(identifier, title);
- item.setWidth(width);
- item.setWrapTitle(false);
- item.setValidators(validator);// eigentlich überflüssig, oder?
- return item;
- }
-
- public Canvas createWidget(final DataList data) {
-
- final VLayout root = new VLayout();
- final HLayout input = new HLayout();
- final VLayout tableLayout = new VLayout();
- final HLayout fields = new HLayout();
- final HLayout fields2 = new HLayout();
- final VLayout spacer = new VLayout();
- spacer.setHeight(10);
-
- final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific
- this.elements = new ListGrid();
-
- final Label title = new Label(data.get(0).getDescription());
- title.setHeight("35px"); // orig:25
-
- this.vegzone = createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
- this.start = createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
- this.end = createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
-
- final DynamicForm form1 = new DynamicForm();
- final DynamicForm form2 = new DynamicForm();
- form2.setNumCols(5);
- form1.setNumCols(7);
- form1.setFields(this.vegzone);
- form2.setFields(this.start, this.end);
-
- add.addClickHandler(new ClickHandler() {
- @Override
- public void onClick(final ClickEvent ce) {
- final String v1 = VegetationzonesTable.this.start.getValueAsString();
- final String v2 = VegetationzonesTable.this.end.getValueAsString();
- final String v3 = VegetationzonesTable.this.vegzone.getValueAsString();
- if (v1 == null || v2 == null || v3 == null) {
- return;
- }
-
- final ListGridRecord r = new ListGridRecord();
- r.setAttribute("vegzone", v3);
- r.setAttribute("from", v1);
- r.setAttribute("to", v2);
- VegetationzonesTable.this.elements.addData(r);
- }
- });
-
- final Label sel = new Label(this.MSG.select());
- sel.setHeight(25);
- this.elements.setWidth(450); // 185
- this.elements.setHeight(500); // 120
- this.elements.setShowHeaderContextMenu(false);
- this.elements.setCanReorderFields(false);
- this.elements.setCanSort(false);
- this.elements.setCanEdit(false);
- final ListGridField vegzone = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
- final ListGridField from = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
- final ListGridField to = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
- vegzone.setWidth(285);
- from.setWidth(70);
- to.setWidth(70);
-
- final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") {
- {
- setType(ListGridFieldType.ICON);
- setIcon(GWT.getHostPageBaseURL() + VegetationzonesTable.this.MSG.removeFeature());
- setCanEdit(false);
- setCanFilter(false);
- setCanSort(false);
- setCanGroupBy(false);
- setCanFreeze(false);
- setWidth(25);
- }
- };
-
- this.elements.addRecordClickHandler(new RecordClickHandler() {
- @Override
- public void onRecordClick(final RecordClickEvent event) {
- // Just handle remove-clicks
- if (!event.getField().getName().equals(removeField.getName())) {
- return;
- }
- event.getViewer().removeData(event.getRecord());
- }
- });
-
- this.elements.setFields(vegzone, from, to, removeField);
-
- fields.addMember(form1);
- fields2.addMember(form2);
- // fields2.addMember(add);
-
- tableLayout.addMember(this.elements);
- root.addMember(title);
- root.addMember(input);
- root.addMember(tableLayout);
- root.addMember(spacer);
- root.addMember(fields);
- root.addMember(fields2);
- root.addMember(spacer);
- root.addMember(add);
- root.addMember(spacer);
- root.addMember(spacer);
-
- return root;
- }
-
- @Override
- public Canvas createOld(final DataList dataList) {
- final HLayout layout = new HLayout();
- layout.setWidth("400px");
- final VLayout vLayout = new VLayout();
- vLayout.setWidth(130);
- final Label label = new Label(dataList.getLabel());
- label.setWidth("200px");
- label.setHeight(25);
-
- final List<Data> items = dataList.getAll();
- final Data str = getData(items, "vegzones");
- final DataItem[] strItems = str.getItems();
-
- final String[] entries = strItems[0].getLabel().split(";");
- for (final String entry : entries) {
- final String[] vals = entry.split(",");
- final Label dateLabel = new Label(vals[0] + " - " + vals[1]);
- dateLabel.setHeight(20);
- vLayout.addMember(dateLabel);
- }
- final Canvas back = getBackButton(dataList.getState());
- layout.addMember(label);
- layout.addMember(vLayout);
- layout.addMember(back);
-
- return layout;
- }
-
- @Override
- public Canvas create(final DataList data) {
- final VLayout layout = new VLayout();
- final Canvas helper = createHelper();
- this.helperContainer.addMember(helper);
-
- final Canvas submit = getNextButton();
- final Canvas widget = createWidget(data);
-
- layout.addMember(widget);
- layout.addMember(submit); // TODO: SUBMIT
-
- // fetchSedimentLoadData(); //TODO: feed from database...
-
- return layout;
- }
-
- private Canvas createHelper() {
- this.table = new ListGrid();
- this.table.setShowHeaderContextMenu(false);
- this.table.setWidth100();
- this.table.setShowRecordComponents(true);
- this.table.setShowRecordComponentsByCell(true);
- this.table.setHeight100();
- this.table.setEmptyMessage(this.MSG.empty_table());
- this.table.setCanReorderFields(false);
-
- /* Input support pins */
- // final String baseUrl = GWT.getHostPageBaseURL();
- // final ListGridField pinFrom = new ListGridField("fromIcon", this.MSG.uinfo_vegetation_zones_from());
- // pinFrom.setWidth(300);
- // pinFrom.setType(ListGridFieldType.ICON);
- // pinFrom.setCellIcon(baseUrl + this.MSG.markerGreen());
- //
- // final ListGridField pinTo = new ListGridField("toIcon", this.MSG.uinfo_vegetation_zones_to());
- // pinTo.setType(ListGridFieldType.ICON);
- // pinTo.setWidth(300);
- // pinTo.setCellIcon(baseUrl + this.MSG.markerRed());
- //
- // pinFrom.addRecordClickHandler(new RecordClickHandler() {
- // @Override
- // public void onRecordClick(final RecordClickEvent e) {
- // final Record r = e.getRecord();
- // VegetationzonesTable.this.vegzone.setValue(r.getAttribute("date")); // date??
- // }
- // });
- //
- // pinFrom.addRecordClickHandler(new RecordClickHandler() {
- // @Override
- // public void onRecordClick(final RecordClickEvent e) {
- // final Record r = e.getRecord();
- // VegetationzonesTable.this.start.setValue(r.getAttribute("date"));
- // }
- // });
- //
- // pinTo.addRecordClickHandler(new RecordClickHandler() {
- // @Override
- // public void onRecordClick(final RecordClickEvent e) {
- // final Record r = e.getRecord();
- // VegetationzonesTable.this.end.setValue(r.getAttribute("date"));
- // }
- // });
- //
- // final ListGridField date = new ListGridField("date", this.MSG.year());
- // date.setType(ListGridFieldType.TEXT);
- // date.setWidth(100);
- //
- // final ListGridField descr = new ListGridField("description", this.MSG.description());
- // descr.setType(ListGridFieldType.TEXT);
- // descr.setWidth("*");
- //
- // this.table.setFields(pinFrom, pinTo, date, descr);
- return this.table;
- }
-
- @Override
- protected Data[] getData() {
- final List<Data> data = new ArrayList<Data>();
-
- final ListGridRecord[] lgr = this.elements.getRecords();
- if (lgr.length == 0) {
- return new Data[0];
- }
- String d = "";
- for (final ListGridRecord element : lgr) {
- final Record r = element;
- d += r.getAttribute("vegzone") + "," + r.getAttribute("from") + "," + r.getAttribute("to");
- d += ";";
- }
-
- final DataItem item = new DefaultDataItem("vegzones", null, d); // DATA-key
- data.add(new DefaultData("vegzones", null, null, new DataItem[] { item }));
- return data.toArray(new Data[data.size()]);
- }
-
-}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTableEditPanel.java Fri May 11 17:04:35 2018 +0200
@@ -0,0 +1,279 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.client.client.ui.uinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dive4elements.river.client.client.ui.AbstractUIProvider;
+import org.dive4elements.river.client.client.ui.PanelHelper;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataItem;
+import org.dive4elements.river.client.shared.model.DataList;
+import org.dive4elements.river.client.shared.model.DefaultData;
+import org.dive4elements.river.client.shared.model.DefaultDataItem;
+
+import com.google.gwt.core.client.GWT;
+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.events.ClickEvent;
+import com.smartgwt.client.widgets.events.ClickHandler;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
+import com.smartgwt.client.widgets.form.validator.IsStringValidator;
+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;
+
+public class VegetationzonesTableEditPanel extends AbstractUIProvider {
+ private static final long serialVersionUID = 1L;
+
+ protected ListGrid elements;
+ private TextItem vegzone;
+ private TextItem start;
+ private TextItem end;
+ private ListGrid table;
+
+ private static final String datakey = "vegzones";
+
+ public Canvas createWidget(final DataList data) {
+
+ final VLayout root = new VLayout();
+ final HLayout input = new HLayout();
+ final VLayout tableLayout = new VLayout();
+ final HLayout fields = new HLayout();
+ final HLayout fields2 = new HLayout();
+
+ final Button add = new Button(this.MSG.add_date()); // TODO: make key more generic or change to more specific
+ this.elements = new ListGrid();
+
+ final Label title = new Label(data.get(0).getDescription());
+ title.setHeight("35px"); // orig:25
+
+ this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
+ this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
+ this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
+
+ final DynamicForm form1 = new DynamicForm();
+ final DynamicForm form2 = new DynamicForm();
+ form2.setNumCols(5);
+ form1.setNumCols(7);
+ form1.setFields(this.vegzone);
+ form2.setFields(this.start, this.end);
+
+ add.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent ce) {
+ final String v1 = VegetationzonesTableEditPanel.this.start.getValueAsString();
+ final String v2 = VegetationzonesTableEditPanel.this.end.getValueAsString();
+ final String v3 = VegetationzonesTableEditPanel.this.vegzone.getValueAsString();
+ if (v1 == null || v2 == null || v3 == null) {
+ return;
+ }
+
+ final ListGridRecord r = new ListGridRecord();
+ r.setAttribute("vegzone", v3);
+ r.setAttribute("from", v1);
+ r.setAttribute("to", v2);
+ VegetationzonesTableEditPanel.this.elements.addData(r);
+ }
+ });
+
+ final Label sel = new Label(this.MSG.select());
+ sel.setHeight(25);
+ this.elements.setWidth(450); // 185
+ this.elements.setHeight(500); // 120
+ this.elements.setShowHeaderContextMenu(false);
+ this.elements.setCanReorderFields(false);
+ this.elements.setCanSort(false);
+ this.elements.setCanEdit(false);
+ final ListGridField vegzone = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
+ final ListGridField from = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
+ final ListGridField to = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
+ vegzone.setWidth(285);
+ from.setWidth(70);
+ to.setWidth(70);
+
+ final ListGridField removeField = new ListGridField("_removeRecord", "Remove Record") {
+ {
+ setType(ListGridFieldType.ICON);
+ setIcon(GWT.getHostPageBaseURL() + VegetationzonesTableEditPanel.this.MSG.removeFeature());
+ setCanEdit(false);
+ setCanFilter(false);
+ setCanSort(false);
+ setCanGroupBy(false);
+ setCanFreeze(false);
+ setWidth(25);
+ }
+ };
+
+ this.elements.addRecordClickHandler(new RecordClickHandler() {
+ @Override
+ public void onRecordClick(final RecordClickEvent event) {
+ // Just handle remove-clicks
+ if (!event.getField().getName().equals(removeField.getName())) {
+ return;
+ }
+ event.getViewer().removeData(event.getRecord());
+ }
+ });
+
+ this.elements.setFields(vegzone, from, to, removeField);
+
+ fields.addMember(form1);
+ fields2.addMember(form2);
+ // fields2.addMember(add);
+
+ tableLayout.addMember(this.elements);
+ root.addMember(title);
+ root.addMember(input);
+ root.addMember(tableLayout);
+ root.addMember(PanelHelper.getSpacer(10));
+ root.addMember(fields);
+ root.addMember(fields2);
+ root.addMember(PanelHelper.getSpacer(10));
+ root.addMember(add);
+ root.addMember(PanelHelper.getSpacer(20));
+
+ return root;
+ }
+
+ @Override
+ public Canvas createOld(final DataList dataList) {
+ final HLayout layout = new HLayout();
+ layout.setWidth("400px");
+ final VLayout vLayout = new VLayout();
+ vLayout.setWidth(130);
+ final Label label = new Label(dataList.getLabel());
+ label.setWidth("200px");
+ label.setHeight(25);
+
+ final List<Data> items = dataList.getAll();
+ final Data str = getData(items, datakey);
+ final DataItem[] strItems = str.getItems();
+
+ final String[] entries = strItems[0].getLabel().split(";");
+ for (final String entry : entries) {
+ final String[] vals = entry.split(",");
+ final Label dateLabel = new Label(vals[0] + " - " + vals[1]);
+ dateLabel.setHeight(20);
+ vLayout.addMember(dateLabel);
+ }
+ final Canvas back = getBackButton(dataList.getState());
+ layout.addMember(label);
+ layout.addMember(vLayout);
+ layout.addMember(back);
+
+ return layout;
+ }
+
+ @Override
+ public Canvas create(final DataList data) {
+ final VLayout layout = new VLayout();
+ final Canvas helper = createHelper();
+ this.helperContainer.addMember(helper);
+
+ final Canvas submit = getNextButton();
+ final Canvas widget = createWidget(data);
+
+ layout.addMember(widget);
+ layout.addMember(submit); // TODO: SUBMIT
+
+ // fetchSedimentLoadData(); //TODO: feed from database...
+
+ return layout;
+ }
+
+ private Canvas createHelper() {
+ this.table = new ListGrid();
+ this.table.setShowHeaderContextMenu(false);
+ this.table.setWidth100();
+ this.table.setShowRecordComponents(true);
+ this.table.setShowRecordComponentsByCell(true);
+ this.table.setHeight100();
+ this.table.setEmptyMessage(this.MSG.empty_table());
+ this.table.setCanReorderFields(false);
+
+ /* Input support pins */
+ // final String baseUrl = GWT.getHostPageBaseURL();
+ // final ListGridField pinFrom = new ListGridField("fromIcon", this.MSG.uinfo_vegetation_zones_from());
+ // pinFrom.setWidth(300);
+ // pinFrom.setType(ListGridFieldType.ICON);
+ // pinFrom.setCellIcon(baseUrl + this.MSG.markerGreen());
+ //
+ // final ListGridField pinTo = new ListGridField("toIcon", this.MSG.uinfo_vegetation_zones_to());
+ // pinTo.setType(ListGridFieldType.ICON);
+ // pinTo.setWidth(300);
+ // pinTo.setCellIcon(baseUrl + this.MSG.markerRed());
+ //
+ // pinFrom.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.vegzone.setValue(r.getAttribute("date")); // date??
+ // }
+ // });
+ //
+ // pinFrom.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.start.setValue(r.getAttribute("date"));
+ // }
+ // });
+ //
+ // pinTo.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.end.setValue(r.getAttribute("date"));
+ // }
+ // });
+ //
+ // final ListGridField date = new ListGridField("date", this.MSG.year());
+ // date.setType(ListGridFieldType.TEXT);
+ // date.setWidth(100);
+ //
+ // final ListGridField descr = new ListGridField("description", this.MSG.description());
+ // descr.setType(ListGridFieldType.TEXT);
+ // descr.setWidth("*");
+ //
+ // this.table.setFields(pinFrom, pinTo, date, descr);
+ return this.table;
+ }
+
+ @Override
+ protected Data[] getData() {
+ final List<Data> data = new ArrayList<Data>();
+
+ final ListGridRecord[] lgr = this.elements.getRecords();
+ if (lgr.length == 0) {
+ return new Data[0];
+ }
+ String d = "";
+ for (final ListGridRecord element : lgr) {
+ final Record r = element;
+ d += r.getAttribute("vegzone") + "," + r.getAttribute("from") + "," + r.getAttribute("to");
+ d += ";";
+ }
+
+ final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key
+ data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
+ return data.toArray(new Data[data.size()]);
+ }
+
+}
diff -r 58af9b81a97b -r b5d7a9d79837 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/uinfo/VegetationzonesTablePanel.java Fri May 11 17:04:35 2018 +0200
@@ -0,0 +1,257 @@
+/* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU AGPL (>=v3)
+ * and comes with ABSOLUTELY NO WARRANTY! Check out the
+ * documentation coming with Dive4Elements River for details.
+ */
+
+package org.dive4elements.river.client.client.ui.uinfo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.dive4elements.river.client.client.ui.AbstractUIProvider;
+import org.dive4elements.river.client.client.ui.PanelHelper;
+import org.dive4elements.river.client.shared.model.Data;
+import org.dive4elements.river.client.shared.model.DataItem;
+import org.dive4elements.river.client.shared.model.DataList;
+import org.dive4elements.river.client.shared.model.DefaultData;
+import org.dive4elements.river.client.shared.model.DefaultDataItem;
+
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.Label;
+import com.smartgwt.client.widgets.form.fields.TextItem;
+import com.smartgwt.client.widgets.form.validator.IsIntegerValidator;
+import com.smartgwt.client.widgets.form.validator.IsStringValidator;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+import com.smartgwt.client.widgets.layout.HLayout;
+import com.smartgwt.client.widgets.layout.VLayout;
+
+public class VegetationzonesTablePanel extends AbstractUIProvider {
+ private static final long serialVersionUID = 1L;
+
+ protected ListGrid elements;
+ private TextItem vegzone;
+ private TextItem start;
+ private TextItem end;
+ private ListGrid table;
+
+ private static final String datakey = "vegzones";
+
+ public Canvas createWidget(final DataList data) {
+
+ final VLayout root = new VLayout();
+ final HLayout input = new HLayout();
+ final VLayout tableLayout = new VLayout();
+
+ this.elements = new ListGrid();
+
+ final Label title = new Label(data.get(0).getDescription());
+ title.setHeight("35px"); // orig:25
+
+ this.vegzone = PanelHelper.createItem("uinfo_vegetation_zone_label", this.MSG.uinfo_vegetation_zone_label(), 200, new IsStringValidator());
+ this.start = PanelHelper.createItem("uinfo_vegetation_zones_from", this.MSG.uinfo_vegetation_zones_from(), 40, new IsIntegerValidator());
+ this.end = PanelHelper.createItem("uinfo_vegetation_zones_to", this.MSG.uinfo_vegetation_zones_to(), 40, new IsIntegerValidator());
+
+ final Label sel = new Label(this.MSG.select());
+ sel.setHeight(25);
+ this.elements.setWidth(450); // 185
+ this.elements.setHeight(500); // 120
+ this.elements.setShowHeaderContextMenu(false);
+ this.elements.setCanReorderFields(false);
+ this.elements.setCanSort(false);
+ this.elements.setCanEdit(false);
+ final ListGridField vegzone = new ListGridField("vegzone", this.MSG.uinfo_vegetation_zones_label());
+ final ListGridField from = new ListGridField("from", this.MSG.uinfo_vegetation_zones_from());
+ final ListGridField to = new ListGridField("to", this.MSG.uinfo_vegetation_zones_to());
+ vegzone.setWidth(285);
+ from.setWidth(70);
+ to.setWidth(70);
+
+ for (final Data dataItem : data.getAll()) {
+ createEntry(dataItem);
+ }
+
+ this.elements.setFields(vegzone, from, to);
+
+ tableLayout.addMember(this.elements);
+ root.addMember(title);
+ root.addMember(input);
+ root.addMember(tableLayout);
+ root.addMember(PanelHelper.getSpacer(10));
+
+ return root;
+ }
+
+ private void createEntry(final Data data) {
+
+ if (data.getItems() != null) {
+ for (final DataItem dataItem : data.getItems()) {
+ if (dataItem.getStringValue() != null) {
+ if (dataItem.getStringValue().contains(",")) {
+ final String[] vals = dataItem.getStringValue().split(",");
+ if (vals.length == 3) {
+ final String vegzone = vals[0];
+ final String from = vals[1];
+ final String to = vals[2];
+
+ if (vegzone == null || from == null || to == null) {
+ return;
+ }
+
+ final ListGridRecord r = new ListGridRecord();
+ r.setAttribute("vegzone", vegzone);
+ r.setAttribute("from", from);
+ r.setAttribute("to", to);
+ this.elements.addData(r);
+
+ }
+ }
+ }
+ }
+ }
+ }
+
+ @Override
+ public Canvas createOld(final DataList dataList) { // TODO: Veg-Table übersichtlich oben anzeigen, irgendwie abkürzen (etwa "20 Einträge")
+ final HLayout layout = new HLayout();
+ layout.setWidth("400px");
+ final VLayout vLayout = new VLayout();
+ vLayout.setWidth(130);
+ final Label label = new Label(dataList.getLabel());
+ label.setWidth("200px");
+ label.setHeight(25);
+
+ final List<Data> items = dataList.getAll();
+ final Data str = getData(items, datakey);
+ final DataItem[] strItems = str.getItems();
+
+ final String[] entries = strItems[0].getLabel().split(";");
+ for (final String entry : entries) {
+ final String[] vals = entry.split(",");
+ final Label dateLabel = new Label(vals[0] + " TODO: MAKE SELECTED ENTRIES VEGZONE FOR ARTIFACT" + vals[1]);
+ dateLabel.setHeight(20);
+ vLayout.addMember(dateLabel);
+ }
+ final Canvas back = getBackButton(dataList.getState());
+ layout.addMember(label);
+ layout.addMember(vLayout);
+ layout.addMember(back);
+
+ return layout;
+ }
+
+ @Override
+ public Canvas create(final DataList data) {
+ final VLayout layout = new VLayout();
+ final Canvas helper = createHelper();
+ this.helperContainer.addMember(helper);
+
+ final Canvas submit = getNextButton();
+ // if (data.size() == 0) { // TODO: GET DATA
+
+ data.add(getDummyData());
+
+ // }
+ final Canvas widget = createWidget(data);
+
+ layout.addMember(widget);
+ layout.addMember(submit); // TODO: SUBMIT
+
+ // fetchSedimentLoadData(); //TODO: feed from database...
+
+ return layout;
+ }
+
+ private Canvas createHelper() {
+ this.table = new ListGrid();
+ this.table.setShowHeaderContextMenu(false);
+ this.table.setWidth100();
+ this.table.setShowRecordComponents(true);
+ this.table.setShowRecordComponentsByCell(true);
+ this.table.setHeight100();
+ this.table.setEmptyMessage(this.MSG.empty_table());
+ this.table.setCanReorderFields(false);
+
+ /* Input support pins */
+ // final String baseUrl = GWT.getHostPageBaseURL();
+ // final ListGridField pinFrom = new ListGridField("fromIcon", this.MSG.uinfo_vegetation_zones_from());
+ // pinFrom.setWidth(300);
+ // pinFrom.setType(ListGridFieldType.ICON);
+ // pinFrom.setCellIcon(baseUrl + this.MSG.markerGreen());
+ //
+ // final ListGridField pinTo = new ListGridField("toIcon", this.MSG.uinfo_vegetation_zones_to());
+ // pinTo.setType(ListGridFieldType.ICON);
+ // pinTo.setWidth(300);
+ // pinTo.setCellIcon(baseUrl + this.MSG.markerRed());
+ //
+ // pinFrom.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.vegzone.setValue(r.getAttribute("date")); // date??
+ // }
+ // });
+ //
+ // pinFrom.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.start.setValue(r.getAttribute("date"));
+ // }
+ // });
+ //
+ // pinTo.addRecordClickHandler(new RecordClickHandler() {
+ // @Override
+ // public void onRecordClick(final RecordClickEvent e) {
+ // final Record r = e.getRecord();
+ // VegetationzonesTableEditPanel.this.end.setValue(r.getAttribute("date"));
+ // }
+ // });
+ //
+ // final ListGridField date = new ListGridField("date", this.MSG.year());
+ // date.setType(ListGridFieldType.TEXT);
+ // date.setWidth(100);
+ //
+ // final ListGridField descr = new ListGridField("description", this.MSG.description());
+ // descr.setType(ListGridFieldType.TEXT);
+ // descr.setWidth("*");
+ //
+ // this.table.setFields(pinFrom, pinTo, date, descr);
+ return this.table;
+ }
+
+ @Override
+ protected Data[] getData() {
+ final List<Data> data = new ArrayList<Data>();
+
+ final ListGridRecord[] lgr = this.elements.getRecords();
+ if (lgr.length == 0) {
+ return getDummyData();// return new Data[0];
+ }
+ String d = "";
+ for (final ListGridRecord element : lgr) {
+ final Record r = element;
+ d += r.getAttribute("vegzone") + "," + r.getAttribute("from") + "," + r.getAttribute("to");
+ d += ";";
+ }
+
+ final DataItem item = new DefaultDataItem(datakey, null, d); // DATA-key
+ data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
+ return data.toArray(new Data[data.size()]);
+ }
+
+ private Data[] getDummyData() {
+ final List<Data> data = new ArrayList<Data>();
+ String d = "";
+ d = d + "Zonaler Wald" + "," + "0" + "," + "5";
+ final DataItem item = new DefaultDataItem(datakey, "entryDescription", d); // DATA-key
+ data.add(new DefaultData(datakey, null, null, new DataItem[] { item }));
+ return data.toArray(new Data[data.size()]);
+ }
+
+}
More information about the Dive4Elements-commits
mailing list