Mercurial > dive4elements > river
changeset 55:4439f642f632
Read min/max values for the distance mode in the LocationDistancePanel.
flys-client/trunk@1511 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 08:45:25 +0000 |
parents | 0db278371632 |
children | c9c19761a449 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java |
diffstat | 2 files changed, 39 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri Mar 18 07:45:34 2011 +0000 +++ b/flys-client/ChangeLog Fri Mar 18 08:45:25 2011 +0000 @@ -1,3 +1,9 @@ +2011-03-18 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java: + Read min/max values and define those values as default values for the + distance mode. + 2011-03-18 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/ParameterList.java,
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Fri Mar 18 07:45:34 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java Fri Mar 18 08:45:25 2011 +0000 @@ -64,6 +64,12 @@ /** A container that will contain the location or the distance panel.*/ protected HLayout container; + /** The min value for a distance.*/ + protected double min; + + /** The max value for a distance.*/ + protected double max; + /** The 'from' value entered in the distance mode.*/ protected double from; @@ -96,6 +102,8 @@ public Canvas create(DataList data) { VLayout layout = new VLayout(); + initDefaults(data); + Label label = new Label(MESSAGES.location_distance_state()); Canvas widget = createWidget(data); IButton submit = new IButton(MESSAGES.next(), this); @@ -142,6 +150,31 @@ /** + * This method reads the default values defined in the DataItems of the Data + * objects in <i>list</i>. + * + * @param list The DataList container that stores the Data objects. + */ + protected void initDefaults(DataList list) { + Data f = getData(list.getAll(), "ld_from"); + Data t = getData(list.getAll(), "ld_to"); + Data s = getData(list.getAll(), "ld_step"); + + DataItem[] fItems = f.getItems(); + DataItem[] tItems = t.getItems(); + DataItem[] sItems = s.getItems(); + + min = Double.valueOf(fItems[0].getStringValue()); + max = Double.valueOf(tItems[0].getStringValue()); + step = Double.valueOf(sItems[0].getStringValue()); + + this.from = min; + this.to = max; + this.step = step; + } + + + /** * This method greps the Data with name <i>name</i> from the list and * returns it. *