Hi Igor,
your patch is working great. As initialisation occurs in onBeforeRender()
now, I can even use getParent().getClass() without having an additional
pageClass constructor parameter.
So, please apply the patch :)
Thanks again for your time!
igor.vaynberg wrote:
>
> see if this patch helps, and if it works and doesnt break anything
> that you can see i will apply it...
>
> -igor
>
>
> Index:
> C:/dev/src/wicket/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java
> ===================================================================
> ---
> C:/dev/src/wicket/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java
> (revision
> 611946)
> +++
> C:/dev/src/wicket/jdk-1.4/wicket/src/main/java/org/apache/wicket/markup/html/navigation/paging/PagingNavigator.java
> (working
> copy)
> @@ -32,8 +32,11 @@
> 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,28 @@
> * 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;
> + }
>
> + protected void onBeforeRender()
> + {
> + if (!hasBeenRendered())
> + {
> + // Get the navigation bar and add it to the hierarchy
> + pagingNavigation = newNavigation(pageable,
> labelProvider);
> + add(pagingNavigation);
>
> - // 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));
> + // 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 +129,7 @@
> * @return the navigation object
> */
> protected PagingNavigation newNavigation(final IPageable pageable,
> - final IPagingLabelProvider labelProvider)
> + final IPagingLabelProvider labelProvider)
> {
> return new PagingNavigation("navigation", pageable,
> labelProvider);
> }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/PagingNavigator-refactoring-request-tp14783646p14839357.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]