comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/WQAdaptedInputPanel.java @ 5526:35cd6286da2d

WQAdaptedInputPanel: Switch focus when input had been done via inputhelper (part flys/issue1133).
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 28 Mar 2013 11:36:19 +0100
parents 7876163fc40e
children 6dbc111e9aec
comparison
equal deleted inserted replaced
5488:6ec7c8ebb2c9 5526:35cd6286da2d
92 protected FLYSConstants MSG = GWT.create(FLYSConstants.class); 92 protected FLYSConstants MSG = GWT.create(FLYSConstants.class);
93 93
94 /** Stores the input panels related to their keys.*/ 94 /** Stores the input panels related to their keys.*/
95 protected Map<String, DoubleArrayPanel> wqranges; 95 protected Map<String, DoubleArrayPanel> wqranges;
96 96
97 /** Index the input panels related to their keys.*/
98 protected ArrayList<DoubleArrayPanel> doubleArrayPanels;
99
97 /** Stores the min/max values for each q range.*/ 100 /** Stores the min/max values for each q range.*/
98 protected Map<String, double[]> qranges; 101 protected Map<String, double[]> qranges;
99 102
100 /** Stores the min/max values for each w range.*/ 103 /** Stores the min/max values for each w range.*/
101 protected Map<String, double[]> wranges; 104 protected Map<String, double[]> wranges;
116 protected DoubleArrayPanel itemWithFocus; 119 protected DoubleArrayPanel itemWithFocus;
117 120
118 121
119 public WQAdaptedInputPanel() { 122 public WQAdaptedInputPanel() {
120 wqranges = new HashMap<String, DoubleArrayPanel>(); 123 wqranges = new HashMap<String, DoubleArrayPanel>();
124 doubleArrayPanels = new ArrayList<DoubleArrayPanel>();
121 qranges = new HashMap<String, double[]>(); 125 qranges = new HashMap<String, double[]>();
122 wranges = new HashMap<String, double[]>(); 126 wranges = new HashMap<String, double[]>();
123 qdTable = new QDTable(); 127 qdTable = new QDTable();
124 wTable = new WTable(); 128 wTable = new WTable();
125 initTableListeners(); 129 initTableListeners();
187 Record r = e.getRecord(); 191 Record r = e.getRecord();
188 double val = r.getAttributeAsDouble("value"); 192 double val = r.getAttributeAsDouble("value");
189 193
190 if (itemWithFocus != null) { 194 if (itemWithFocus != null) {
191 itemWithFocus.setValues(new double[]{val}); 195 itemWithFocus.setValues(new double[]{val});
196 // TODO 1133, show different data for each doublearraypanel
197 int i = doubleArrayPanels.indexOf(itemWithFocus);
198 if (i == doubleArrayPanels.size()-1) {
199 doubleArrayPanels.get(0).focusInItem(1);
200 }
201 else {
202 doubleArrayPanels.get(i+1).focusInItem(1);
203 }
192 } 204 }
193 } 205 }
194 }; 206 };
195 207
196 qdTable.addCellClickHandler(handler); 208 qdTable.addCellClickHandler(handler);
464 String label = item.getStringValue(); 476 String label = item.getStringValue();
465 DoubleArrayPanel dap = new DoubleArrayPanel( 477 DoubleArrayPanel dap = new DoubleArrayPanel(
466 label, null, this, this, TitleOrientation.LEFT); 478 label, null, this, this, TitleOrientation.LEFT);
467 479
468 wqranges.put(title, dap); 480 wqranges.put(title, dap);
481 doubleArrayPanels.add(dap);
469 482
470 if (item instanceof WQDataItem) { 483 if (item instanceof WQDataItem) {
471 WQDataItem wq = (WQDataItem) item; 484 WQDataItem wq = (WQDataItem) item;
472 double[] mmQ = wq.getQRange(); 485 double[] mmQ = wq.getQRange();
473 double[] mmW = wq.getWRange(); 486 double[] mmW = wq.getWRange();

http://dive4elements.wald.intevation.org