Or with attribute: add(new Button("red_or_green")add(new AttributeModifier("class", new AbstractReadOnlyModel<String>() { getObject() { return condition ? "red" : "green"; }});
** Martin 2009/9/10 Pedro Santos <pedros...@gmail.com>: > With OO you can teach you objects to behave, rater the set then every time: > String property; > add(new Button("red"){ > @Override > public boolean isVisible() { > return property == red condition > } > }); > add(new Button("green"){ > @Override > public boolean isVisible() { > return property == green contition > } > }); > > On Thu, Sep 10, 2009 at 7:38 AM, Martin Makundi < > martin.maku...@koodaripalvelut.com> wrote: > >> > How is it possible to do this in Wicket ? Is there a wicket tag that we >> can >> > use for that ? >> >> If you want to hide a component just say component.setVisible(false); >> >> If you wnat to hide component and surrounding html markup, do the >> following: >> >> <wicket:enclosure child="this_component_will_determine_visibility"> >> >> <table><tr>td>Here you can have any arbitrary html</td> >> <td wicket:id="this_component_will_determine_visibility">Let's assume >> this is your component then</td> >> </tr> >> </table> >> >> </wicket:enclosure> >> >> In the above example you could hide the component with its surrounding >> markup using >> add(new >> Label("this_component_will_determine_visibility").setVisible(false)); >> >> Is this what you were looking for? >> >> > E.g. Depending of the value returned by a property, I would like to >> display >> > in a table a red button instead of a green >> >> Well.. CSS should be used for that and AttributeModifier. >> >> ** >> Martin >> >> > >> > Regards, >> > >> > Charles Moulliard >> > Senior Enterprise Architect >> > Apache Camel Committer >> > >> > ***************************** >> > blog : http://cmoulliard.blogspot.com >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org >> For additional commands, e-mail: users-h...@wicket.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org