ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r792534 - in /incubator/ace/trunk/webui: src/org/apache/ace/client/ src/org/apache/ace/client/services/ src/org/apache/ace/server/ war/
Date Thu, 09 Jul 2009 12:52:12 GMT
Author: marrs
Date: Thu Jul  9 12:52:12 2009
New Revision: 792534

URL: http://svn.apache.org/viewvc?rev=792534&view=rev
Log:
ACE-26 applied the second patch

Modified:
    incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupService.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupServiceAsync.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseService.java
    incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseServiceAsync.java
    incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java
    incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java
    incubator/ace/trunk/webui/war/webui.css
    incubator/ace/trunk/webui/war/webui.html

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/GroupTable.java Thu Jul  9 12:52:12
2009
@@ -24,7 +24,10 @@
 import org.apache.ace.client.services.GroupServiceAsync;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.TextBox;
 
 /**
  * Table class for the groups.
@@ -48,5 +51,22 @@
         }
         return null;
     }
+    
+    void addNew() {
+        String result = Window.prompt("Add group", "New group");
+        if (result != null) {
+            m_groupService.addGroup(result, new AsyncCallback<Void>() {
+                public void onFailure(Throwable caught) {
+                    Window.alert("Error adding group.");
+                }
+
+                public void onSuccess(Void result) {
+                    // Hurrah!
+                }
+                
+            });
+        }
+    }
+
 
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/LicenseTable.java Thu Jul  9 12:52:12
2009
@@ -24,6 +24,7 @@
 import org.apache.ace.client.services.LicenseServiceAsync;
 
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.rpc.AsyncCallback;
 
 /**
@@ -49,4 +50,19 @@
         return null;
     }
 
+    void addNew() {
+        String result = Window.prompt("Add license", "New license");
+        if (result != null) {
+            m_licenseService.addLicense(result, new AsyncCallback<Void>() {
+                public void onFailure(Throwable caught) {
+                    Window.alert("Error adding license.");
+                }
+
+                public void onSuccess(Void result) {
+                    // Hurrah!
+                }
+                
+            });
+        }
+    }
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/Main.java Thu Jul  9 12:52:12 2009
@@ -22,7 +22,11 @@
 import java.util.Map;
 
 import com.google.gwt.core.client.EntryPoint;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.HorizontalPanel;
 import com.google.gwt.user.client.ui.Label;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.ScrollPanel;
@@ -50,6 +54,25 @@
      * This is the entry point method.
      */
     public void onModuleLoad() {
+        // Add the header panels
+        Button addGroupButton = new Button("+");
+        addGroupButton.addStyleDependentName("add");
+        RootPanel.get("groupsHeader").add(addGroupButton);
+        addGroupButton.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                m_groupTable.addNew();
+            }
+        });
+        
+        Button addLicenseButton = new Button("+");
+        addLicenseButton.addStyleDependentName("add");
+        RootPanel.get("licensesHeader").add(addLicenseButton);
+        addLicenseButton.addClickHandler(new ClickHandler() {
+            public void onClick(ClickEvent event) {
+                m_licenseTable.addNew();
+            }
+        });
+        
         // Create some scrollpanels with our tables
         ScrollPanel scrollPanel = new ScrollPanel(m_groupTable);
         scrollPanel.setHeight("30em");

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupService.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupService.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupService.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupService.java Thu Jul
 9 12:52:12 2009
@@ -30,4 +30,9 @@
      * Gets group descriptors for all available groups.
      */
     GroupDescriptor[] getGroups() throws Exception;
+    
+    /**
+     * Adds a new group with the given name.
+     */
+    void addGroup(String name) throws Exception;
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupServiceAsync.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupServiceAsync.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupServiceAsync.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/GroupServiceAsync.java Thu
Jul  9 12:52:12 2009
@@ -25,4 +25,5 @@
  */
 public interface GroupServiceAsync {
     void getGroups(AsyncCallback<GroupDescriptor[]> callback);
+    void addGroup(String name, AsyncCallback<Void> callback);
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseService.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseService.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseService.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseService.java Thu Jul
 9 12:52:12 2009
@@ -30,4 +30,9 @@
      * Gets license descriptors for all available licenses.
      */
     LicenseDescriptor[] getLicenses() throws Exception;
+
+    /**
+     * Adds a new license with the given name.
+     */
+    void addLicense(String name) throws Exception;
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseServiceAsync.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseServiceAsync.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseServiceAsync.java
(original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/client/services/LicenseServiceAsync.java
Thu Jul  9 12:52:12 2009
@@ -25,4 +25,5 @@
  */
 public interface LicenseServiceAsync {
     void getLicenses(AsyncCallback<LicenseDescriptor[]> callback);
+    void addLicense(String name, AsyncCallback<Void> callback);
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/GroupServiceImpl.java Thu Jul  9 12:52:12
2009
@@ -19,7 +19,10 @@
 package org.apache.ace.server;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.Properties;
 
 import org.apache.ace.client.repository.object.GroupObject;
 import org.apache.ace.client.repository.repository.GroupRepository;
@@ -35,14 +38,22 @@
     private static final long serialVersionUID = -5744202709461660202L;
 
     public GroupDescriptor[] getGroups() throws Exception {
-        GroupRepository lr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
+        GroupRepository gr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
         
         List<GroupDescriptor> result = new ArrayList<GroupDescriptor>();
         
-        for (GroupObject g : lr.get()) {
+        for (GroupObject g : gr.get()) {
             result.add(new GroupDescriptor(g.getName()));
         }
         
         return result.toArray(new GroupDescriptor[result.size()]);
     }
+
+    public void addGroup(String name) throws Exception {
+        GroupRepository gr = Activator.getService(getThreadLocalRequest(), GroupRepository.class);
+        
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(GroupObject.KEY_NAME, name);
+        gr.create(props, null);
+    }
 }

Modified: incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java (original)
+++ incubator/ace/trunk/webui/src/org/apache/ace/server/LicenseServiceImpl.java Thu Jul  9
12:52:12 2009
@@ -19,7 +19,9 @@
 package org.apache.ace.server;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.ace.client.repository.object.LicenseObject;
 import org.apache.ace.client.repository.repository.LicenseRepository;
@@ -45,4 +47,12 @@
         
         return result.toArray(new LicenseDescriptor[result.size()]);
     }
+
+    public void addLicense(String name) throws Exception {
+        LicenseRepository gr = Activator.getService(getThreadLocalRequest(), LicenseRepository.class);
+        
+        Map<String, String> props = new HashMap<String, String>();
+        props.put(LicenseObject.KEY_NAME, name);
+        gr.create(props, null);
+    }
 }

Modified: incubator/ace/trunk/webui/war/webui.css
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/war/webui.css?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/war/webui.css (original)
+++ incubator/ace/trunk/webui/war/webui.css Thu Jul  9 12:52:12 2009
@@ -40,3 +40,8 @@
 .serverStatusBad {
   color: red;
 }
+
+/* an 'add' button */
+.gwt-Button-add {
+  width: 2em;
+}
\ No newline at end of file

Modified: incubator/ace/trunk/webui/war/webui.html
URL: http://svn.apache.org/viewvc/incubator/ace/trunk/webui/war/webui.html?rev=792534&r1=792533&r2=792534&view=diff
==============================================================================
--- incubator/ace/trunk/webui/war/webui.html (original)
+++ incubator/ace/trunk/webui/war/webui.html Thu Jul  9 12:52:12 2009
@@ -42,7 +42,11 @@
 
     <table align="center">
     <tr span="4" id="buttonPanel" />
-    <tr><td><h3>Bundles</h3></td><td><h3>Groups</h3></td><td><h3>Licenses</h3></td><td><h3>Targets</h3></td></tr>
+    <tr>
+        <td><h3>Bundles</h3></td>
+        <td><h3 id="groupsHeader">Groups</h3></td>
+        <td><h3 id="licensesHeader">Licenses</h3></td>
+        </td><td><h3>Targets</h3></td></tr>
     <tr>
         <td>Bundles column goes here</td>
         <td id="groupColumnContainer"></td>



Mime
View raw message