[Dive4elements-commits] [PATCH 6 of 7] Added JavaScript callback to get the selected module in native JavaScript code

Wald Commits scm-commit at wald.intevation.org
Thu May 30 15:23:03 CEST 2013


# HG changeset patch
# User Raimund Renkert <rrenkert at intevation.de>
# Date 1369919309 -7200
# Node ID 3ff2a4317167999c463a5fbcf34bc5dd8c0cf49a
# Parent  766cba02ae4a99d691c098f0b2df0fba4d85bbea
Added JavaScript callback to get the selected module in native JavaScript code.

diff -r 766cba02ae4a -r 3ff2a4317167 gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java
--- a/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java	Thu May 30 15:07:29 2013 +0200
+++ b/gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java	Thu May 30 15:08:29 2013 +0200
@@ -55,7 +55,7 @@
     protected FLYSConstants MESSAGES = GWT.create(FLYSConstants.class);
 
     /** The module checkboxes.*/
-    protected RadioGroupItem radio;
+    protected static RadioGroupItem radio;
 
     /** */
     protected Module[] modules;
@@ -110,6 +110,7 @@
     @Override
     public Canvas create(DataList data) {
         GWT.log("ModuleSelection - create()");
+        createCallback();
         VLayout newLayout = new VLayout();
         newLayout.setMembersMargin(10);
         newLayout.setAlign(VerticalAlignment.TOP);
@@ -236,5 +237,14 @@
     public void setRivers(Map<String, HLayout> rivers) {
         this.rivers = rivers;
     }
+
+    private native void createCallback() /*-{
+        $wnd.getModule = @org.dive4elements.river.client.client.ui.ModuleSelection::getSelectedModule();
+    }-*/;
+
+    private static String getSelectedModule() {
+        GWT.log("selected: " + radio.getValueAsString());
+        return radio.getValueAsString();
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :


More information about the Dive4elements-commits mailing list