[Yanel-commits] rev 31473 - public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client

michi at wyona.com michi at wyona.com
Fri Feb 8 00:44:09 CET 2008


Author: michi
Date: 2008-02-08 00:44:09 +0100 (Fri, 08 Feb 2008)
New Revision: 31473

Modified:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java
Log:
update checkboxes

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-02-07 23:25:40 UTC (rev 31472)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-02-07 23:44:09 UTC (rev 31473)
@@ -88,7 +88,34 @@
                 Window.alert("No identity has been selected! Please select an identity in order to assign rights.");
             }
         } else if (sender == lb) {
-                Window.alert("Update check boxes!");
+            int i = lb.getSelectedIndex();
+            String selectedIdentity = lb.getValue(i);
+
+            Window.alert("Update check boxes!");
+            String[] rights = getRights(selectedIdentity);
+
+            boolean hasReadBeenChecked = false;
+            boolean hasWriteBeenChecked = false;
+            for (int j = 0; j < rights.length; j++) {
+                if (rights[j].equals("Read")) {
+                    readCB.setChecked(true);
+                    hasReadBeenChecked = true;
+                } else if (rights[j].equals("Write")) {
+                    writeCB.setChecked(true);
+                    hasWriteBeenChecked = true;
+                }
+            }
+            if (!hasReadBeenChecked) readCB.setChecked(false);
+            if (!hasWriteBeenChecked) writeCB.setChecked(false);
         }
     }
+
+    /**
+     *
+     */
+    private String[] getRights(String identity) {
+        String[] rights = new String[1];
+        rights[0] = "Read";
+        return rights;
+    }
 }



More information about the Yanel-commits mailing list