Because the stream must advance to the next position. So that the markup stream pointer is set to the right position for the next one.
If you don't want a component to render just call setVisible(false) on it.
On 9/12/05, Scott Sauyet <[EMAIL PROTECTED]> wrote:
Thanks. The empty WebComponent did fine for the moment, although I
think I like the other solution better for long-term.
I'm still curious to know what needs to be done in onRender() to make a
component viable, but that's not top priority right now.
-- scott
Simon Berriman wrote:
> I've done this... - both to them, actually! I constructed my own PagingNavigator, like this:
>
> public class EBSPagingNavigator extends PagingNavigator
> {
> public EBSPagingNavigator(String id, IPageable pageable)
> {
> this(id, pageable, null);
> }
>
> public EBSPagingNavigator(String id, IPageable pageable, IPagingLabelProvider labelProvider)
> {
> super(id, pageable, labelProvider);
> if (pageable.getPageCount() < 2) setVisible(false);
> }
> }
>
> which makes itself invisible if there are less than two pages. This is backed up by a call to setRenderBodyOnly(true) in the instanciating code, and is placed in a <span> in the markup.
>
> w.r.t. the onRender(), yes it does do a lot more than just return; if you ever do find a need for an empty component, just do: add(new WebComponent("thingy"));
>
> You can also use WebMarkupContainer, which you can add() other things to; I acutally have the PagingNavigator in a colspan'ed table cell, and a WebMarkupContainer on the <tfoot> tag, so that the above code gets used thus:
>
> WebMarkupContainer dataFootSect = new WebMarkupContainer("dataFootSect");
>
> ... // 'aplv' gets defined as a subclass of PageableListView
>
> Component dataPanelNav = new EBSPagingNavigator("dataNav", aplv);
> dataPanelNav.setRenderBodyOnly(true);
> if ( !dataPanelNav.isVisible()) dataFootSect.setVisible(false);
>
> so dataFootSect does nothing other than give me the ability to make the whole <tfoot> section invisible.
>
> hth,
> -S.
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Scott Sauyet
> Sent: 12 September 2005 13:51
> To: [email protected]
> Subject: [Wicket-user] Minimal contract for onRender()
>
> I guess there are really two questions here.
>
> First, I wanted to create an empty component (more about why below) and
> did what I thought was reasonable:
>
> add(new Component("navigator") {
> public void onRender() {}
> });
>
> but I get a wicket.markup.MarkupException:
>
> Markup element at index 33 failed to advance the markup stream
>
> So obviously I need to do more inside onRender than simply return. What
> do I need to do? The Javadocs don't say. I would like to know this
> even if there is an answer to my second question below that obviates the
> need in this particular case: I'm trying to learn at least a little
> about how Wicket works.
>
> Second, is there a simple way to hide the PagingNavigator when there is
> only one page of results? Most often for my application, there will be
> only a single page, but there is no real limit to the number of possible
> entries, so I do want it paged. I was hoping to hide the Navigator
> unless it was required. That was why I wanted an empty component. I
> tried to do this:
>
> if (myList.size () > getItemsPerPage()) {
> add(new PagingNavigator("navigator", listView));
> } else {
> add(new Component("navigator") {
> public void onRender() {}
> });
> }
>
> and that is where I ran into the problem above. Is there a simpler way
> to do this?
>
> Thanks,
>
> -- Scott Sauyet
>
>
>
> <!-- -------------------------------------------------------
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Come visit us at:
>
> Content Management Europe Exhibition. 29th November - 1st December 2005, Olympia Grand Hall, London. Stand # 341
>
> GOSS - Ranked 4th in the Deloitte Technology Fast 50 Awards 2004 and 88th in the Deloitte Technology Fast 500 EMEA.
>
> This email contains proprietary information, some or all of which may be legally privileged. It is for the intended recipient only. If an addressing or transmission error has misdirected this email, please notify the author by replying to this email. If you are not the intended recipient you may not use, disclose, distribute, copy, print or rely on this email.
>
>
>
> Email transmission cannot be guaranteed to be secure or error free, as information may be intercepted, corrupted, lost, destroyed, arrive late or incomplete or contain viruses. This email and any files attached to it have been checked with virus detection software before transmission. You should nonetheless carry out your own virus check before opening any attachment. GOSS Interactive Ltd accepts no liability for any loss or damage that may be caused by software viruses.
>
>
>
>
> -------------------------------------------------------
> SF.Net email is Sponsored by the Better Software Conference & EXPO
> September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
> Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
> Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>
>
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user
