You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by iv...@apache.org on 2008/11/04 23:12:53 UTC

svn commit: r711446 - in /wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging: PagingNavigation.java PagingNavigator.java

Author: ivaynberg
Date: Tue Nov  4 14:12:52 2008
New Revision: 711446

URL: http://svn.apache.org/viewvc?rev=711446&view=rev
Log:
WICKET-1619

Modified:
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java
    wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java?rev=711446&r1=711445&r2=711446&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigation.java Tue Nov  4 14:12:52 2008
@@ -29,13 +29,13 @@
  * contains a {@link Label} with the page number of that link (1..n).
  * 
  * <pre>
- *  
+ * 
  * 	&lt;td wicket:id=&quot;navigation&quot;&gt;
  * 		&lt;a wicket:id=&quot;pageLink&quot; href=&quot;SearchCDPage.html&quot;&gt;
  * 			&lt;span wicket:id=&quot;pageNumber&quot;&gt;1&lt;/span&gt;
  * 		&lt;/a&gt;
  * 	&lt;/td&gt;
- * 	
+ * 
  * </pre>
  * 
  * thus renders like:
@@ -96,6 +96,11 @@
  * <p>
  * Use setMargin() and setViewSize() to adjust the navigation's bar view size and margin.
  * <p>
+ * Enabled contract: The enabled contract (if the PagingNavigation is disabled so are all links
+ * inside) is enforced by links generated by
+ * {@link #newPagingNavigationLink(String, IPageable, int)}. If this method is overridden to return
+ * a custom {@link Link} implementation it is up to that link to enforce the contract.
+ * <p>
  * Please
  * 
  * @see PagingNavigator for a ready made component which already includes links to the first,
@@ -334,7 +339,17 @@
 	 */
 	protected Link newPagingNavigationLink(String id, IPageable pageable, int pageIndex)
 	{
-		return new PagingNavigationLink(id, pageable, pageIndex);
+		return new PagingNavigationLink(id, pageable, pageIndex)
+		{
+			private static final long serialVersionUID = 1L;
+
+			public boolean isEnabled()
+			{
+				return super.isEnabled() && PagingNavigation.this.isEnabled() &&
+					PagingNavigation.this.isEnableAllowed();
+			}
+		};
+
 	}
 
 	/**

Modified: wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java
URL: http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java?rev=711446&r1=711445&r2=711446&view=diff
==============================================================================
--- wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java (original)
+++ wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java Tue Nov  4 14:12:52 2008
@@ -24,6 +24,12 @@
  * to any PageableListView. A navigation which contains links to the first and last page, the
  * current page +- some increment and which supports paged navigation bars (@see
  * PageableListViewNavigationWithMargin).
+ * <p>
+ * Enabled contract: The enabled contract (if the PagingNavigator is disabled so are all links
+ * inside) is enforced by links generated by
+ * {@link #newPagingNavigationIncrementLink(String, IPageable, int)} and
+ * {@link #newPagingNavigationLink(String, IPageable, int)}. If these methods are overridden to
+ * return custom {@link Link} implementations it is up to that link to enforce the contract.
  * 
  * @author Juergen Donnerstag
  */
@@ -112,7 +118,16 @@
 	 */
 	protected Link newPagingNavigationIncrementLink(String id, IPageable pageable, int increment)
 	{
-		return new PagingNavigationIncrementLink(id, pageable, increment);
+		return new PagingNavigationIncrementLink(id, pageable, increment)
+		{
+			private static final long serialVersionUID = 1L;
+
+			public boolean isEnabled()
+			{
+				return super.isEnabled() && PagingNavigator.this.isEnabled() &&
+					PagingNavigator.this.isEnableAllowed();
+			}
+		};
 	}
 
 	/**
@@ -129,7 +144,16 @@
 	 */
 	protected Link newPagingNavigationLink(String id, IPageable pageable, int pageNumber)
 	{
-		return new PagingNavigationLink(id, pageable, pageNumber);
+		return new PagingNavigationLink(id, pageable, pageNumber)
+		{
+			private static final long serialVersionUID = 1L;
+
+			public boolean isEnabled()
+			{
+				return super.isEnabled() && PagingNavigator.this.isEnabled() &&
+					PagingNavigator.this.isEnableAllowed();
+			}
+		};
 	}
 
 	/**
@@ -144,7 +168,16 @@
 	protected PagingNavigation newNavigation(final IPageable pageable,
 		final IPagingLabelProvider labelProvider)
 	{
-		return new PagingNavigation("navigation", pageable, labelProvider);
+		return new PagingNavigation("navigation", pageable, labelProvider)
+		{
+			private static final long serialVersionUID = 1L;
+
+			public boolean isEnabled()
+			{
+				return super.isEnabled() && PagingNavigator.this.isEnabled() &&
+					PagingNavigator.this.isEnableAllowed();
+			}
+		};
 	}
 
 	/**