Mercurial > dive4elements > river
changeset 56:c9c19761a449
Read min/max values for the distance modes in WQInputPanel.
flys-client/trunk@1513 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 Mar 2011 09:36:28 +0000 |
parents | 4439f642f632 |
children | 246af33f621c |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java |
diffstat | 2 files changed, 75 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri Mar 18 08:45:25 2011 +0000 +++ b/flys-client/ChangeLog Fri Mar 18 09:36:28 2011 +0000 @@ -1,3 +1,9 @@ +2011-03-18 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: + Read min/max values and define those values as default values for the + distance modes. + 2011-03-18 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/LocationDistancePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Fri Mar 18 08:45:25 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Fri Mar 18 09:36:28 2011 +0000 @@ -67,6 +67,18 @@ /** The RadioGroupItem that determines the w/q input mode.*/ protected DynamicForm modes; + /** The min values for the 'from' property in the W-Range input mode.*/ + protected double minW; + + /** The min values for the 'from' property in the Q-Range input mode.*/ + protected double minQ; + + /** The max values for the 'from' property in the W-Range input mode.*/ + protected double maxW; + + /** The max values for the 'from' property in the Q-Range input mode.*/ + protected double maxQ; + /** The 'from' value entered in the range W mode.*/ protected double fromW; @@ -107,6 +119,8 @@ * @return the widget. */ public Canvas create(DataList data) { + initDefaults(data); + Canvas widget = createWidget(data); IButton submit = new IButton(MSG.next(), this); Label label = new Label(MSG.wqTitle()); @@ -151,6 +165,42 @@ } + /** + * 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(), "wq_from"); + Data t = getData(list.getAll(), "wq_to"); + Data s = getData(list.getAll(), "wq_step"); + + DataItem fQItem = getDataItem(f.getItems(), "minQ"); + DataItem fWItem = getDataItem(f.getItems(), "minW"); + DataItem tQItem = getDataItem(t.getItems(), "maxQ"); + DataItem tWItem = getDataItem(t.getItems(), "maxW"); + DataItem sQItem = getDataItem(s.getItems(), "stepQ"); + DataItem sWItem = getDataItem(s.getItems(), "stepW"); + + minW = Double.valueOf(fWItem.getStringValue()); + maxW = Double.valueOf(tWItem.getStringValue()); + stepW = Double.valueOf(sWItem.getStringValue()); + + minQ = Double.valueOf(fQItem.getStringValue()); + maxQ = Double.valueOf(tQItem.getStringValue()); + stepQ = Double.valueOf(sQItem.getStringValue()); + + this.fromW = minW; + this.toW = maxW; + this.stepW = stepW; + + this.fromQ = minQ; + this.toQ = maxQ; + this.stepQ = stepQ; + } + + protected String createWString(DataItem from, DataItem to, DataItem step) { StringBuilder sb = new StringBuilder(); sb.append(from.getLabel()); @@ -196,6 +246,25 @@ return null; } + /** + * 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. + * + * @return the DataItem with the name <i>name</i>. + */ + protected DataItem getDataItem(DataItem[] items, String name) { + for (DataItem item: items) { + if (name.equals(item.getLabel())) { + return item; + } + } + + return null; + } + /** * This method creates the whole widget. There is a panel on the left, that