comparison gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/BunduWstWQPanel.java @ 9293:e3e465766cfe

FocusHandler re-added
author gernotbelger
date Tue, 24 Jul 2018 16:02:40 +0200
parents e6958f0e72fa
children 77367e8da74d
comparison
equal deleted inserted replaced
9292:e6958f0e72fa 9293:e3e465766cfe
37 import com.smartgwt.client.widgets.form.DynamicForm; 37 import com.smartgwt.client.widgets.form.DynamicForm;
38 import com.smartgwt.client.widgets.form.fields.RadioGroupItem; 38 import com.smartgwt.client.widgets.form.fields.RadioGroupItem;
39 import com.smartgwt.client.widgets.form.fields.TextItem; 39 import com.smartgwt.client.widgets.form.fields.TextItem;
40 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent; 40 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
41 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler; 41 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
42 import com.smartgwt.client.widgets.form.fields.events.FocusEvent;
43 import com.smartgwt.client.widgets.form.fields.events.FocusHandler;
42 import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator; 44 import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
43 import com.smartgwt.client.widgets.layout.HLayout; 45 import com.smartgwt.client.widgets.layout.HLayout;
44 import com.smartgwt.client.widgets.layout.VLayout; 46 import com.smartgwt.client.widgets.layout.VLayout;
45 import com.smartgwt.client.widgets.tab.Tab; 47 import com.smartgwt.client.widgets.tab.Tab;
46 48
48 * This UIProvider creates a widget to enter W or Q data for 50 * This UIProvider creates a widget to enter W or Q data for
49 * Fixation analysis 51 * Fixation analysis
50 * 52 *
51 * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a> 53 * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a>
52 */ 54 */
53 public class BunduWstWQPanel extends AbstractWQAdaptedInputPanel { 55 public class BunduWstWQPanel extends AbstractWQAdaptedInputPanel implements FocusHandler {
54 56
55 private static final long serialVersionUID = -1L; 57 private static final long serialVersionUID = -1L;
56 58
57 private static enum mode { 59 private static enum mode {
58 Q, UD 60 Q, UD
59 } 61 }
62
63 /** The currently focussed Input element. */
64 private DoubleArrayPanel itemWithFocus;
60 65
61 /** Service to fetch W/Q MainValues. */ 66 /** Service to fetch W/Q MainValues. */
62 private final DynamicMainValuesServiceAsync mainValueService = GWT.create(DynamicMainValuesService.class); 67 private final DynamicMainValuesServiceAsync mainValueService = GWT.create(DynamicMainValuesService.class);
63 68
64 private final RadioGroupItem radiogroup = new RadioGroupItem(); 69 private final RadioGroupItem radiogroup = new RadioGroupItem();
218 final String title = item.getLabel(); 223 final String title = item.getLabel();
219 final String label = item.getStringValue(); 224 final String label = item.getStringValue();
220 225
221 this.tabs.getTab(i).setTitle(this.tabs.getTab(i).getTitle() + " (" + label + ")"); 226 this.tabs.getTab(i).setTitle(this.tabs.getTab(i).getTitle() + " (" + label + ")");
222 227
223 final DoubleArrayPanel dap = new DoubleArrayPanel(label, null, this, null, TitleOrientation.LEFT); 228 final DoubleArrayPanel dap = new DoubleArrayPanel(label, null, this, this, TitleOrientation.LEFT);
224 this.wqranges.put(title, dap); 229 this.wqranges.put(title, dap);
225 this.doubleArrayPanels.add(dap); 230 this.doubleArrayPanels.add(dap);
226 if (item instanceof WQDataItem) { 231 if (item instanceof WQDataItem) {
227 final WQDataItem wq = (WQDataItem) item; 232 final WQDataItem wq = (WQDataItem) item;
228 final double[] mmQ = wq.getQRange(); 233 final double[] mmQ = wq.getQRange();
353 final int startYear = this.bezugsjahr - this.qSeriesLength; 358 final int startYear = this.bezugsjahr - this.qSeriesLength;
354 final int endYear = this.bezugsjahr; 359 final int endYear = this.bezugsjahr;
355 360
356 this.mainValueService.getWQInfo(locale, river, start, end, startYear, endYear, cb); 361 this.mainValueService.getWQInfo(locale, river, start, end, startYear, endYear, cb);
357 } 362 }
363
364 @Override
365 public void onFocus(final FocusEvent event) {
366 this.itemWithFocus = (DoubleArrayPanel) event.getForm();
367 // Switch to respective tab.
368 if (getMode().equals(mode.Q.toString())) {
369 final int inputIndex = this.doubleArrayPanels.indexOf(this.itemWithFocus);
370 this.tabs.selectTab(inputIndex);
371 }
372 }
358 } 373 }

http://dive4elements.wald.intevation.org