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/04/18 04:19:32 UTC
svn commit: r649351 -
/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java
Author: ivaynberg
Date: Thu Apr 17 19:19:30 2008
New Revision: 649351
URL: http://svn.apache.org/viewvc?rev=649351&view=rev
Log:
WICKET-1548 PagingNavigator calls factory methods from constructor
Modified:
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/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=649351&r1=649350&r2=649351&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 Thu Apr 17 19:19:30 2008
@@ -32,7 +32,10 @@
private static final long serialVersionUID = 1L;
/** The navigation bar to be printed, e.g. 1 | 2 | 3 etc. */
- private final PagingNavigation pagingNavigation;
+ private PagingNavigation pagingNavigation;
+
+ private final IPageable pageable;
+ private final IPagingLabelProvider labelProvider;
/**
* Constructor.
@@ -58,20 +61,30 @@
* The label provider for the link text.
*/
public PagingNavigator(final String id, final IPageable pageable,
- final IPagingLabelProvider labelProvider)
+ final IPagingLabelProvider labelProvider)
{
super(id);
+ this.pageable = pageable;
+ this.labelProvider = labelProvider;
+
+ }
- // Get the navigation bar and add it to the hierarchy
- this.pagingNavigation = newNavigation(pageable, labelProvider);
- add(pagingNavigation);
-
- // Add additional page links
- add(newPagingNavigationLink("first", pageable, 0));
- add(newPagingNavigationIncrementLink("prev", pageable, -1));
- add(newPagingNavigationIncrementLink("next", pageable, 1));
- add(newPagingNavigationLink("last", pageable, -1));
+ protected void onBeforeRender()
+ {
+ if (get("first") == null)
+ {
+ // Get the navigation bar and add it to the hierarchy
+ pagingNavigation = newNavigation(pageable, labelProvider);
+ add(pagingNavigation);
+
+ // Add additional page links
+ add(newPagingNavigationLink("first", pageable, 0));
+ add(newPagingNavigationIncrementLink("prev", pageable, -1));
+ add(newPagingNavigationIncrementLink("next", pageable, 1));
+ add(newPagingNavigationLink("last", pageable, -1));
+ }
+ super.onBeforeRender();
}
/**
@@ -118,7 +131,7 @@
* @return the navigation object
*/
protected PagingNavigation newNavigation(final IPageable pageable,
- final IPagingLabelProvider labelProvider)
+ final IPagingLabelProvider labelProvider)
{
return new PagingNavigation("navigation", pageable, labelProvider);
}