I believe that instead of
webmarkupcontainer container=new ...
you meant
webmarkupcontainer item=new ...
- Scott
On 10/27/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> direct children of a repeater inherit the markup, so you can do
> something like this:
>
> <a wicket:id="repeater"><span wicket:id="label"/></a>
>
> repeatingview repeater=new repeatingview("repeater");
> for (int i=0;i<10;i++) {
> Link link=new Link(repeater.newchildid()) { };
> repeater.add(link);
> link.add(new label("label", ""+i));
> }
>
> this works fine when a repeater only contains one direct child per
> iteration - the link we added does not have "siblings"
>
> but now lets say inside repeater you want two siblings
>
> <div wicket:id="repeater"><span wicket:id="label"/><input
> wicket:id="textfield" type="text"/></div>
>
> so each item has two siblings - a label and a textfield. so what do we
> add to a repeater? it has to be something that can be attached to a
> div tag, has no behavior, yet can contain any number of components -
> best thing that fits is a WebMarkupContainer.
>
> so our code is like this:
>
> repeatingview repeater=new repeatingview("repeater");
> for (int i=0;i<10;i++) {
> webmarkupcontainer container=new webmarkupcontainer(repeater.newchildid());
> repeater.add(item);
> item.add(new label("label", "text field "+i));
> item.add(new textfield("textfield"));
> }
>
> hope this helps...
>
> -igor
>
>
> On 10/27/07, skatz <[EMAIL PROTECTED]> wrote:
> >
> > Hi,
> >
> > Could someone give me some insight into the use of WebMarkupContainers with
> > repeaters. In particular, I was wondering how come there does not need to
> > be markup that has the id of the interposed WebMarkupContainer? (Also, a
> > pointer to the code, if it exists, where repeaters do special handing of
> > their direct children.)
> >
> > Here is a code snippet from the examples:
> >
> > ...
> >
> > RepeatingView repeating = new RepeatingView("repeating");
> > add(repeating);
> >
> > int index = 0;
> > while (contacts.hasNext())
> > {
> > WebMarkupContainer item = new
> > WebMarkupContainer(repeating.newChildId());
> > repeating.add(item);
> > Contact contact = (Contact)contacts.next();
> >
> > item.add(new ActionPanel("actions", new
> > DetachableContactModel(contact)));
> > item.add(new Label("contactid",
> > String.valueOf(contact.getId())));
> > item.add(new Label("firstname", contact.getFirstName()));
> > item.add(new Label("lastname", contact.getLastName()));
> > item.add(new Label("homephone", contact.getHomePhone()));
> > item.add(new Label("cellphone", contact.getCellPhone()));
> > ...
> >
> > How come the markup parser doesn't get upset that there is no component with
> > the wicket:id=repeating.newChildId()?
> >
> >
> >
> > --
> > View this message in context:
> > http://www.nabble.com/Repeaters%27-use-of-WebMarkupContainer-question-tf4704749.html#a13448018
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > 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]
>
>
--
Scott Swank
reformed mathematician
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]