-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have this struct
private class Permessi
{
String Nome_videata;
String Descrizione;
Map<String, Boolean> Lista_tab;
}
Lista_tab have variable length like this example:
Videata1, Videata1Description, TAB1, TRUE, TAB2, FALSE
Videata2, Videata2Description, TAB1, FALSE
How can I display this struct in listbox object?
thanks
Hello lramellavotta,
I would use a rowRenderer in order to retrieve the data and construct the listbox as i desire.
Please refer to the following example:
http://www.zkoss.org/zkdemo/grid/dynamic_renderer
Best Regards,
Darksu
Hi, I have a little problem to display the data...
@Wire("#lbPermessi")
Listbox lbPermessi;
My zul
<tabbox id="Tabbox">
<tabs id="Tabs">
<tab id="elenco" label="Elenco" onSelect="@command('tbElencoSel')" />
<tab id="dettaglio" label="Dettaglio" onSelect="@command('tbDettaglioSel')" />
<tab id="eventi" label="Eventi" onSelect="@command('tbEventiSel')" />
<tab id="log" label="Log" onSelect="@command('tbLogSel')" />
<tab id="permessi" label="Permessi" onSelect="@command('tbPermessiSel')" />
<tabpanel id="tbPermessi">
<listbox id="lbPermessi" mold="paging" sizedByContent="true" height="500px"
span="true" autopaging="true"
visible="@load(not empty vm.selected)">
<listhead>
<listheader label="Videata" width="80px"/>
<listheader label="Descrizione" width="140px"/>
</listhead>
</listbox>
</tabpanel>
My java code
public class PermessiVideo
{
String Nome_videata;
String Descrizione;
Map<String, Map<String, Boolean>> Tabs = new LinkedHashMap<String, Map<String, Boolean>>();
}
List<PermessiVideo> lstPermessiVideo;
This struct to deploy the permission of any Form and his tab.
@Command
public void tbPermessiSel()
{
BindUtils.postNotifyChange(null,null,Adm_utenti.this,"lstPermessiVideo");
}
public void doHeader()
{ Listhead lh = lbPermessi.getListhead(); for(int i=0;i<nummaxtabs;i++) {="" lh.appendchild(new="" listheader("tab",null,"80px"));="" lh.appendchild(new="" listheader("p",null,"30px"));="" }<="" p="">
lbPermessi.setModel(new ListModelList<PermessiVideo>(lstPermessiVideo));
lbPermessi.setItemRenderer(new myRender());
}
private class myRender implements ListitemRenderer<PermessiVideo>
{
@Override
public void render(Listitem item, PermessiVideo pv, int index) throws Exception
{
System.out.print(pv.Nome_videata+"("+pv.Descrizione+") ->");
new Listcell(pv.Nome_videata).setParent(item);
new Listcell(pv.Descrizione).setParent(item);
for(Entry<String, Map<String, Boolean>> entry : pv.Tabs.entrySet())
{
Map<String, Boolean> Tabs = entry.getValue();
for(Entry<String, Boolean> lstTab : Tabs.entrySet())
{
new Listcell(lstTab.getKey().toString());
new Listcell(lstTab.getValue().toString());
System.out.print(lstTab.getKey().toString()+" "+lstTab.getValue().toString()+" | ");
}
}
System.out.println("");
}
The System.out is corrected but the zul not load the tabs....
Any idea?
Luca
Solved.... The zul expects a boolean (I hope...)
This code solved the problem:
@Override
public void render(Listitem item, PermessiVideo pv, int index) throws Exception
{
System.out.print(pv.Nome_videata+"("+pv.Descrizione+") ->");
new Listcell(pv.Nome_videata).setParent(item);
new Listcell(pv.Descrizione).setParent(item);
for(Entry<String, Map<String, Boolean>> entry : pv.Tabs.entrySet())
{
Map<String, Boolean> Tabs = entry.getValue();
for(Entry<String, Boolean> lstTab : Tabs.entrySet())
{
//
// Descrizione TAB
//
Listcell cellTab = new Listcell();
cellTab.appendChild(new Label(lstTab.getKey().toString()));
item.appendChild(cellTab);
//
// Permesso TAB
//
Checkbox ckb = new Checkbox();
cellTab = new Listcell();
ckb.setValue(lstTab.getValue().toString());
cellTab.appendChild(ckb);
item.appendChild(cellTab);
System.out.print(lstTab.getKey().toString()+" "+lstTab.getValue().toString()+" | ");
}
}
System.out.println("");
}
Asked: 2015-09-29 18:55:55 +0800
Seen: 50 times
Last updated: Oct 18 '15
Listcell: load style color on @bind record
wrong valueException come in front of modal popup [closed]
Use parameters in a conditional @command
Problems with multiple press and onCtrlKey
MVVM @save on the fly [closed]
Unable to activate destroyed desktop
org.zkoss.zk.ui.UiException: java.lang.ClassNotFoundException
How to put a image or Letter over image on a specific XY Coordinate