You can also make the components to hide implement some listener (or
just marker) interface X and then do a visitChildren traversal from
page.onBeforeRender as follows:
visitChildren(X.class, new IVisitor() {
public Object component(Component component) {
comp.setVisible(your visibility logic here);
}
});
This is less centralized that keeping a list at the top level, if you
care about this.
Regards,
Carlos
On 9/7/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> Martijn,
>
> That certainly accomplishes what I want. Thank you. It was pushing
> the logic to onBeforeRender() that I was missing.
>
> On 9/7/07, Martijn Dashorst <[EMAIL PROTECTED]> wrote:
> > What you want is a bag of components that are separate from the
> > component hierarchy, afaiui?
> >
> > Why not keep a list of components that need to be made invisible, and
> > add them to that list. call setvisible(false) on that list of
> > components in onbeforerender. Remove them from that list when you want
> > them visible again...
> >
> > public class MyPage {
> > List<Component> hidden = new ArrayList<Component>();
> >
> > public onBeforeRender() {
> > for(Component comp : hidden) comp.setVisible(true);
> >
> > .... some arcane logic to mark them components...
> > hidden.add(some component);
> > ....
> > for(Component comp : hidden) comp.setVisible(false);
> >
> > }
> >
> > Martijn
> >
> > On 9/7/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > > I get what you're saying, but the images in question are scattered
> > > across the page rather than in one place that could simply be
> > > enclosed. Thank you none the less, I do appreciate the insight.
> > >
> > > Cheers,
> > > Scott
> > >
> > >
> > > On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > well, thats kinda the point of the enclosure...
> > > >
> > > > it lets you group components together inside it, and let one of those
> > > > components drive the visibility of the entire enclosure
> > > >
> > > > -igor
> > > >
> > > >
> > > > On 9/7/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > I could, but it's kind of the opposite of what I want. I want to
> > > > > _not_ have to add an enclosing tag to the relevant portions of the
> > > > > html template. So I don't mind coding a WebMarkupContainer -- I just
> > > > > want to avoid having to change:
> > > > >
> > > > > <span wicket:id="foo"></span>
> > > > >
> > > > > to
> > > > >
> > > > > <div wicket:id="fooContainer"><span wicket:id="foo"></span></div>
> > > > >
> > > > > The basic problem is that sometimes we have a set of images for a
> > > > > product (scattered across a few components) and sometimes we don't.
> > > > > My thought is to wrap all of the relevant images in such a container
> > > > > that knows how to determine isVisible().
> > > > >
> > > > > Scott
> > > > >
> > > > > On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > > you can prob port enclosure to 1.2.6 yourself if you wanted it badly
> > > > > >
> > > > > > -igor
> > > > > >
> > > > > >
> > > > > > On 9/7/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > > > > > >
> > > > > > > Pity we're not on 1.3 yet. Thank you though.
> > > > > > >
> > > > > > > Scott
> > > > > > >
> > > > > > > On 9/7/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> > > > > > > > no, but you can try wicket:enclosure tag. see javadoc on
> > > > > Enclosure.java
> > > > > > > >
> > > > > > > > -igor
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > On 9/7/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > > > > > > > >
> > > > > > > > > I want to make a few parts of my page visible or not in a
> > > > > consistent
> > > > > > > > > manner -- i.e. based on the same true/false result, which I
> > > > > > > > > derive
> > > > > > > > > from my model. Can I wrap the relevant components in
> > > > > > > > > WebMarkupContainer without adding a matching <div> tag to my
> > > > > markup?
> > > > > > > > >
> > > > > > > > > Thank you,
> > > > > > > > > Scott
> > > > > > >
> > > > > > > ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Scott Swank
> > > > > reformed mathematician
> > > > >
> > > > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > For additional commands, e-mail: [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > >
> > >
> > > --
> > > Scott Swank
> > > reformed mathematician
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> >
> >
> > --
> > Buy Wicket in Action: http://manning.com/dashorst
> > Apache Wicket 1.3.0-beta3 is released
> > Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]