Mercurial > dive4elements > river
changeset 3855:b6b2d9aad95d
Fix for #854
flys-client/trunk@5596 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Tue, 25 Sep 2012 13:24:23 +0000 |
parents | 3228d65b0db9 |
children | 651c2e508885 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java |
diffstat | 3 files changed, 84 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Tue Sep 25 13:13:48 2012 +0000 +++ b/flys-client/ChangeLog Tue Sep 25 13:24:23 2012 +0000 @@ -1,3 +1,11 @@ +2012-09-25 Christian Lins <christian.lins@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java: + Default from and to dates are now shown with english locale, too (#854). + + * src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java: + Cosmetics. + 2012-09-25 Felix Wolfsteller <felix.wolfsteller@intevation.de> Improved fix for issue860 (minfo parameterization in helper pane).
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java Tue Sep 25 13:13:48 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/ManualPointsEditor.java Tue Sep 25 13:24:23 2012 +0000 @@ -1,61 +1,53 @@ package de.intevation.flys.client.client.ui.chart; -import java.util.List; - +import com.google.gwt.core.client.GWT; +import com.google.gwt.i18n.client.NumberFormat; import com.google.gwt.json.client.JSONArray; import com.google.gwt.json.client.JSONBoolean; import com.google.gwt.json.client.JSONNumber; import com.google.gwt.json.client.JSONParser; import com.google.gwt.json.client.JSONString; -import com.google.gwt.core.client.GWT; import com.google.gwt.user.client.rpc.AsyncCallback; +import com.smartgwt.client.types.Alignment; +import com.smartgwt.client.types.ListGridFieldType; import com.smartgwt.client.util.SC; +import com.smartgwt.client.widgets.Button; +import com.smartgwt.client.widgets.IButton; +import com.smartgwt.client.widgets.Label; import com.smartgwt.client.widgets.Window; -import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.IButton; -import com.smartgwt.client.widgets.Button; -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.grid.CellEditValueFormatter; +import com.smartgwt.client.widgets.grid.CellEditValueParser; +import com.smartgwt.client.widgets.grid.CellFormatter; import com.smartgwt.client.widgets.grid.ListGrid; import com.smartgwt.client.widgets.grid.ListGridField; import com.smartgwt.client.widgets.grid.ListGridRecord; import com.smartgwt.client.widgets.grid.events.RecordClickEvent; import com.smartgwt.client.widgets.grid.events.RecordClickHandler; -import com.smartgwt.client.types.ListGridFieldType; -import com.smartgwt.client.widgets.grid.CellFormatter; -import com.google.gwt.i18n.client.NumberFormat; - -import com.smartgwt.client.widgets.grid.CellEditValueParser; -import com.smartgwt.client.widgets.grid.CellEditValueFormatter; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; - -import com.smartgwt.client.types.Alignment; - -import de.intevation.flys.client.shared.model.Artifact; +import com.smartgwt.client.widgets.layout.HLayout; +import com.smartgwt.client.widgets.layout.VLayout; import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; +import de.intevation.flys.client.client.event.RedrawRequestEvent; +import de.intevation.flys.client.client.event.RedrawRequestHandler; +import de.intevation.flys.client.client.services.FeedServiceAsync; +import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; +import de.intevation.flys.client.shared.model.Artifact; import de.intevation.flys.client.shared.model.Collection; import de.intevation.flys.client.shared.model.CollectionItem; - -import de.intevation.flys.client.client.services.LoadArtifactService; -import de.intevation.flys.client.client.services.LoadArtifactServiceAsync; -import de.intevation.flys.client.client.services.FeedService; -import de.intevation.flys.client.client.services.FeedServiceAsync; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DefaultArtifact; import de.intevation.flys.client.shared.model.DefaultData; -import de.intevation.flys.client.shared.model.Recommendation; -import de.intevation.flys.client.shared.model.Settings; import de.intevation.flys.client.shared.model.Property; import de.intevation.flys.client.shared.model.PropertyGroup; +import de.intevation.flys.client.shared.model.Recommendation; +import de.intevation.flys.client.shared.model.Settings; import de.intevation.flys.client.shared.model.StringProperty; -import de.intevation.flys.client.client.event.RedrawRequestHandler; -import de.intevation.flys.client.client.event.RedrawRequestEvent; +import java.util.List; /** @@ -120,7 +112,7 @@ for (int i = 0; i < size; i++) { CollectionItem item = collection.getItem(i); - String dataValue = (String) item.getData().get(pointDataItemName); + String dataValue = item.getData().get(pointDataItemName); if (dataValue != null) { // Found it. uuid = item.identifier();
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java Tue Sep 25 13:13:48 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/fixation/FixPeriodPanel.java Tue Sep 25 13:24:23 2012 +0000 @@ -1,26 +1,18 @@ package de.intevation.flys.client.client.ui.fixation; -import java.util.List; -import java.util.ArrayList; -import java.util.Date; - import com.google.gwt.core.client.GWT; import com.google.gwt.i18n.client.DateTimeFormat; -import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat; 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.DateRangeItem; import com.smartgwt.client.widgets.layout.HLayout; import com.smartgwt.client.widgets.layout.VLayout; -import com.smartgwt.client.widgets.form.DynamicForm; -import com.smartgwt.client.widgets.form.fields.DateRangeItem; - +import de.intevation.flys.client.client.Config; import de.intevation.flys.client.client.FLYSConstants; - import de.intevation.flys.client.shared.model.Data; import de.intevation.flys.client.shared.model.DataItem; import de.intevation.flys.client.shared.model.DataList; @@ -28,6 +20,10 @@ import de.intevation.flys.client.shared.model.DefaultDataItem; import de.intevation.flys.client.shared.model.FixingsOverviewInfo.FixEvent; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * This UIProvider creates a panel for location or distance input. * @@ -57,6 +53,7 @@ htmlOverview = ""; } + @Override public Canvas createWidget(DataList data) { instances.put(this.artifact.getUuid(), this); @@ -133,6 +130,7 @@ * * @return the selected/inserted data. */ + @Override public Data[] getData() { List<Data> data = new ArrayList<Data>(); @@ -170,23 +168,59 @@ return false; } + protected String getLocaleDateFormat() { + String loc = Config.getInstance().getLocale(); + if ("de".equals(loc)) { + return "yy.MM.yyyy"; + } + else { + return "MM/dd/yyyy"; + } + } + @Override public void success() { List<FixEvent> list = fixInfo.getEvents(); - DateTimeFormat df = DateTimeFormat.getFormat( - DateTimeFormat.PredefinedFormat.DATE_MEDIUM); + // The date in FixEvent is always "de" locale, so it seems... + DateTimeFormat df = DateTimeFormat.getFormat("yy.MM.yyyy"); + + if (!setFromAndToDate(list, df)) { + // or perhaps "en"? + df = DateTimeFormat.getFormat("MM/dd/yyyy"); + + if (!setFromAndToDate(list, df)) { + GWT.log("FixPeriodPanel::success(): could not set from and to dates!"); + } + } + } + + protected boolean setFromAndToDate(List<FixEvent> list, DateTimeFormat df) { try { - Date f = df.parse(list.get(0).getDate()); - Date t = df.parse(list.get(list.size() - 1).getDate()); - this.inputPanel.setFromDate(f); - this.inputPanel.setToDate(t); + setFromDate(list.get(0).getDate(), df); + setToDate(list.get(list.size() - 1).getDate(), df); + return true; } - catch(IllegalArgumentException pe) { - GWT.log(pe.toString()); + catch(IllegalArgumentException ex) { + GWT.log("FixPeriodPanel::setFromAndToDate(): " + ex.toString()); + return false; } } + protected void setFromDate(String date, DateTimeFormat df) + throws IllegalArgumentException + { + Date from = df.parse(date); + this.inputPanel.setFromDate(from); + } + + protected void setToDate(String date, DateTimeFormat df) + throws IllegalArgumentException + { + Date to = df.parse(date); + this.inputPanel.setToDate(to); + } + protected boolean saveDateValues() { Date st = inputPanel.getFromDate(); Date en = inputPanel.getToDate();