[PATCH 2 of 2] (issue1448) Carry sq_ti_date in artifact description anf fix sqtipanel
Wald Commits
scm-commit at wald.intevation.org
Mon Sep 8 17:52:58 CEST 2014
# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1410191572 -7200
# Node ID b6371be363b1459e20936fdcd09937ebfbae2f93
# Parent e3fdca2c4850040bd234ae5b423390ab22d49902
(issue1448) Carry sq_ti_date in artifact description anf fix sqtipanel
The sq ti panel no longer inherits from SQOffEpoch panel as it
is now to different for that to make sense. This commit also implements
createOld for the SQ Ti panel.
diff -r e3fdca2c4850 -r b6371be363b1 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java Mon Sep 08 17:50:10 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadOffEpochPanel.java Mon Sep 08 17:52:52 2014 +0200
@@ -191,10 +191,6 @@
SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
sedLoadTable.addData(rec);
}
- if (sedLoad.length == 1) {
- /* Preselect lists with only one load. */
- sedLoadTable.selectRecords(new int[] {0});
- }
}
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r e3fdca2c4850 -r b6371be363b1 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadSQTiPanel.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadSQTiPanel.java Mon Sep 08 17:50:10 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/minfo/SedLoadSQTiPanel.java Mon Sep 08 17:52:52 2014 +0200
@@ -41,10 +41,71 @@
/** Show input to select an official epoch. */
public class SedLoadSQTiPanel
-extends SedLoadOffEpochPanel
+extends PeriodPanel
{
+ protected SedimentLoadInfoServiceAsync sedLoadInfoService =
+ GWT.create(SedimentLoadInfoService.class);
+
+ protected ListGrid sedLoadTable;
+
+ /** Creates layout with title. */
+ public Canvas createWidget(DataList data) {
+ VLayout root = new VLayout();
+
+ Label title = new Label(data.get(0).getDescription());
+ title.setHeight("25px");
+
+ root.addMember(title);
+
+ return root;
+ }
+
+ /** Create layout for data entered previously. */
+ @Override
+ public Canvas createOld(DataList dataList) {
+ HLayout layout = new HLayout();
+ layout.setWidth("400px");
+ VLayout vLayout = new VLayout();
+ vLayout.setWidth(130);
+ Label label = new Label(dataList.getLabel());
+ label.setWidth("200px");
+ label.setHeight(25);
+
+ List<Data> items = dataList.getAll();
+ Data str = getData(items, "sq_ti_date");
+ DataItem[] strItems = str.getItems();
+
+ String dateString = strItems[0].getStringValue();
+ Label dateLabel = new Label(dateString);
+ dateLabel.setHeight(20);
+ vLayout.addMember(dateLabel);
+ Canvas back = getBackButton(dataList.getState());
+ layout.addMember(label);
+ layout.addMember(vLayout);
+ layout.addMember(back);
+
+ GWT.log("Old data: " + strItems[0].getDescription() + " label " + strItems[0].getLabel() + " value: " + strItems[0].getStringValue());
+
+ return layout;
+ }
+
+ public Canvas create(DataList data) {
+ VLayout layout = new VLayout();
+ Canvas helper = createHelper();
+ this.helperContainer.addMember(helper);
+
+ Canvas submit = getNextButton();
+ Canvas widget = createWidget(data);
+
+ layout.addMember(widget);
+ layout.addMember(submit);
+
+ fetchSedimentLoadData();
+
+ return layout;
+ }
+
/** Creates the helper grid in which off epochs can be selected. */
- @Override
protected Canvas createHelper() {
sedLoadTable = new ListGrid();
sedLoadTable.setShowHeaderContextMenu(false);
@@ -57,7 +118,7 @@
sedLoadTable.setSelectionAppearance(SelectionAppearance.CHECKBOX);
sedLoadTable.setSelectionType(SelectionStyle.SINGLE);
- ListGridField date = new ListGridField("sq_date", MSG.year());
+ ListGridField date = new ListGridField("sq_ti_date", MSG.year());
date.setType(ListGridFieldType.TEXT);
date.setWidth(100);
@@ -76,23 +137,30 @@
return new Data[0];
}
String d = "";
+ String desc = "";
for (int i = 0; i < lgr.length; i++) {
/* Should only be one item as this is single selection */
Record r = (Record) lgr[i];
d = r.getAttribute("sq_ti_id");
- GWT.log("Got attribute sq_ti_id : " + d);
+ desc = r.getAttribute("sq_ti_date");
+ GWT.log("Got attribute sq_ti_id : " + d + " desc: " + desc);
}
- DataItem item = new DefaultDataItem("sq_ti_id", "sq_ti_id", d);
- data.add(new DefaultData(
- "sq_ti_id",
- null,
- null,
- new DataItem[] { item }));
+ DataItem item = new DefaultDataItem("sq_ti_id", "this is ignored", d);
+ DataItem dateLabel = new DefaultDataItem("sq_ti_date", "this is ignored", desc);
+ data.add(new DefaultData(
+ "sq_ti_id",
+ null,
+ null,
+ new DataItem[] { item }));
+ data.add(new DefaultData(
+ "sq_ti_date",
+ null,
+ null,
+ new DataItem[] { dateLabel }));
return data.toArray(new Data[data.size()]);
}
/** Fetch load info from service and populate table. */
- @Override
protected void fetchSedimentLoadData() {
Config config = Config.getInstance();
String locale = config.getLocale ();
@@ -123,5 +191,17 @@
}
);
}
+
+ /** Add record to input helper listgrid. */
+ protected void addSedimentLoadInfo (SedimentLoadInfoObject[] sedLoad) {
+ for(SedimentLoadInfoObject sl: sedLoad) {
+ SedimentLoadInfoRecord rec = new SedimentLoadInfoRecord(sl);
+ sedLoadTable.addData(rec);
+ }
+ if (sedLoad.length == 1) {
+ /* Preselect lists with only one load. */
+ sedLoadTable.selectRecords(new int[] {0});
+ }
+ }
}
// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
diff -r e3fdca2c4850 -r b6371be363b1 gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java Mon Sep 08 17:50:10 2014 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/shared/model/SedimentLoadInfoRecord.java Mon Sep 08 17:52:52 2014 +0200
@@ -33,7 +33,7 @@
}
public void setSQTiDate(String date) {
- setAttribute("sq_date", date);
+ setAttribute("sq_ti_date", date);
}
public void setSQTiId(String id) {
@@ -53,6 +53,6 @@
}
public String getSQTiDate() {
- return getAttribute("sq_date");
+ return getAttribute("sq_ti_date");
}
}
More information about the Dive4Elements-commits
mailing list