You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by vk...@apache.org on 2009/05/11 15:01:53 UTC

svn commit: r773550 - in /portals/jetspeed-2/applications/j2-admin/trunk/src/main: java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html

Author: vkumar
Date: Mon May 11 13:01:52 2009
New Revision: 773550

URL: http://svn.apache.org/viewvc?rev=773550&view=rev
Log:
JetspeedPrincipalManagementPortlet
Adding ajax feature to principal list
refreshing user list, if user get updated or removed

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=773550&r1=773549&r2=773550&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java Mon May 11 13:01:52 2009
@@ -56,6 +56,9 @@
 import org.apache.jetspeed.security.User;
 import org.apache.jetspeed.security.UserCredential;
 import org.apache.jetspeed.security.UserManager;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.ajax.markup.html.navigation.paging.AjaxPagingNavigator;
 import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByLink;
 import org.apache.wicket.extensions.markup.html.repeater.data.sort.OrderByLink.VoidCssProvider;
 import org.apache.wicket.extensions.markup.html.repeater.data.table.DataTable;
@@ -67,10 +70,10 @@
 import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
 import org.apache.wicket.extensions.markup.html.tabs.ITab;
 import org.apache.wicket.extensions.markup.html.tabs.TabbedPanel;
+import org.apache.wicket.markup.html.WebMarkupContainer;
 import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Button;
 import org.apache.wicket.markup.html.form.CheckBox;
-import org.apache.wicket.markup.html.form.CheckGroup;
 import org.apache.wicket.markup.html.form.ChoiceRenderer;
 import org.apache.wicket.markup.html.form.DropDownChoice;
 import org.apache.wicket.markup.html.form.Form;
@@ -125,28 +128,10 @@
 
     protected JetspeedPrincipal principal;
     final PrincipaDataProvider principalDataProvider;
+    WebMarkupContainer group;
 
     protected String selectedUserName;
 
-    protected List principalList;
-
-    /**
-     * @return the principalList
-     */
-    public List getPrincipalList()
-    {
-        return principalList;
-    }
-
-    /**
-     * @param principalList
-     *            the principalList to set
-     */
-    public void setPrincipalList(List principalList)
-    {
-        this.principalList = principalList;
-    }
-
     public JetspeedPrincipalManagementPortlet()
     {
         super();
@@ -162,16 +147,8 @@
                         principalParam);
         ITab tab = null;
         tabs = new ArrayList();
-        final CheckGroup group = new CheckGroup("group", new ArrayList());
-        Form form = new Form("form")
-        {
-
-            protected void onSubmit()
-            {
-                info("selected person(s): " + group.getModel());
-            }
-        };
-       
+        group = new WebMarkupContainer("group");
+        group.setOutputMarkupId(true);
         principalDataProvider = new PrincipaDataProvider(getManager(),getSearchString());
         
         final DataView<JetspeedPrincipal> principalView = new DataView<JetspeedPrincipal>("entries", principalDataProvider)
@@ -194,7 +171,7 @@
                 item.add(editLink);
             }
         };
-
+        principalView.setItemsPerPage(10);
         group.add(principalView);
 
         OrderByLink orderLink = new OrderByLink("nameOrderLink", "name", principalDataProvider,VoidCssProvider.getInstance())
@@ -217,10 +194,9 @@
         orderLink.add(new Label("nameSort",new ResourceModel(principalParam)));
         group.add(orderLink);
         
-        group.add(new PagingNavigator("navigator", principalView));
-        form.add(group);
+        group.add(new AjaxPagingNavigator("navigator", principalView));
         
-        add(form);
+        add(group);
         Form searchForm = new Form("searchForm")
         {
 
@@ -345,6 +321,7 @@
                         getPrincipal().setEnabled(isUserEnabled());
                         getManager().updatePrincipal(principal);
                         setPrincipal(principal);
+                        principalDataProvider.refresh(getSearchString());
                     }
                     catch (SecurityException jSx)
                     {
@@ -363,6 +340,7 @@
                         getManager().removePrincipal(principal.getName());
                         setPrincipal(null);
                         controlPannels(false);
+                        principalDataProvider.refresh(getSearchString());
                     }
                     catch (SecurityException e)
                     {
@@ -706,7 +684,7 @@
             DropDownChoice profilingtRole = new DropDownChoice("profilingRule",
                     new PropertyModel(this, "profilingRule"), getProfileList());
             userForm.add(profilingtRole);
-            Button newUser = new Button("addUser")
+            Button newUser = new Button("addUser",new ResourceModel(principalParam +".add.button"))
             {
 
                 @Override
@@ -794,8 +772,8 @@
                     {
                         log.error("Failed to update user.", jSx);
                     }
+                    principalDataProvider.refresh(getSearchString());
                 }
-
             };
             userForm.add(newUser);
         }
@@ -842,7 +820,10 @@
 				public void onSubmit() {
 					JetspeedPrincipal principal =  getManager().newPrincipal(getUserName(),false);
 					try{
-						getManager().addPrincipal(principal, null);						
+						getManager().addPrincipal(principal, null);
+						setPrincipal(principal);
+						controlPannels(true);
+						principalDataProvider.refresh(getSearchString());
 					}
 				    catch (SecurityException jSx)
 	                {
@@ -932,6 +913,7 @@
                         principal.setEnabled(isUserEnabled());
                         getManager().updatePrincipal(principal);
                         setPrincipal(principal);
+                        principalDataProvider.refresh(getSearchString());
                     } catch (SecurityException jSx)
                     {
                         error(jSx.getMessage());
@@ -947,6 +929,7 @@
                         getManager().removePrincipal(principal.getName());
                         setPrincipal(null);
                         controlPannels(false);
+                        principalDataProvider.refresh(getSearchString());
                     }
                     catch (SecurityException e)
                     {
@@ -1990,7 +1973,6 @@
     @Override
     protected void onBeforeRender()
     {
-        setPrincipalList(getPrincipalLists(getSearchString()));
         if (getPrincipal() != null)
         {
             Label label = (Label) get("userLabel");

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html?rev=773550&r1=773549&r2=773550&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html (original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/resources/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.html Mon May 11 13:01:52 2009
@@ -19,6 +19,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
 <html xmlns="http://www.w3.org/1999/xhtml">
+<wicket:head>
+</wicket:head>
 <table cellpadding="0" cellspacing="1" border="1">
 	<tr>
 		<td>
@@ -43,7 +45,7 @@
 	</tr>
 	<tr>
 		<td width="350px">
-		<form wicket:id="form"><span wicket:id="group">
+		<span wicket:id="group">
 
 		<table cellpadding="0" cellspacing="1" border="1" width="100%">
 			<th class="portlet-section-header"><span wicket:id="principal" /></th>
@@ -57,7 +59,7 @@
 			</tr>
 		</table>
 		<div wicket:id="navigator"></div>
-		</span></form>
+		</span>
 		</td>
 	</tr>
 </table>



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org