[Yanel-commits] rev 31479 - 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 09:39:17 CET 2008


Author: michi
Date: 2008-02-08 09:39:16 +0100 (Fri, 08 Feb 2008)
New Revision: 31479

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

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-08 08:38:54 UTC (rev 31478)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/PolicyListBoxWidget.java	2008-02-08 08:39:16 UTC (rev 31479)
@@ -30,6 +30,8 @@
 import com.google.gwt.user.client.ui.VerticalPanel;
 import com.google.gwt.user.client.ui.Widget;
 
+import java.util.Vector;
+
 /**
  *
  */
@@ -55,6 +57,7 @@
         lb.addItem("U: alice (Read,Write)");
         lb.addItem("U: karin (Read)");
         lb.addItem("U: susi");
+        lb.addItem("WORLD");
         vp.add(lb);
 
         readCB = new CheckBox("Read");
@@ -77,11 +80,12 @@
      */
     public void onClick(Widget sender) {
         if (sender == readCB || sender == writeCB) {
-            int i = lb.getSelectedIndex();
-            if (i > 0) {
-                String selectedIdentity = lb.getValue(i);
+            String selectedIdentity = getSelectedItemValue();
+            if (selectedIdentity != null) {
                 if (sender == readCB) {
                     Window.alert("Add/Remove Read right from selected identity " + selectedIdentity + " from policy");
+                    String[] currentRights = getRights(selectedIdentity);
+                    Vector newRights = new Vector();
                 } else if (sender == writeCB) {
                     Window.alert("Add/Remove Write right from selected identity " + selectedIdentity + " from policy");
                 }
@@ -91,8 +95,7 @@
                 writeCB.setChecked(false);
             }
         } else if (sender == lb) {
-            int i = lb.getSelectedIndex();
-            String selectedIdentity = lb.getValue(i);
+            String selectedIdentity = getSelectedItemValue();
 
             //Window.alert("Update check boxes!");
             String[] rights = getRights(selectedIdentity);
@@ -125,4 +128,15 @@
             return new String[0];
         }
     }
+
+    /**
+     *
+     */
+    private String getSelectedItemValue() {
+        int i = lb.getSelectedIndex();
+        if (i >= 0) {
+            return lb.getValue(i);
+        }
+        return null;
+    }
 }



More information about the Yanel-commits mailing list