[PATCH] 2.3.4.1.8 Pegelauswahl nach range einschränken
Wald Commits
scm-commit at wald.intevation.org
Fri May 25 15:05:41 CEST 2018
# HG changeset patch
# User gernotbelger
# Date 1527253530 -7200
# Node ID 280c5b44f2191ee2d2af9565b8f6cde7876b426a
# Parent 50cfc90ac5b04b4bb3f78ca9d06afd13f729f74d
2.3.4.1.8 Pegelauswahl nach range einschränken
diff -r 50cfc90ac5b0 -r 280c5b44f219 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Fri May 25 14:27:20 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/GaugeListGrid.java Fri May 25 15:05:30 2018 +0200
@@ -11,15 +11,6 @@
import java.util.ArrayList;
import java.util.List;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.Canvas;
-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 org.dive4elements.river.client.client.Config;
import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.services.AdvanceService;
@@ -41,40 +32,49 @@
import org.dive4elements.river.client.shared.model.GaugeInfo;
import org.dive4elements.river.client.shared.model.RiverInfo;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.util.SC;
+import com.smartgwt.client.widgets.Canvas;
+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;
/**
* @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
*/
public class GaugeListGrid extends InfoListGrid implements RecordClickHandler {
+ public static enum DisappearType {
+ remove, collapse, stayVisible
+ }
+
private static final int ABFLUSSTAFEL_COLUMN = 6;
/** The ArtifactService used to communicate with the Artifact server. */
- protected ArtifactServiceAsync artifactService =
- GWT.create(ArtifactService.class);
+ protected ArtifactServiceAsync artifactService = GWT.create(ArtifactService.class);
/** The StepForwardService used to put data into an existing artifact. */
- protected StepForwardServiceAsync forwardService =
- GWT.create(StepForwardService.class);
+ protected StepForwardServiceAsync forwardService = GWT.create(StepForwardService.class);
/** The ArtifactService used to communicate with the Artifact server. */
- protected CreateCollectionServiceAsync createCollectionService =
- GWT.create(CreateCollectionService.class);
+ protected CreateCollectionServiceAsync createCollectionService = GWT.create(CreateCollectionService.class);
/** The StepForwardService used to put data into an existing artifact. */
- protected AdvanceServiceAsync advanceService =
- GWT.create(AdvanceService.class);
+ protected AdvanceServiceAsync advanceService = GWT.create(AdvanceService.class);
- public GaugeListGrid(FLYS flys) {
+ private final List<GaugeInfo> gauges = new ArrayList<GaugeInfo>();
+
+ public GaugeListGrid(final FLYS flys) {
super(flys);
- //TODO i18n!!!
- ListGridField nfield = new ListGridField("name", "Pegel");
- ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60);
- ListGridField efield = new ListGridField("kmend", "Ende [km]", 60);
- ListGridField stfield = new ListGridField("station", "Station [km]");
- ListGridField lfield = new ListGridField("infolink", "Info");
- ListGridField cfield = new ListGridField(
- "curvelink", MSG.gauge_curve_link());
+ // TODO i18n!!!
+ final ListGridField nfield = new ListGridField("name", "Pegel");
+ final ListGridField sfield = new ListGridField("kmstart", "Start [km]", 60);
+ final ListGridField efield = new ListGridField("kmend", "Ende [km]", 60);
+ final ListGridField stfield = new ListGridField("station", "Station [km]");
+ final ListGridField lfield = new ListGridField("infolink", "Info");
+ final ListGridField cfield = new ListGridField("curvelink", this.MSG.gauge_curve_link());
cfield.addRecordClickHandler(this);
this.setShowRecordComponents(true);
@@ -82,127 +82,121 @@
this.setFields(nfield, sfield, efield, stfield, lfield, cfield);
}
- public void setRiverInfo(RiverInfo riverinfo) {
- List<GaugeInfo> gauges = riverinfo.getGauges();
+ @Override
+ public void setRiverInfo(final RiverInfo riverinfo) {
+ final List<GaugeInfo> gauges = riverinfo.getGauges();
if (gauges != null && !gauges.isEmpty()) {
- ArrayList<GaugeInfo> emptygauges = new ArrayList<GaugeInfo>();
+ final ArrayList<GaugeInfo> emptygauges = new ArrayList<GaugeInfo>();
if (!riverinfo.isKmUp()) {
- for (GaugeInfo gauge : gauges) {
+ for (final GaugeInfo gauge : gauges) {
addGauge(gauge, emptygauges);
}
- }
- else {
- for (int i = gauges.size()-1; i >= 0; i--) {
- GaugeInfo gauge = gauges.get(i);
+ } else {
+ for (int i = gauges.size() - 1; i >= 0; i--) {
+ final GaugeInfo gauge = gauges.get(i);
addGauge(gauge, emptygauges);
}
}
// put empty gauges to the end
- for (GaugeInfo gauge : emptygauges) {
+ for (final GaugeInfo gauge : emptygauges) {
addGauge(gauge);
}
}
}
- private void addGauge(GaugeInfo gauge, List<GaugeInfo> empty) {
+ private void addGauge(final GaugeInfo gauge, final List<GaugeInfo> empty) {
if (gauge.getKmStart() != null && gauge.getKmEnd() != null) {
addGauge(gauge);
- }
- else {
+ } else {
empty.add(gauge);
}
}
- private void addGauge(GaugeInfo gauge) {
- this.addData(new GaugeRecord(gauge));
+ private void addGauge(final GaugeInfo gauge) {
+
+ this.gauges.add(gauge);
+
+ // this.addData(new GaugeRecord(gauge));
+
}
+ @Override
public void open() {
- ArrayList<Double> locations = new ArrayList<Double>();
+ final ArrayList<Double> locations = new ArrayList<Double>();
- if (data != null && data.length > 0) {
- for (int i = 0; i < data.length; i++) {
- DataList dl = data[i];
- String state = dl.getState();
+ if (this.data != null && this.data.length > 0) {
+ for (final DataList dl : this.data) {
+
+ final String state = dl.getState();
+ DisappearType type = DisappearType.collapse;
+ if (state.contains("state.bundu.") || state.contains("state.fix.")) {
+ type = DisappearType.remove;
+ }
+
GWT.log("GaugeListGrid - open " + state);
- if (state.equals("state.winfo.location_distance")) {
+ if (state.contains(".location_distance")) {
Double ldfrom = null;
Double ldto = null;
- for (int j = dl.size()-1; j >= 0; --j) {
- Data d = dl.get(j);
- String label = d.getLabel();
- GWT.log("GaugeListGrid - setData - label "
- + label + " " + d.getStringValue());
+ for (int j = dl.size() - 1; j >= 0; --j) {
+ final Data d = dl.get(j);
+ final String label = d.getLabel();
+ GWT.log("GaugeListGrid - setData - label " + label + " " + d.getStringValue());
if (label.equals("ld_from")) {
ldfrom = getDoubleValue(d);
- }
- else if (label.equals("ld_to")) {
+ } else if (label.equals("ld_to")) {
ldto = getDoubleValue(d);
- }
- else if (label.equals("ld_locations")) {
+ } else if (label.equals("ld_locations")) {
getLocationsFromData(locations, d);
openOnLocations(locations);
return;
}
}
if (ldfrom != null) {
- openOnDistance(ldfrom, ldto);
+
+ openOnDistance(ldfrom, ldto, type);
return;
}
- }
- else if(state.equals("state.winfo.distance_only") ||
- state.equals("state.winfo.distance")) {
+ } else if (state.contains(".distance_only") || state.contains(".distance")
+ || state.contains(".location") && !state.contains(".location_distance")) {
Double ldfrom = null;
Double ldto = null;
- for (int j = dl.size()-1; j >= 0; --j) {
- Data d = dl.get(j);
- String label = d.getLabel();
- GWT.log("GaugeListGrid - setData - label "
- + label + " " + d.getStringValue());
+ for (int j = dl.size() - 1; j >= 0; --j) {
+ final Data d = dl.get(j);
+ final String label = d.getLabel();
+ GWT.log("GaugeListGrid - setData - label " + label + " " + d.getStringValue());
if (label.equals("ld_from")) {
ldfrom = getDoubleValue(d);
- }
- else if (label.equals("ld_to")) {
+ } else if (label.equals("ld_to")) {
ldto = getDoubleValue(d);
}
}
if (ldfrom != null) {
- openOnDistance(ldfrom, ldto);
+ openOnDistance(ldfrom, ldto, type);
return;
}
- }
- else if (state.equals("state.winfo.location")) {
+ } else if (state.equals("state.winfo.location")) {
getLocations("ld_locations", locations, dl);
openOnLocations(locations);
return;
- }
- else if (state
- .equals("state.winfo.reference.curve.input.start")
- ) {
+ } else if (state.equals("state.winfo.reference.curve.input.start")) {
getLocations("reference_startpoint", locations, dl);
- }
- else if (state
- .equals("state.winfo.reference.curve.input.end")
- ) {
+ } else if (state.equals("state.winfo.reference.curve.input.end")) {
getLocations("reference_endpoint", locations, dl);
- }
- else if (state
- .equals("state.winfo.historicalq.reference_gauge")
- ) {
- for (int j = dl.size()-1; j >= 0; --j) {
- Data d = dl.get(j);
- String label = d.getLabel();
+ } else if (state.equals("state.winfo.historicalq.reference_gauge")) {
+ for (int j = dl.size() - 1; j >= 0; --j) {
+ final Data d = dl.get(j);
+ final String label = d.getLabel();
if (label.equals("reference_gauge")) {
- String tmp = d.getStringValue();
+ final String tmp = d.getStringValue();
if (tmp != null) {
- Long gaugereference = Long.valueOf(tmp);
+ final Long gaugereference = Long.valueOf(tmp);
if (gaugereference != null) {
openOnReference(gaugereference);
return;
@@ -215,40 +209,49 @@
}
if (!locations.isEmpty()) {
openOnLocations(locations);
- }
- else {
+ } else {
openAll();
}
}
- void getLocations(String labelname, List<Double> locations, DataList dl) {
- for (int j = dl.size()-1; j >= 0; --j) {
- Data d = dl.get(j);
- String label = d.getLabel();
+ @Override
+ public void openAll() {
+
+ GWT.log("InfoListGrid - openAll");
+
+ setData(new ListGridRecord[] {});
+ for (final GaugeInfo gauge : this.gauges) {
+ addExpandedRecord(gauge);
+ }
+ }
+
+ void getLocations(final String labelname, final List<Double> locations, final DataList dl) {
+ for (int j = dl.size() - 1; j >= 0; --j) {
+ final Data d = dl.get(j);
+ final String label = d.getLabel();
if (label.equals(labelname)) {
getLocationsFromData(locations, d);
}
}
}
- void getLocationsFromData(List<Double> locations, Data data) {
- DataItem[] items = data.getItems();
- for (int k = 0; k < items.length; k++) {
- String tmp = items[k].getStringValue();
+ void getLocationsFromData(final List<Double> locations, final Data data) {
+ final DataItem[] items = data.getItems();
+ for (final DataItem item : items) {
+ final String tmp = item.getStringValue();
GWT.log("GaugeListGrid - getLocationsFromData " + tmp);
if (tmp != null) {
if (tmp.contains(" ")) {
// string contains several values ...
- String[] values = tmp.split(" ");
- for(int i=0; i < values.length; i++) {
- Double value = Double.valueOf(values[i]);
+ final String[] values = tmp.split(" ");
+ for (final String value2 : values) {
+ final Double value = Double.valueOf(value2);
if (value != null) {
locations.add(value);
}
}
- }
- else {
- Double value = Double.valueOf(tmp);
+ } else {
+ final Double value = Double.valueOf(tmp);
if (value != null) {
locations.add(value);
}
@@ -257,73 +260,87 @@
}
}
- public void openOnReference(Long number) {
+ public void openOnReference(final Long number) {
GWT.log("GaugeListGrid - openOnReference " + number);
- for (ListGridRecord record: this.getRecords()) {
- GaugeRecord item = (GaugeRecord)record;
- if (item.getOfficialNumber().equals(number)) {
- expandRecord(item);
- }
- else {
- collapseRecord(item);
+
+ setData(new ListGridRecord[] {});
+
+ for (final GaugeInfo gauge : this.gauges) {
+
+ if (gauge.getOfficialNumber().equals(number)) {
+ this.addExpandedRecord(gauge);// (gauge);
+ } else {
+ this.addCollapsedRecord(gauge);
}
}
}
- public void openOnDistance(Double start, Double end) {
+ public void openOnDistance(final Double start, final Double end, final DisappearType type) {
GWT.log("GaugeListGrid - openOnDistance " + start + " " + end);
- for (ListGridRecord record: this.getRecords()) {
- GaugeRecord item = (GaugeRecord)record;
- if (end == null && item.getKmStart() != null) {
- if (item.getKmStart() >= start) {
- expandRecord(item);
+ setData(new ListGridRecord[] {});
+
+ for (final GaugeInfo gauge : this.gauges) {
+
+ if (end == null && gauge.getKmStart() != null) {
+ if (gauge.getKmStart() >= start) {
+ addExpandedRecord(gauge);
+ } else {
+ removeOrCollapse(gauge, type);
}
- else {
- collapseRecord(item);
- }
- }
- else if (item.getKmStart() != null && item.getKmEnd() != null) {
+ } else if (gauge.getKmStart() != null && gauge.getKmEnd() != null) {
// as getStart()/getEnd() return Double objects,
// they can be null and
// can cause NPEs when comparing with double... strange...
- GWT.log("GaugeListGrid - openOnDistance item "
- + item.getKmStart() + " " + item.getKmEnd());
- if ((start >= item.getKmStart() && start <= item.getKmEnd()) ||
- (end >= item.getKmStart() && end <= item.getKmEnd()) ||
- (start <= item.getKmStart() && end >= item.getKmEnd())) {
- expandRecord(item);
+ GWT.log("GaugeListGrid - openOnDistance item " + gauge.getKmStart() + " " + gauge.getKmEnd());
+ if ((start >= gauge.getKmStart() && start <= gauge.getKmEnd()) || (end >= gauge.getKmStart() && end <= gauge.getKmEnd())
+ || (start <= gauge.getKmStart() && end >= gauge.getKmEnd())) {
+ addExpandedRecord(gauge);
+ } else {
+ removeOrCollapse(gauge, type);
}
- else {
- collapseRecord(item);
- }
- }
- else {
- collapseRecord(item);
+ } else {
+ removeOrCollapse(gauge, type);
}
}
}
+ private void removeOrCollapse(final GaugeInfo gauge, final DisappearType type) {
+ switch (type) {
+ case remove:
+ // Remove: gauge wird der datasource nicht hinzugefügt
+ break;
+ case collapse:
+ addCollapsedRecord(gauge);
+ break;
+ case stayVisible: // TODO: check
+ addExpandedRecord(gauge);
+ break;
+ }
+
+ }
+
/**
* Open Gauge entry if a location fits to the gauge.
*/
- public void openOnLocations(List<Double> locations) {
+ public void openOnLocations(final List<Double> locations) {
GWT.log("GaugeListGrid - openOnLocations " + locations);
+ setData(new ListGridRecord[] {});
+
if (locations == null || locations.isEmpty()) {
return;
}
- for (ListGridRecord record: this.getRecords()) {
- GaugeRecord item = (GaugeRecord)record;
+ for (final GaugeInfo gauge : this.gauges) {
boolean isset = false;
- for (Double location: locations) {
+ for (final Double location : locations) {
if (locations == null) {
continue;
}
- Double start = item.getKmStart();
- Double end = item.getKmEnd();
+ final Double start = gauge.getKmStart();
+ final Double end = gauge.getKmEnd();
if (start == null || end == null) {
// should not occur but avoid NullPointerException
continue;
@@ -335,18 +352,33 @@
}
}
if (isset) {
- expandRecord(item);
- }
- else {
- collapseRecord(item);
+ addExpandedRecord(gauge);
+ } else {
+ addCollapsedRecord(gauge);
}
}
}
+ private void addExpandedRecord(final GaugeInfo gauge) {
+ final GaugeRecord record = new GaugeRecord(gauge);
+
+ this.addData(record);
+
+ expandRecord(record);
+ }
+
+ private void addCollapsedRecord(final GaugeInfo gauge) {
+ final GaugeRecord record = new GaugeRecord(gauge);
+
+ this.addData(record);
+
+ collapseRecord(record);
+ }
+
@Override
- protected Canvas getExpandPanel(ListGridRecord record) {
- GaugeRecord item = (GaugeRecord)record;
- return new GaugeInfoPanel(item, flys);
+ protected Canvas getExpandPanel(final ListGridRecord record) {
+ final GaugeRecord item = (GaugeRecord) record;
+ return new GaugeInfoPanel(item, this.flys);
}
/**
@@ -354,122 +386,75 @@
* Curve view.
*/
@Override
- public void onRecordClick(RecordClickEvent event) {
- final GaugeRecord gauge = (GaugeRecord)event.getRecord();
- Config config = Config.getInstance();
+ public void onRecordClick(final RecordClickEvent event) {
+ final GaugeRecord gauge = (GaugeRecord) event.getRecord();
+ final Config config = Config.getInstance();
final String locale = config.getLocale();
- createCollectionService.create(
- locale,
- flys.getCurrentUser().identifier(),
- new AsyncCallback<Collection>() {
+ this.createCollectionService.create(locale, this.flys.getCurrentUser().identifier(), new AsyncCallback<Collection>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not create the new collection.");
+ SC.warn(FLYS.getExceptionString(GaugeListGrid.this.MSG, caught));
+ }
+
+ @Override
+ public void onSuccess(final Collection collection) {
+ GWT.log("Successfully created a new collection.");
+ createArtifact(collection, locale, gauge);
+ }
+ });
+ }
+
+ private void createArtifact(final Collection collection, final String locale, final GaugeRecord gauge) {
+ this.artifactService.create(locale, "gaugedischargecurve", null, new AsyncCallback<Artifact>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not create the new artifact.");
+ SC.warn(FLYS.getExceptionString(GaugeListGrid.this.MSG, caught));
+ }
+
+ @Override
+ public void onSuccess(final Artifact artifact) {
+ GWT.log("Successfully created a new artifact.");
+
+ final DataItem riverItem = new DefaultDataItem("river", "river", gauge.getRiverName());
+ final Data river = new DefaultData("river", null, null, new DataItem[] { riverItem });
+
+ final DataItem refItem = new DefaultDataItem("reference_gauge", "reference_gauge", gauge.getOfficialNumber().toString());
+ final Data ref = new DefaultData("reference_gauge", null, null, new DataItem[] { refItem });
+
+ final DataItem locItem = new DefaultDataItem("ld_locations", "ld_locations", gauge.getStation().toString());
+ final Data loc = new DefaultData("ld_locations", null, null, new DataItem[] { locItem });
+
+ final DataItem nameItem = new DefaultDataItem("gauge_name", "gauge_name", gauge.getName());
+ final Data name = new DefaultData("gauge_name", null, null, new DataItem[] { nameItem });
+
+ final Data[] data = new Data[] { river, ref, loc, name };
+ GaugeListGrid.this.forwardService.go(locale, artifact, data, new AsyncCallback<Artifact>() {
@Override
- public void onFailure(Throwable caught) {
- GWT.log("Could not create the new collection.");
- SC.warn(FLYS.getExceptionString(MSG, caught));
+ public void onFailure(final Throwable caught) {
+ GWT.log("Could not feed the artifact.");
+ SC.warn(caught.getMessage());
}
@Override
- public void onSuccess(Collection collection) {
- GWT.log("Successfully created a new collection.");
- createArtifact(collection, locale, gauge);
+ public void onSuccess(final Artifact artifact) {
+ GWT.log("Successfully feed the artifact.");
+ final CollectionView view = new CollectionView(GaugeListGrid.this.flys, collection, artifact);
+ GaugeListGrid.this.flys.getWorkspace().addView(collection.identifier(), view);
+ view.addArtifactToCollection(artifact);
}
- }
- );
- }
-
- private void createArtifact(
- final Collection collection,
- final String locale,
- final GaugeRecord gauge
- ) {
- artifactService.create(
- locale, "gaugedischargecurve", null,
- new AsyncCallback<Artifact>() {
- @Override
- public void onFailure(Throwable caught) {
- GWT.log("Could not create the new artifact.");
- SC.warn(FLYS.getExceptionString(MSG, caught));
- }
-
- @Override
- public void onSuccess(Artifact artifact) {
- GWT.log("Successfully created a new artifact.");
-
- DataItem riverItem = new DefaultDataItem(
- "river",
- "river",
- gauge.getRiverName());
- Data river = new DefaultData(
- "river",
- null,
- null,
- new DataItem[]{riverItem});
-
- DataItem refItem = new DefaultDataItem(
- "reference_gauge",
- "reference_gauge",
- gauge.getOfficialNumber().toString());
- Data ref = new DefaultData(
- "reference_gauge",
- null,
- null,
- new DataItem[]{refItem});
-
- DataItem locItem = new DefaultDataItem(
- "ld_locations",
- "ld_locations",
- gauge.getStation().toString());
- Data loc = new DefaultData(
- "ld_locations",
- null,
- null,
- new DataItem[]{locItem});
-
- DataItem nameItem = new DefaultDataItem(
- "gauge_name",
- "gauge_name",
- gauge.getName());
- Data name = new DefaultData(
- "gauge_name",
- null,
- null,
- new DataItem[]{nameItem});
-
- Data[] data = new Data[]{river, ref, loc, name};
- forwardService.go(locale, artifact, data,
- new AsyncCallback<Artifact>() {
- @Override
- public void onFailure(Throwable caught) {
- GWT.log("Could not feed the artifact.");
- SC.warn(caught.getMessage());
- }
-
- @Override
- public void onSuccess(Artifact artifact) {
- GWT.log("Successfully feed the artifact.");
- CollectionView view = new CollectionView(
- flys,
- collection,
- artifact);
- flys.getWorkspace().addView(
- collection.identifier(),
- view);
- view.addArtifactToCollection(artifact);
- }
- });
- }
- });
+ });
+ }
+ });
}
@Override
- public String getCellCSSText(ListGridRecord record, int rowNum,
- int colNum) {
+ public String getCellCSSText(final ListGridRecord record, final int rowNum, final int colNum) {
if (colNum == ABFLUSSTAFEL_COLUMN) {
// display the ablfusstafel cell like a link
- return "text-decoration: underline; color: #0000EE; "
- + "cursor: pointer;";
- }
- else {
+ return "text-decoration: underline; color: #0000EE; " + "cursor: pointer;";
+ } else {
return super.getCellCSSText(record, rowNum, colNum);
}
}
diff -r 50cfc90ac5b0 -r 280c5b44f219 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java Fri May 25 14:27:20 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/stationinfo/InfoListGrid.java Fri May 25 15:05:30 2018 +0200
@@ -8,11 +8,6 @@
package org.dive4elements.river.client.client.ui.stationinfo;
-import com.google.gwt.core.client.GWT;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.grid.ListGrid;
-import com.smartgwt.client.widgets.grid.ListGridRecord;
-
import org.dive4elements.river.client.client.FLYS;
import org.dive4elements.river.client.client.FLYSConstants;
import org.dive4elements.river.client.client.ui.WikiLinks;
@@ -20,6 +15,11 @@
import org.dive4elements.river.client.shared.model.DataList;
import org.dive4elements.river.client.shared.model.RiverInfo;
+import com.google.gwt.core.client.GWT;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.ListGrid;
+import com.smartgwt.client.widgets.grid.ListGridRecord;
+
/**
* @author <a href="mailto:bjoern.ricks at intevation.de">Björn Ricks</a>
*/
@@ -27,11 +27,10 @@
protected FLYS flys;
protected DataList[] data;
- /** The message class that provides i18n strings.*/
+ /** The message class that provides i18n strings. */
protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
-
- public InfoListGrid(FLYS flys) {
+ public InfoListGrid(final FLYS flys) {
super();
this.flys = flys;
this.setCanExpandRecords(true);
@@ -39,37 +38,30 @@
}
@Override
- protected Canvas createRecordComponent(
- final ListGridRecord record,
- Integer colNum
- ) {
- String name = this.getFieldName(colNum);
+ protected Canvas createRecordComponent(final ListGridRecord record, final Integer colNum) {
+ final String name = this.getFieldName(colNum);
if (name.equals("infolink")) {
- return WikiLinks.linkDynamicForm(
- flys,
- record.getAttribute("link"),
- record.getLinkText());
- }
- else {
+ return WikiLinks.linkDynamicForm(this.flys, record.getAttribute("link"), record.getLinkText());
+ } else {
return null;
}
}
public void openAll() {
GWT.log("InfoListGrid - openAll");
- for (ListGridRecord record: this.getRecords()) {
+ for (final ListGridRecord record : this.getRecords()) {
expandRecord(record);
}
}
- public void setData(DataList[] data) {
+ public void setData(final DataList[] data) {
GWT.log("InfoListGrid - setData");
this.data = data;
this.open();
}
- protected Double getDoubleValue(Data d) {
- String tmp = d.getStringValue();
+ protected Double getDoubleValue(final Data d) {
+ final String tmp = d.getStringValue();
if (tmp != null) {
return Double.valueOf(tmp);
}
@@ -77,7 +69,7 @@
}
@Override
- protected Canvas getExpansionComponent(ListGridRecord record) {
+ protected Canvas getExpansionComponent(final ListGridRecord record) {
return this.getExpandPanel(record);
}
More information about the Dive4Elements-commits
mailing list