You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by mehdi b <me...@yahoo.com> on 2008/02/08 14:31:27 UTC
Adding Panel(s) at Runtime (dynamically)
Hi all,
I want to add some panels to my web page and the number of panels is unknown. I want a <div wicket:id="cont"></div> in my template page and add needed panels to this div (the number of panels is determined at run time).
Besides, I want a surrounding <div class="a"></div> for each dynamic panel on adding it to the page.
Thanks
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
Re: Adding Panel(s) at Runtime (dynamically)
Posted by Ayodeji Aladejebi <al...@gmail.com>.
//HTML
<div wicket:id="panelListView">
<div wicket:id="runtimePanelItem"></div>
</div>
your ListView model which is expected to be a List, determines the number of
Panels to be dynamically created
//Java
ListView panelListView= new ListView("panelListView", model){
public void populateItem(ListItem item){
SomeModelObject object = item.getModelObject();
if(bla bla bla)
item.add(new MyRuntimePanel("runtimePanelItem"));
else
item.add(new MyOtherRuntimePanel("runtimePanelItem");
}
}
infact you can insert some logic inside the ListView to determine which
specific panel to add dynamically.
On 2/8/08, Edvin Syse <ed...@sysedata.no> wrote:
>
> Hi,
>
> Use a ListView or some other Repeater-component and implement a model
> that returns a list of the classes that should be created as panels. If
> you need a wicket:id on the surrounding div, that's fine, but not
> needed. You would then do
>
> WebMarkupContainer cont = new WebMarkupContainer("cont");
>
> Then you add the ListView to cont component istead of the page.
>
> Also, you would use the div with class a as the "base" for each listItem:
>
> <div class="a" wicket:id="conts">Panels here</div>
>
> -- Edvin
>
> mehdi b skrev:
> > Hi all,
> >
> > I want to add some panels to my web page and the number of panels is
> unknown. I want a <div wicket:id="cont"></div> in my template page and add
> needed panels to this div (the number of panels is determined at run time).
> > Besides, I want a surrounding <div class="a"></div> for each dynamic
> panel on adding it to the page.
> >
> > Thanks
> >
> >
> > ---------------------------------
> > Looking for last minute shopping deals? Find them fast with Yahoo!
> Search.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Adding Panel(s) at Runtime (dynamically)
Posted by Edvin Syse <ed...@sysedata.no>.
Hi,
Use a ListView or some other Repeater-component and implement a model
that returns a list of the classes that should be created as panels. If
you need a wicket:id on the surrounding div, that's fine, but not
needed. You would then do
WebMarkupContainer cont = new WebMarkupContainer("cont");
Then you add the ListView to cont component istead of the page.
Also, you would use the div with class a as the "base" for each listItem:
<div class="a" wicket:id="conts">Panels here</div>
-- Edvin
mehdi b skrev:
> Hi all,
>
> I want to add some panels to my web page and the number of panels is unknown. I want a <div wicket:id="cont"></div> in my template page and add needed panels to this div (the number of panels is determined at run time).
> Besides, I want a surrounding <div class="a"></div> for each dynamic panel on adding it to the page.
>
> Thanks
>
>
> ---------------------------------
> Looking for last minute shopping deals? Find them fast with Yahoo! Search.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org