You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by skatz <sk...@enpocket.com> on 2007/10/28 00:13:53 UTC
Repeaters' use of WebMarkupContainer question
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Repeaters' use of WebMarkupContainer question
Posted by Igor Vaynberg <ig...@gmail.com>.
correct
-igor
On 10/29/07, Scott Swank <sc...@gmail.com> wrote:
> I believe that instead of
>
> webmarkupcontainer container=new ...
>
> you meant
>
> webmarkupcontainer item=new ...
>
> - Scott
>
> On 10/27/07, Igor Vaynberg <ig...@gmail.com> 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 <sk...@enpocket.com> 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: users-unsubscribe@wicket.apache.org
> > > For additional commands, e-mail: users-help@wicket.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
> --
> Scott Swank
> reformed mathematician
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Repeaters' use of WebMarkupContainer question
Posted by Scott Swank <sc...@gmail.com>.
I believe that instead of
webmarkupcontainer container=new ...
you meant
webmarkupcontainer item=new ...
- Scott
On 10/27/07, Igor Vaynberg <ig...@gmail.com> 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 <sk...@enpocket.com> 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: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Scott Swank
reformed mathematician
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Repeaters' use of WebMarkupContainer question
Posted by Igor Vaynberg <ig...@gmail.com>.
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 <sk...@enpocket.com> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org