A lot of our pages are dynamically defined like you require. We make
extensive use of the component resolver interface to define our own
component resolvers.
We have even added a 'parameterization' feature which allows us to add a
variety of components that use the same definition but display different
data based on a parameter. The parameter is actually embedded into the
component id in a rather sly and, most likely, worst practice way... but
it works (except we do have problems when embedding dynamically defined
children in enclosures in recent releases - still using 1.4.2 for this
reason)
<span wicket:id="menuPanel?menuId=footerMenuA" />
<span wicket:id="menuPanel?menuId=footerMenuB" />
<span wicket:id="menuPanel?menuId=footerMenuC" />
Our resolver strips off everything from the first '?' and so sees
'menuPanel' as the component name and the treats the remainder as
parameters so that the same panel can be used with different data - all
defined by the markup writer, not the programmer.
Regards,
Chris Colman
Step Ahead Software
>-----Original Message-----
>From: Mikkel Lauritsen [mailto:[email protected]]
>Sent: Saturday, 8 May 2010 12:21 AM
>To: [email protected]
>Subject: Components with dynamically defined child components
>
>
>Hi all,
>
>I'm evaluating webapp frameworks in order to determine what to use
>when rewriting a large-ish application. Wicket is a serious con-
>testant, but there's one thing that I haven't been able to figure
>out how to do properly: how do I create components that have a
>dynamic list of child components, each child being an instance of
>any subclass of Component (or WebMarkupContainer)?
>
>Basically what I need is to obtain HTML like
>
><div>
> markup from first child
> markup from second child
> ...
></div>
>
>Based on the documentation of the RepeatingView class I have tried
>just adding the children to a RepeatingView with
><div wicket:id="children"></div> as markup, expecting that I would
>get each child rendered inside a div element, but that doesn't
>work - possibly because the markup doesn't contain elements that
>refer to the id's of the child components. It works fine with labels,
>but for example Buttons are not shown at all.
>
>My problem seems to be the same as discussed in
>http://www.mail-archive.com/[email protected]/msg18712.
html
>but I unfortunately haven't been able to get further from there.
>
>Any comments and suggestions that you may have are much appreciated.
>
>Best regards & thanks,
> Mikkel Lauritsen
>
>---------------------------------------------------------------------
>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]