changeset 9293:e3e465766cfe

FocusHandler re-added
author gernotbelger
date Tue, 24 Jul 2018 16:02:40 +0200
parents e6958f0e72fa
children 7a8b9331a946
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/BunduWstWQPanel.java
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/BunduWstWQPanel.java	Tue Jul 24 15:30:10 2018 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/bundu/BunduWstWQPanel.java	Tue Jul 24 16:02:40 2018 +0200
@@ -39,6 +39,8 @@
 import com.smartgwt.client.widgets.form.fields.TextItem;
 import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
 import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
+import com.smartgwt.client.widgets.form.fields.events.FocusEvent;
+import com.smartgwt.client.widgets.form.fields.events.FocusHandler;
 import com.smartgwt.client.widgets.form.validator.IntegerRangeValidator;
 import com.smartgwt.client.widgets.layout.HLayout;
 import com.smartgwt.client.widgets.layout.VLayout;
@@ -50,7 +52,7 @@
  *
  * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a>
  */
-public class BunduWstWQPanel extends AbstractWQAdaptedInputPanel {
+public class BunduWstWQPanel extends AbstractWQAdaptedInputPanel implements FocusHandler {
 
     private static final long serialVersionUID = -1L;
 
@@ -58,6 +60,9 @@
         Q, UD
     }
 
+    /** The currently focussed Input element. */
+    private DoubleArrayPanel itemWithFocus;
+
     /** Service to fetch W/Q MainValues. */
     private final DynamicMainValuesServiceAsync mainValueService = GWT.create(DynamicMainValuesService.class);
 
@@ -220,7 +225,7 @@
 
                 this.tabs.getTab(i).setTitle(this.tabs.getTab(i).getTitle() + " (" + label + ")");
 
-                final DoubleArrayPanel dap = new DoubleArrayPanel(label, null, this, null, TitleOrientation.LEFT);
+                final DoubleArrayPanel dap = new DoubleArrayPanel(label, null, this, this, TitleOrientation.LEFT);
                 this.wqranges.put(title, dap);
                 this.doubleArrayPanels.add(dap);
                 if (item instanceof WQDataItem) {
@@ -355,4 +360,14 @@
 
         this.mainValueService.getWQInfo(locale, river, start, end, startYear, endYear, cb);
     }
+
+    @Override
+    public void onFocus(final FocusEvent event) {
+        this.itemWithFocus = (DoubleArrayPanel) event.getForm();
+        // Switch to respective tab.
+        if (getMode().equals(mode.Q.toString())) {
+            final int inputIndex = this.doubleArrayPanels.indexOf(this.itemWithFocus);
+            this.tabs.selectTab(inputIndex);
+        }
+    }
 }
\ No newline at end of file

http://dive4elements.wald.intevation.org