AjaxPagingNavigator and IndicatingAjaxLink

View: New views
4 Messages — Rating Filter:   Alert me  

AjaxPagingNavigator and IndicatingAjaxLink

by Reinout van Schouwen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I tried extending the AjaxPagingNavigator class to provide some feedback
while loading the next page using IndicatingAjaxLink. The
(not-compiling) code I wrote is below. I couldn't make it work because
the protected methods in AjaxPagingNavigator return a Link, as AjaxLink
is a sibling of Link instead of a subclass.

Why doesn't the AjaxPagingNavigator use an AjaxLink in the first place?

Suggestions welcome.


/* this doesn't work because IndicatingAjaxLink is not a subclass of Link
     class IndicatingAjaxPagingNavigator extends AjaxPagingNavigator {

        public IndicatingAjaxPagingNavigator(String id, IPageable pageable) {
            super(id, pageable);
        }
       
        @Override
        protected Link newPagingNavigationLink(String id, IPageable pageable, int pageNumber) {
            final Link result = super.newPagingNavigationIncrementLink(id, pageable, pageNumber);
           
            return new IndicatingAjaxLink(id) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    result.onClick();
                }
            };
        }
    }
*/

regards,

--
Reinout van Schouwen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: AjaxPagingNavigator and IndicatingAjaxLink

by Michael Sparer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

why not just let your IndicatingPagingNavigator implement IAjaxIndicatorAware - then you got your feedback and also have it at one place (only one indicator) instead of multiple indicators as each ajaxlink would have its own ...

e.g.
public class IndicatingAjaxPagingNavigator extends AjaxPagingNavigator implements IAjaxIndicatorAware {
    private final WicketAjaxIndicatorAppender _indicatorAppender = new WicketAjaxIndicatorAppender();

    public IndicatingAjaxPagingNavigator(String id, /* snip */) {
       super(id, /* snip */);
       add(_indicatorAppender);
       // snip
    }

    public String getAjaxIndicatorMarkupId() {
                return _indicatorAppender.getMarkupId();
        }
}

regards,
Michael
Reinout van Schouwen-4 wrote:
Hi all,

I tried extending the AjaxPagingNavigator class to provide some feedback
while loading the next page using IndicatingAjaxLink. The
(not-compiling) code I wrote is below. I couldn't make it work because
the protected methods in AjaxPagingNavigator return a Link, as AjaxLink
is a sibling of Link instead of a subclass.

Why doesn't the AjaxPagingNavigator use an AjaxLink in the first place?

Suggestions welcome.


/* this doesn't work because IndicatingAjaxLink is not a subclass of Link
     class IndicatingAjaxPagingNavigator extends AjaxPagingNavigator {

        public IndicatingAjaxPagingNavigator(String id, IPageable pageable) {
            super(id, pageable);
        }
       
        @Override
        protected Link newPagingNavigationLink(String id, IPageable pageable, int pageNumber) {
            final Link result = super.newPagingNavigationIncrementLink(id, pageable, pageNumber);
           
            return new IndicatingAjaxLink(id) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    result.onClick();
                }
            };
        }
    }
*/

regards,

--
Reinout van Schouwen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

Re: AjaxPagingNavigator and IndicatingAjaxLink

by Reinout van Schouwen-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Op woensdag 08-10-2008 om 02:56 uur [tijdzone -0700], schreef Michael
Sparer:
> why not just let your IndicatingPagingNavigator implement IAjaxIndicatorAware
> - then you got your feedback and also have it at one place (only one
> indicator) instead of multiple indicators as each ajaxlink would have its
> own ...

Thanks, that worked. However I'm now trying to figure out how to make
the indicator be displayed next to the navigator, instead of below. In
other words, how to make the indicator's <span> tag appear inside of the
div instead of outside it.

regards,

--
Reinout van Schouwen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: AjaxPagingNavigator and IndicatingAjaxLink

by Michael Sparer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

alright, but that's more CSS fiddling than wicket related
have fun tweaking your styles ;-)

regards,
Michael
Reinout van Schouwen-4 wrote:
Op woensdag 08-10-2008 om 02:56 uur [tijdzone -0700], schreef Michael
Sparer:
> why not just let your IndicatingPagingNavigator implement IAjaxIndicatorAware
> - then you got your feedback and also have it at one place (only one
> indicator) instead of multiple indicators as each ajaxlink would have its
> own ...

Thanks, that worked. However I'm now trying to figure out how to make
the indicator be displayed next to the navigator, instead of below. In
other words, how to make the indicator's  tag appear inside of the
div instead of outside it.

regards,

--
Reinout van Schouwen



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
LightInTheBox - Buy quality products at wholesale price!