You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martijn Dashorst <ma...@gmail.com> on 2006/10/25 16:37:27 UTC

Nice stupid thing... page.setVisible(false)

What should this do?

public class MyPage extends WebPage {
    public MyPage() {
        setVisible(false);
    }
}

...
add(new BookmarkablePageLink("link", MyPage.class));
..

when someone currently clicks the link, we get a null pointer exception.

So... Setting visible to false on a Page is a stupid thing. However
since this is possilbe, we would need to get the semantics straight
for this non-usecase.

Options are:
 - keep the nullpointer exception
 - throw a WicketRuntimeException
 - render an empty markup stream (nothing)
 - render a special 'vacancy' page
 - redirect to access denied page

I'm inclined to throwing a WicketRuntimeException as that is the most clear.

Martijn

-- 
<a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
the World!</a>

Re: Nice stupid thing... page.setVisible(false)

Posted by Johan Compagner <jc...@gmail.com>.
yes just render nothing. Easy fix then...

    else
        {
            markupStream.skipComponent();
        }

    else if(markupStream != null)
        {
            markupStream.skipComponent();
        }

On 10/25/06, Eelco Hillenius <ee...@gmail.com> wrote:
>
> I'd say
>
> - render an empty markup stream (nothing)
>
> is this is consistent with how render == false for component works
>
> Eelco
>
>
> On 10/25/06, Martijn Dashorst <ma...@gmail.com> wrote:
> > What should this do?
> >
> > public class MyPage extends WebPage {
> >     public MyPage() {
> >         setVisible(false);
> >     }
> > }
> >
> > ...
> > add(new BookmarkablePageLink("link", MyPage.class));
> > ..
> >
> > when someone currently clicks the link, we get a null pointer exception.
> >
> > So... Setting visible to false on a Page is a stupid thing. However
> > since this is possilbe, we would need to get the semantics straight
> > for this non-usecase.
> >
> > Options are:
> >  - keep the nullpointer exception
> >  - throw a WicketRuntimeException
> >  - render an empty markup stream (nothing)
> >  - render a special 'vacancy' page
> >  - redirect to access denied page
> >
> > I'm inclined to throwing a WicketRuntimeException as that is the most
> clear.
> >
> > Martijn
> >
> > --
> > <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> > for <a href="http://www.thebeststuffintheworld.com/stuff/wicket
> ">Wicket</a>
> > at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> > the World!</a>
> >
>

Re: Nice stupid thing... page.setVisible(false)

Posted by Eelco Hillenius <ee...@gmail.com>.
I'd say

- render an empty markup stream (nothing)

is this is consistent with how render == false for component works

Eelco


On 10/25/06, Martijn Dashorst <ma...@gmail.com> wrote:
> What should this do?
>
> public class MyPage extends WebPage {
>     public MyPage() {
>         setVisible(false);
>     }
> }
>
> ...
> add(new BookmarkablePageLink("link", MyPage.class));
> ..
>
> when someone currently clicks the link, we get a null pointer exception.
>
> So... Setting visible to false on a Page is a stupid thing. However
> since this is possilbe, we would need to get the semantics straight
> for this non-usecase.
>
> Options are:
>  - keep the nullpointer exception
>  - throw a WicketRuntimeException
>  - render an empty markup stream (nothing)
>  - render a special 'vacancy' page
>  - redirect to access denied page
>
> I'm inclined to throwing a WicketRuntimeException as that is the most clear.
>
> Martijn
>
> --
> <a href="http://www.thebeststuffintheworld.com/vote_for/wicket">Vote</a>
> for <a href="http://www.thebeststuffintheworld.com/stuff/wicket">Wicket</a>
> at the <a href="http://www.thebeststuffintheworld.com/">Best Stuff in
> the World!</a>
>