-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Greetings,
I am retrieving about 50K data in my application.So I implemented my listbox with the load-on-demand method explained at http://www.zkoss.org/smalltalks/loadondemand/
So now ,thers is only 100 records loaded into the listmodel (per page).But I am getting the js warning:
"Warning: unresponsive script
A script on this page maybe busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete."
Is theres anyway to remedy this situation?
thanks in advance.
Seems relate to the performance of the Browser.This gave the warnning on the IceWeasel 2.0 on Debian Etch (P-4 HT , 2Gb ram).
Worked well with the Firefox browser on Pentium Xeon(4Gbs ram) :)
So ,cant assume all have Xeons ?
Is there anyway to get rid of this warning mesasge?
Thanks in advance.
could you provide the code shows how you render the list box (the list item,column)
hi dennis,
Following is the function which invoked when user click on Paging button . (onPaging event).
If you see the code I have lots of Popup windows linked with so many cells.When I remove the popup windows ,the responce time was quite good.But I need the popups.. :) anyway heres the code , i have commented ** where i thought be important.Hope it understandable.
private void changePage(int startIndex, int recordSize) { markChanges(); //this method stores currently selected rows resultListbox.getItems().clear(); //clear the listbox int endIndex = startIndex + recordSize; if (endIndex >= allResults.size()) endIndex = allResults.size(); if (endIndex < 0) endIndex = 0; //create the sublist for the page List<Sequence> pageList = allResults.subList(startIndex, endIndex); pageResults = pageList; //add rows(list items) //** for (Sequence seq : pageList) { Listitem litem = new Listitem(); litem.setValue(seq); litem.setSelected(seq.isSelected()); // Add result rows int ind=0; for (String val : seq.getValues()) { boolean isSequence=false; Column col=colList.get(ind); String linkout=col.getLinkout(); String linkmask=col.getLinkmask(); if(sequenceCols.contains(new Integer(ind))){ isSequence=true; } //** Listcell acell = new Listcell(); Label lbl=new Label(); if (val.length() > 23) { //** Popup popup = new Popup(); popup.setHeight("100px"); Vbox vbox = new Vbox(); Html html=new Html(); if(isSequence){ String s=Common.generateColoredProtienHTML(val); html.setContent(s.toUpperCase()); } else{ html.setContent("<span style='color:black;>"+val+"<span>"); } vbox.appendChild(html); popup.appendChild(vbox); popup.setParent(getParent().getParent().getParent()); val = val.substring(0, 23) + "..."; acell.setContext(popup); } //**add some Html code to cell if(isSequence){ val=Common.generateColoredProtienHTML(val); Html html=new Html(); html.setContent(val.toUpperCase()); acell.appendChild(html); }else if(linkout!=null && (val!=null && !val.equals("") )){ String urlVal=new String(val); if (linkmask!=null && linkmask.equals("xxxx")){ urlVal=urlVal.substring(0,4); } String url=LinkoutUtils.processURL(linkout, urlVal); String ss="<i><a style='font-size:10px' href='"+url+"' target='_blank'>"+val+"</a></i>"; Html html=new Html(); html.setContent(ss); acell.appendChild(html); }else{ lbl.setValue(val); acell.appendChild(lbl); } //add PDB JMol link //** if(col.getDispName().equalsIgnoreCase("pdb id")){ addPDBButton(acell,val); //add a Button to cell } litem.appendChild(acell); ind++; } resultListbox.appendChild(litem); } }
SO the bad performance was caused by adding huge number of popup and the contents of popup.
have you try to defer the loading of popup's content to onOpen (when the popup open, then load the content)
another solution: just a popup in the page, and listen the right click of each cell (cause you link popup with setContext)
in right click, you create/replace the content of popup and show it.
Greetings,
I have implemented the popup (context menu) as dennis explained above.But now my popups give this strang behaviours:
please refer the screencast http://www.screencast.com/users/umanga/playlists/mysizouka
As you can seen when the listbox is scrolled to the right , the popup doesn't display in the correct location and when keep on right clicking on it, it move toward right and finally go out of the screen ?
Is there a way to fix this ?
Thanks
Hi,
how do you open a popup now?
could provide piece of code ?
/Dennis
hi dennis,
I have added a EventListner to each Cell.
* using one Popup instance ( variable - thePopup )
ListCell acell; . . . acell.addEventListener("onRightClick", new EventListener() { public void onEvent(Event arg0) throws Exception { String bal = new String(innerVal); String s = Common.generateColoredProtienHTML(bal); /** Clear the content of the Popup thePopup.getChildren().clear(); /***Addd some HTML code if (innerIsSequence) { Html html = new Html(); html.setContent("<pre>"+s.toUpperCase()+"</pre>"); thePopup.appendChild(html); } else { thePopup.appendChild(new Label(bal)); } //** open the Popup thePopup.open(acell); } });
It is a bug probably, there are to many side effects in different runtime environment , browser, customized style.
maybe this work, please give it try
thePopup.open(((MouseEvent)evt).getX(),((MouseEvent)evt).getY());
hi dennis,
thank you for the tip.But it did not work.
Here the output looks now,popup appears on top:
http://www.screencast.com/users/umanga/folders/Default/media/a0777ea3-8b69-43d6-a22f-0cce2f97b895
best regards
Asked: 2008-12-02 07:14:01 +0800
Seen: 457 times
Last updated: Dec 24 '08