# HG changeset patch # User Raimund Renkert # Date 1304602356 0 # Node ID 6c7133eb8c4c7aea19b41130a3ba0d263ede5e6b # Parent ed90309ec6083fad3042955569d894d53a5466d2 Implemented handler for WQ value selection. flys-client/trunk@1837 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ed90309ec608 -r 6c7133eb8c4c flys-client/ChangeLog --- a/flys-client/ChangeLog Thu May 05 09:51:51 2011 +0000 +++ b/flys-client/ChangeLog Thu May 05 13:32:36 2011 +0000 @@ -1,3 +1,8 @@ +2011-05-05 Raimund Renkert + + * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: + Implemented handler for the value selection. + 2011-05-05 Raimund Renkert * src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java: diff -r ed90309ec608 -r 6c7133eb8c4c flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java --- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Thu May 05 09:51:51 2011 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/WQInputPanel.java Thu May 05 13:32:36 2011 +0000 @@ -33,6 +33,7 @@ import de.intevation.flys.client.shared.model.WQInfoRecord; import de.intevation.flys.client.shared.model.ArtifactDescription; import com.smartgwt.client.types.ListGridFieldType; +import com.smartgwt.client.types.SelectionStyle; import de.intevation.flys.client.client.services.WQInfoService; import de.intevation.flys.client.client.services.WQInfoServiceAsync; @@ -124,6 +125,18 @@ /** The values entered in the single Q mode.*/ protected double[] valuesQ; + /** The input panel for W values*/ + protected DoubleArrayPanel wArrayPanel; + + /** The input panel for q values*/ + protected DoubleArrayPanel qArrayPanel; + + /** The input panel for w range*/ + protected DoubleRangePanel wRangePanel; + + /** The input panel for q range*/ + protected DoubleRangePanel qRangePanel; + /** The WQ Data*/ protected WQInfoObject[] tableData; @@ -241,15 +254,92 @@ ListGridField addWQ = new ListGridField("", ""); addWQ.setType(ListGridFieldType.ICON); addWQ.setWidth(30); - wqTable.addCellClickHandler(new CellClickHandler() { + + CellClickHandler cch = new CellClickHandler() { public void onCellClick(CellClickEvent e) { - if (e.getColNum() == 0 && e.getRecord().getEnabled ()) { + if (e.getColNum() == 0 && !e.getRecord().getEnabled ()) { Record r = e.getRecord (); double val = r.getAttributeAsDouble("value"); -// setValue(val); + if(isWMode() && !isRangeMode()) { + double[] in = wArrayPanel.getInputValues(); + int size = 0; + if (in == null) { + double[] vals = new double[1]; + vals[0] = val; + wArrayPanel.setValues(vals); + setSingleW(vals); + } + else { + double[] vals = new double[in.length+1]; + for(int i = 0; i < in.length; i++) { + vals[i] = in[i]; + } + vals[in.length] = val; + wArrayPanel.setValues(vals); + setSingleW(vals); + } + } + else if (!isWMode() && !isRangeMode()) { + double[] in = qArrayPanel.getInputValues(); + int size = 0; + if (in == null) { + double[] vals = new double[1]; + vals[0] = val; + qArrayPanel.setValues(vals); + setSingleQ(vals); + } + else { + double[] vals = new double[in.length+1]; + for(int i = 0; i < in.length; i++) { + vals[i] = in[i]; + } + vals[in.length] = val; + qArrayPanel.setValues(vals); + setSingleQ(vals); + } + } } } - }); + }; + + CellClickHandler cchRange = new CellClickHandler() { + public void onCellClick(CellClickEvent e) { + if (e.getColNum() == 0 && !e.getRecord().getEnabled ()) { + Record r = e.getRecord (); + double val = r.getAttributeAsDouble("value"); + if(isWMode() && isRangeMode()) { + wRangePanel.setValues( + val, + wRangePanel.getTo(), + wRangePanel. getStep()); + } + else if (!isWMode() && isRangeMode()) { + qRangePanel.setValues( + val, + qRangePanel.getTo(), + qRangePanel.getStep()); + } + } + if (e.getColNum() == 1 && !e.getRecord().getEnabled()) { + Record r = e.getRecord (); + double val = r.getAttributeAsDouble("value"); + if (isWMode() && isRangeMode()) { + wRangePanel.setValues( + wRangePanel.getFrom(), + val, + wRangePanel.getStep()); + } + else if(!isWMode() && isRangeMode()) { + qRangePanel.setValues( + qRangePanel.getFrom(), + val, + qRangePanel.getStep()); + } + } + } + }; + wqTable.addCellClickHandler(cch); + wqRangeTable.addCellClickHandler(cchRange); addWQ.setCellIcon (IMAGES.markerGreen().getURL()); ListGridField addWQMin = new ListGridField("", ""); @@ -259,18 +349,7 @@ addWQMax.setType(ListGridFieldType.ICON); addWQMax.setWidth(30); - wqRangeTable.addCellClickHandler(new CellClickHandler() { - public void onCellClick(CellClickEvent e) { - if (e.getColNum() == 0 && e.getRecord().getEnabled ()) { - Record r = e.getRecord (); - double val = r.getAttributeAsDouble("value"); -// setValue(val); - } - else if (e.getColNum() == 1 && e.getRecord().getEnabled()) { - - } - } - }); + wqRangeTable.addCellClickHandler(cch); addWQMin.setCellIcon(IMAGES.markerGreen().getURL()); addWQMax.setCellIcon(IMAGES.markerRed().getURL()); @@ -294,7 +373,8 @@ value_r.setType(ListGridFieldType.TEXT); type_r.setWidth("50"); - + wqTable.setSelectionType(SelectionStyle.SINGLE); + wqRangeTable.setSelectionType(SelectionStyle.SINGLE); wqTable.setFields(addWQ, name, type, value); wqRangeTable.setFields(addWQMin, addWQMax, name_r, type_r, value_r); } @@ -390,9 +470,9 @@ createWQInputPanel(); // the initial panel is the Single-W panel. double[] values = getSingleW(); - container.addMember(new DoubleArrayPanel( - MESSAGE.unitWSingle(), values, this)); - + wArrayPanel = new DoubleArrayPanel( + MESSAGE.unitWSingle(), values, this); + container.addMember(wArrayPanel); container.addMember(wqTable); layout.addMember(modeForm); layout.addMember(container); @@ -718,10 +798,10 @@ // Single W mode double[] values = getSingleW(); - newPanel = new DoubleArrayPanel( + wArrayPanel = new DoubleArrayPanel( MESSAGE.unitWSingle(), values, this); - container.addMember(newPanel); + container.addMember(wArrayPanel); container.addMember(wqTable); } else { @@ -730,12 +810,12 @@ double to = getToW(); double step = getStepW(); - newPanel = new DoubleRangePanel( + wRangePanel = new DoubleRangePanel( MESSAGE.unitWFrom(), MESSAGE.unitWTo(), MESSAGE.unitWStep(), from, to, step, 250, this); - container.addMember(newPanel); + container.addMember(wRangePanel); container.addMember(wqRangeTable); } } @@ -744,9 +824,9 @@ // Single Q mode double[] values = getSingleQ(); - newPanel = new DoubleArrayPanel( + qArrayPanel = new DoubleArrayPanel( MESSAGE.unitQSingle(), values, this); - container.addMember(newPanel); + container.addMember(qArrayPanel); container.addMember(wqTable); } else { @@ -755,12 +835,12 @@ double to = getToQ(); double step = getStepQ(); - newPanel = new DoubleRangePanel( + qRangePanel = new DoubleRangePanel( MESSAGE.unitQFrom(), MESSAGE.unitQTo(), MESSAGE.unitQStep(), from, to, step, 250, this); - container.addMember(newPanel); + container.addMember(qRangePanel); container.addMember(wqRangeTable); } } @@ -1031,7 +1111,4 @@ return; } } - - - // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :