0

How set include src in tabpanel using MVVM

asked 2016-12-16 22:08:08 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

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

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-12-17 08:57:30 +0800

lramellavotta gravatar image lramellavotta flag of Italy
200 1 8

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);

    }
}
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
2 followers

RSS

Stats

Asked: 2016-12-16 22:08:08 +0800

Seen: 37 times

Last updated: Dec 17 '16

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More