-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi, I'd like to use MVVM java code to create tabs with include src. This is a sample:
<tabbox width="100%" id="tabbox">
<tabs id="tabs">
</tabs>
<tabpanels>
<tabpanel>
<include src="adm_utenti.zul">
</tabbox>
I'd like to runtime create the tabpanel component with include. I tried bu i cannot find solution to indicate the include component.
Best regards. Luca
Find solution... Maybe I should thought about it a little harder...
<menuitem id="menu_01" label="Gestione Utenti" onClick="@command('cmdMenu', pProgr='adm_utenti')"/>
<menuitem id="menu_14" label="Gestione Centralini" onClick="@command('cmdMenu', pProgr='adm_centralini')"/>
...
<center id="blcCenter">
<tabbox width="100%" id="tabbox">
<tabs id="tabs" />
<tabpanels id="tabpanels" />
</tabbox>
</center>
Java code
@Wire("tabs")
Tabs tabs;
@Wire("tabbox")
Tabbox tabbox;
@Wire("tabpanels")
Tabpanels tabpanels;
@Wire("tabpanel")
Tabpanel tabpanel;
...
@Command
public void cmdMenu(@BindingParam("pProgr") String pProgr)
{
Boolean tabPresente=false;
Iterator<Component> it;
Tab chkTab;
for (it = tabs.getChildren().iterator(); it.hasNext();)
{
chkTab = (Tab) it.next();
if(chkTab.getId().equalsIgnoreCase(pProgr))
{
chkTab.setSelected(true);
tabPresente=true;
}
}
if(!tabPresente)
{
Tab newTab = new Tab();
newTab.setParent(tabs);
newTab.setLabel(pProgr);
newTab.setClosable(true);
newTab.setId(pProgr);
Tabpanel newTabpanel = new Tabpanel();
newTabpanel.setParent(tabpanels);
Include inc = new Include();
inc.setSrc(pProgr+".zul");
inc.setParent(newTabpanel);
}
}
Asked: 2016-12-16 22:08:08 +0800
Seen: 41 times
Last updated: Dec 17 '16