Revision history [back]

click to hide/show revision 1
initial version

asked 2015-03-17 02:23:57 +0800

onsir gravatar image onsir

Reset of value in listbox using ListitemRenderer very long

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

Reset of value in listbox using ListitemRenderer very long

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

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