You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by eh...@apache.org on 2006/10/15 22:06:39 UTC

svn commit: r464267 - in /incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages: AnnotationsPanelsPage$Test.html AnnotationsPanelsPage.html AnnotationsPanelsPage.java

Author: ehillenius
Date: Sun Oct 15 13:06:38 2006
New Revision: 464267

URL: http://svn.apache.org/viewvc?view=rev&rev=464267
Log:
so more dirty testing

Modified:
    incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage$Test.html
    incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.html
    incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.java

Modified: incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage$Test.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage%24Test.html?view=diff&rev=464267&r1=464266&r2=464267
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage$Test.html (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage$Test.html Sun Oct 15 13:06:38 2006
@@ -2,4 +2,10 @@
 	<div style="border: solid; margin:2px; padding:2px;">
 		This panel is only visible when the selected user has either role USER or role ADMIN.
 	</div>
+    <ul>
+      <li wicket:id="list">
+        <span wicket:id="userLabel">[user]</span>
+        <span wicket:id="adminLabel">[admin]</span>
+      </li>
+    </ul>
 </wicket:panel>

Modified: incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.html
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.html?view=diff&rev=464267&r1=464266&r2=464267
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.html (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.html Sun Oct 15 13:06:38 2006
@@ -23,7 +23,7 @@
   
     <a href="#" wicket:id="link">switch</a>
     <div wicket:id="outer">
-      <span wicket:id="test">[TEST]</span>
+      <span wicket:id="test">[nothing here yet]</span>
     </div>
 
 </html>

Modified: incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.java
URL: http://svn.apache.org/viewvc/incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.java?view=diff&rev=464267&r1=464266&r2=464267
==============================================================================
--- incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.java (original)
+++ incubator/wicket/branches/wicket-1.x/wicket-auth-roles-examples/src/main/java/wicket/authorization/strategies/role/example/pages/AnnotationsPanelsPage.java Sun Oct 15 13:06:38 2006
@@ -18,6 +18,9 @@
  */
 package wicket.authorization.strategies.role.example.pages;
 
+import java.util.Arrays;
+import java.util.List;
+
 import wicket.ajax.AjaxRequestTarget;
 import wicket.ajax.markup.html.AjaxLink;
 import wicket.authorization.Action;
@@ -25,6 +28,9 @@
 import wicket.authorization.strategies.role.annotations.AuthorizeAction;
 import wicket.markup.html.WebMarkupContainer;
 import wicket.markup.html.WebPage;
+import wicket.markup.html.basic.Label;
+import wicket.markup.html.list.ListItem;
+import wicket.markup.html.list.ListView;
 import wicket.markup.html.panel.Panel;
 
 /**
@@ -34,6 +40,19 @@
  */
 public class AnnotationsPanelsPage extends WebPage
 {
+	@AuthorizeAction(action = Action.RENDER, roles = Roles.ADMIN)
+	private static class AdminLabel extends Label
+	{
+		/**
+		 * @param id
+		 * @param nbr
+		 */
+		public AdminLabel(String id, String nbr)
+		{
+			super(id, "label for admins " + nbr);
+		}
+	}
+
 	/**
 	 * A panel that is only visible for users with role ADMIN.
 	 */
@@ -69,41 +88,67 @@
 	}
 
 	/**
-	 * A panel that is only visible for users with role ADMIN or USER.
+	 * A panel that is visible for all users.
 	 */
-	@AuthorizeAction(action = Action.RENDER, roles = { Roles.ADMIN, Roles.USER })
-	private static final class Test extends Panel
+	private static final class ForAllUsers extends Panel
 	{
 		/**
 		 * Construct.
 		 * 
 		 * @param id
 		 */
-		public Test(String id)
+		public ForAllUsers(String id)
 		{
 			super(id);
 		}
 	}
 
 	/**
-	 * A panel that is visible for all users.
+	 * A panel that is only visible for users with role ADMIN or USER.
 	 */
-	private static final class ForAllUsers extends Panel
+	@AuthorizeAction(action = Action.RENDER, roles = { Roles.ADMIN, Roles.USER })
+	private static final class Test extends Panel
 	{
 		/**
 		 * Construct.
 		 * 
 		 * @param id
 		 */
-		public ForAllUsers(String id)
+		public Test(String id)
 		{
 			super(id);
+			List l = Arrays.asList("1", "2", "3", "4", "5");
+			ListView listView = new ListView("list", l)
+			{
+				@Override
+				protected void populateItem(ListItem item)
+				{
+					String i = item.getModelObjectAsString();
+					item.add(new UserLabel("userLabel", i));
+					item.add(new AdminLabel("adminLabel", i));
+				}
+			};
+			add(listView);
+			listView.setReuseItems(true);
 		}
 	}
 
-	private boolean showDummy = true;
+	@AuthorizeAction(action = Action.RENDER, roles = Roles.USER)
+	private static class UserLabel extends Label
+	{
+		/**
+		 * @param id
+		 * @param nbr
+		 */
+		public UserLabel(String id, String nbr)
+		{
+			super(id, "label for users " + nbr);
+		}
+	}
 
 	private WebMarkupContainer outer;
+
+	private boolean showDummy = true;
 
 	/**
 	 * Construct.