-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Hello, I have a window that contains components listbox, In listbox used for data input. Once completed, the data input and i going to do that on the reset the listbox
but when i click reset button The process has required a long time in about three seconds
How did to faster so that at the time of resetting listbox not long ?
this my code
zul file
<zk><window id="win" width="1200px" border="normal" apply="${Controller},render.InvoiceRenderer" >
<listbox id="listboxDetailEntry" sizedByContent="true" rows="200"
mold="paging" pageSize="10000" height="350px" nonselectableTags=""/></window></zk>
Controller file
@org.springframework.stereotype.Component("Controller")
@Scope("prototype")
public class InvoiceController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
invRenderer=new InvoiceRenderer();
invRenderer.doAfterCompose(comp);
setListDetailEntry(new ArrayList<Tmp1>());
ListModelList listModel = new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(pjRenderer);
listboxDetailEntry.setMultiple(true);
listModel.setSelection(listModel);
}
//for empty value
public void setEmptyRow(){
for(int i=0;i<75;i++){
Tmp1 tmp=new Tmp1();
tmp.setField1(null);
tmp.setField2(null);
getListDetailEntry().add(tmp);
}
//reset listbox with empty value
public void onClick$btnReset(){
setListDetailEntry(new ArrayList<ReportTmp1>());
setEmptyRow();
ListModelList listModel=new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(pjRenderer);
listboxDetailEntry.setMultiple(true);
listboxDetailEntry.renderAll();
listboxDetailEntry.setSelectedIndex(0);
}
class Renderer
public class InvoiceRenderer extends GenericForwardComposer implements Serializable,ListitemRenderer<Tmp1>{
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void render(final Listitem listitem, Tmp1 tmp1, int index)throws Exception {
Tmp1 tmp= tmp1;
final Listcell codeCell = new Listcell();
final Textbox txtCode= new Textbox();
codeCell.appendChild(txtCode);
final Listcell qtyCell = new Listcell();
final Intbox intQty = new Intbox();
qtryCell.appendChild(intQt);
.
.
//about 25cell
listitem.appendChild(codeCell);
listitem.appendChild(qtyCell);
listitem.setSelected(true);
listitem.setValue(tmp);
}
thanks
2 | No.2 Revision |
Hello, I have a window that contains components listbox, In listbox used for data input. Once completed, the data input and i going to do that on the reset the listbox
but when i click reset button The process has required a long time in about three seconds
How did to faster so that at the time of resetting listbox not long ?
this my code
zul file
<zk><window id="win" width="1200px" border="normal" apply="${Controller},render.InvoiceRenderer" >
<listbox id="listboxDetailEntry" sizedByContent="true" rows="200"
mold="paging" pageSize="10000" height="350px" nonselectableTags=""/></window></zk>
Controller file
@org.springframework.stereotype.Component("Controller")
@Scope("prototype")
public class InvoiceController extends GenericForwardComposer {
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
invRenderer=new InvoiceRenderer();
invRenderer.doAfterCompose(comp);
setListDetailEntry(new ArrayList<Tmp1>());
ListModelList listModel = new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(pjRenderer);
listboxDetailEntry.setItemRenderer(invRenderer);
listboxDetailEntry.setMultiple(true);
listModel.setSelection(listModel);
}
//for empty value
public void setEmptyRow(){
for(int i=0;i<75;i++){
Tmp1 tmp=new Tmp1();
tmp.setField1(null);
tmp.setField2(null);
getListDetailEntry().add(tmp);
}
//reset listbox with empty value
public void onClick$btnReset(){
setListDetailEntry(new ArrayList<ReportTmp1>());
setEmptyRow();
ListModelList listModel=new ListModelList(getListDetailEntry());
listboxDetailEntry.setModel(listModel);
listboxDetailEntry.setItemRenderer(pjRenderer);
listboxDetailEntry.setItemRenderer(invRenderer);
listboxDetailEntry.setMultiple(true);
listboxDetailEntry.renderAll();
listboxDetailEntry.setSelectedIndex(0);
}
class Renderer
public class InvoiceRenderer extends GenericForwardComposer implements Serializable,ListitemRenderer<Tmp1>{
@Override
public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
}
public void render(final Listitem listitem, Tmp1 tmp1, int index)throws Exception {
Tmp1 tmp= tmp1;
final Listcell codeCell = new Listcell();
final Textbox txtCode= new Textbox();
codeCell.appendChild(txtCode);
final Listcell qtyCell = new Listcell();
final Intbox intQty = new Intbox();
qtryCell.appendChild(intQt);
.
.
//about 25cell
listitem.appendChild(codeCell);
listitem.appendChild(qtyCell);
listitem.setSelected(true);
listitem.setValue(tmp);
}
thanks