On Tue, Sep 24, 2013 at 4:37 PM, brasmouk <brasm...@yahoo.fr> wrote:

> I want to do something like that :
>
>
> //-- JAVA
>
> ArrayList<IHMElement> elements = getIHMElements(screenID); // from the
> database
>
> add(new ListView("listview", userList) {
>     protected void populateItem(ListItem item) {
>
>                 for (IHMElement ihmElement : elements) {
>                         switch (ihmElement.getIHMType)
>                         {
>                         case CstElement.INPUT: item.add(new TextField(""))
> break;
>                         case CstElement.LABEL: item.add(new Label(""))
> break;
>                         ...
>
>                         }
>     }
> });
>
>
> //-- HTML
>
> <div wicket:id="listview">
>    ?????
> </div>
>

You can use Fragment component. See
http://wicketguide.comsysto.com/guide/chapter5.html#chapter5_5

                        case CstElement.INPUT:
Fragment f = new Fragment("sameId", "textField", this)
f.add(new TextField("field", ...);
item.add(f)
break;
                        case CstElement.LABEL:
Fragment f = new Fragment("sameId", "label", this)
f.add(new Label("label", ...));
item.add(f);
break;

<div wicket:id="listview">
   <wicket:container wicket:id="sameId"/>
</div>


<wicket:fragment wicket:id="textField">
  <input wicket:id="field"/>
</wicket:fragment>

<wicket:fragment wicket:id="label">
  <span wicket:id="label"></span>

</wicket:fragment>


>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Dynamic-generation-of-IHM-components-tp4661471p4661476.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to