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

michi at wyona.com michi at wyona.com
Mon Feb 25 23:38:32 CET 2008


Author: michi
Date: 2008-02-25 23:38:31 +0100 (Mon, 25 Feb 2008)
New Revision: 32473

Modified:
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AccessPolicyEditor.java
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousIdentitiesAndRightsGetter.java
   public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
Log:
alerts added

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AccessPolicyEditor.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AccessPolicyEditor.java	2008-02-25 21:45:18 UTC (rev 32472)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AccessPolicyEditor.java	2008-02-25 22:38:31 UTC (rev 32473)
@@ -16,6 +16,7 @@
 package org.wyona.yanel.gwt.accesspolicyeditor.client;
 
 import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.user.client.Timer;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.ui.Button;
 import com.google.gwt.user.client.ui.ClickListener;
@@ -90,6 +91,22 @@
         try {
             final com.google.gwt.http.client.Request request = ag.execute();
             // TODO: Implement loop until request has finished execution
+            Window.alert("Just a second to process the identities response ...");
+
+            Timer t = new Timer() {
+                public void run() {
+                    if (request.isPending()) {
+                        scheduleRepeating(10);
+                    } else {
+                        this.cancel();
+                    }
+                }
+            };
+/*
+            while(request.isPending()) {
+                Window.alert("Response not processed yet!");
+            }
+*/
         } catch (Exception e) {
              //if (!com.google.gwt.core.client.GWT.isScript()) {
              e.printStackTrace();
@@ -111,6 +128,7 @@
         final AsynchronousPolicyGetter apg = new AsynchronousPolicyGetter("sample-policy.xml");
         try {
             final com.google.gwt.http.client.Request request = apg.execute();
+            Window.alert("Just a second to process the policy response ...");
             // TODO: Implement loop until request has finished execution
         } catch (Exception e) {
              Window.alert("Exception: " + e.getMessage());

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousIdentitiesAndRightsGetter.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousIdentitiesAndRightsGetter.java	2008-02-25 21:45:18 UTC (rev 32472)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousIdentitiesAndRightsGetter.java	2008-02-25 22:38:31 UTC (rev 32473)
@@ -49,18 +49,21 @@
         // http://groups.google.com/group/Google-Web-Toolkit/msg/a6f399bc4d46f795
         // http://code.google.com/p/bunsenandbeaker/wiki/DevGuideXML
         Element rootElement = XMLParser.parse(response.getText()).getDocumentElement();
-        Window.alert("Root element: " + rootElement.getTagName());
+        //Window.alert("Root element: " + rootElement.getTagName());
         Element usersElement = getFirstChildElement(rootElement, "users");
         NodeList userElements = usersElement.getElementsByTagName("user");
         for (int i = 0; i < userElements.getLength(); i++) {
             users.add(((Element) userElements.item(i)).getAttribute("id"));
+            //Window.alert("User: " + (String) users.elementAt(i));
         }
+        //Window.alert("Identities response processed!");
     }
 
     /**
      * Get users
      */
     public String[] getUsers() {
+        Window.alert("Number of users: " + users.size());
         String[] u = new String[users.size()];
         for (int i = 0; i < users.size(); i++) {
             u[i] = (String) users.elementAt(i);

Modified: public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java
===================================================================
--- public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-02-25 21:45:18 UTC (rev 32472)
+++ public/yanel/contributions/ajax-components/src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/client/AsynchronousPolicyGetter.java	2008-02-25 22:38:31 UTC (rev 32473)
@@ -19,6 +19,10 @@
 
 import com.google.gwt.http.client.Request;
 import com.google.gwt.http.client.Response;
+import com.google.gwt.xml.client.Element;
+import com.google.gwt.xml.client.NodeList;
+import com.google.gwt.xml.client.XMLParser;
+import com.google.gwt.user.client.Window;
 
 import java.util.Vector;
 
@@ -41,8 +45,10 @@
      * Also see src/access-policy-editor/java/org/wyona/yanel/gwt/accesspolicyeditor/public/sample-identities-and-usecases.xml
      */
     public void onResponseReceived(final Request request, final Response response) {
-        // TODO
+        Element rootElement = XMLParser.parse(response.getText()).getDocumentElement();
+        //Window.alert("Root element: " + rootElement.getTagName());
         identities.add("u: jim (Write)");
+        //Window.alert("Policy response processed!");
     }
 
     /**



More information about the Yanel-commits mailing list