changeset 6133:3ff2a4317167

Added JavaScript callback to get the selected module in native JavaScript code.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 30 May 2013 15:08:29 +0200
parents 766cba02ae4a
children 69f95a016308
files gwt-client/src/main/java/org/dive4elements/river/client/client/ui/ModuleSelection.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 :

http://dive4elements.wald.intevation.org