You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Beyonder Unknown <be...@yahoo.com> on 2008/02/04 21:35:33 UTC

adding conditional component

Hi all,

How do you guys implement a link that is conditional? Like for example the link only shows if a given data is provided. Adding the <a>-tag in the Markup will coz an error if the condition is not met, because AjaxLink is not added.


Thanks!
Wen Tong
 
--
The only constant in life is change.




      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


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


Re: adding conditional component

Posted by Janos Cserep <cs...@metaprime.hu>.
>
> How do you guys implement a link that is conditional? Like for example the
> link only shows if a given data is provided. Adding the <a>-tag in the
> Markup will coz an error if the condition is not met, because AjaxLink is
> not added.
>
>
I usually handle such a situation by overriding the isVisible() method of
the component:

add(new Link("link") {

@Override
public boolean isVisible() {
    boolean externalCondition = ....;
    return super.isVisible() && externalCondition;
}

});