0

Popup window with ListCell does know show itself... ???

asked 2008-11-11 05:16:38 +0800

umanga gravatar image umanga
180 3

Hello everyone,

I am displaying protein-sequences in a ListBox (enabled multiselection with checkmarks)..Since sequences are pretty long , i only display 25 characters and want to display the full sequence in a Popup window when user move the mouse over the ListCell.

Problem is,the popups wont appear during a mouse over.. ???

What could be the problem.

Thanks in advance,
umanga

My code in as follows :

...create cell row ..etc
String val=getProteinsSequence();

Listcell acell = new Listcell();
acell.setStyle("font-size:10px");

if (val.length() > 25) {
					
	Popup popup = new Popup();	
	popup.setWidth("200px");					
	popup.setHeight("100px");
	Vbox vbox = new Vbox();
	Label lbl = new Label("`"+);
	vbox.appendChild(lbl);
	popup.appendChild(vbox);
					
	acell.appendChild(popup);
	acell.setTooltip(popup);
	//acell.setPopup(popup);					 
					 
	val = val.substring(0, 20) + "...";
    }

  acell.setLabel(val);

delete flag offensive retag edit

15 Replies

Sort by ยป oldest newest

answered 2008-11-11 06:22:43 +0800

jj gravatar image jj
638 3

Maybe I am missing something, but I don't see where you put the protein sequence (val) in the pop up?

link publish delete flag offensive edit

answered 2008-11-11 07:06:38 +0800

umanga gravatar image umanga
180 3

Sorry .. its in the Label (lbl) .. i have mistakenly deleted that seems..
its shoud be:

Label lbl = new Label("Sequence "+ val);

Anyway..this code doesnt popup even the empty Window..Basically nothing happens ????

Anyone...please?

link publish delete flag offensive edit

answered 2008-11-13 02:26:37 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

try to assign popup's parent to an outer or inner one. don't assign it directly to a cell.

image that form this xml <acell><adiv><alabel value="val"/><popup/></advi><another_column_of_cell/></acell>
in this case, don't call acell.setLabel(val) , cause of you want to append another component in it.

link publish delete flag offensive edit

answered 2008-11-13 06:33:22 +0800

umanga gravatar image umanga
180 3

hi dennis,

thank you for the tip.I set the parent of popup as <adiv> as in your form.but it didnt work.
Anyway, when i set the popup [using div.setPopup(popup); ] and once i click on the lable, the Popup opens and suddenly closes.Anyway this didnt work for setTooltip(); method !

Any tips?

regards
umanga

link publish delete flag offensive edit

answered 2008-11-13 08:00:40 +0800

umanga gravatar image umanga
180 3

Hi all,

I tested same logic use ZK-Demo site as follows , it works fine....Wonder why its not working when same logic is done programatically..
My Zul likes follows and it works well??

<window title="Checkmark" border="normal">

<panel>
<panelchildren>
	<button label="Toggle checkmark" onClick="box.checkmark = !box.checkmark"/>
	<button label="Toggle multiple" onClick="box.multiple = !box.multiple"/>
	<separator bar="true"/>
	<listbox id="box" width="460px" multiple="true" checkmark="true">
		<listhead>
			<listheader label="Name"/>
			<listheader label="Gender"/>
			<listheader label="Age"/>
			<listheader label="Description"/>
		</listhead>
		<listitem>

			<listcell >
                         
                         <div tooltip="any">
                          <label value="tooltiphere"/>
                         </div>
                          <popup id="any" width="300px">
                        	<vbox>
			                ZK simply rich.
                      		<toolbarbutton label="ZK your killer Web application now!" href="http://www.zkoss.org"/>
                             	</vbox>
                          </popup>		
                       </listcell>


			<listcell label="FEMALE"/>
			<listcell label="18"/>
			<listcell label="A young lady."/>
		</listitem>
		<listitem>
			<listcell label="John"/>
			<listcell label="MALE"/>
			<listcell label="20"/>
			<listcell label="A college student."/>
		</listitem>
		<listitem>
			<listcell label="Jane"/>
			<listcell label="FEMALE"/>
			<listcell label="32"/>
			<listcell label="A remarkable artist."/>
		</listitem>
		<listitem>
			<listcell label="Henry"/>
			<listcell label="MALE"/>
			<listcell label="29"/>
			<listcell label="A graduate."/>
		</listitem>
	</listbox>
</panelchildren>
</panel>
</window>

link publish delete flag offensive edit

answered 2008-11-13 09:21:18 +0800

umanga gravatar image umanga
180 3

hi guys..
seems theres no solution for this...
I want to know whether there is a 'onMouseOver' event for Div or ListCell.?
Now my solution is, to use a normal Window (instead of a Popup)to be displayed on a mouve over event.


thanks in advance,
umanga

link publish delete flag offensive edit

answered 2008-11-13 14:44:01 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

updated 2008-11-13 14:45:32 +0800

umanga, what i mean is

<listcell >

                         <div tooltip="any">
                          <label value="tooltiphere"/>
                          <popup id="any" width="300px">
                        	<vbox>
			                ZK simply rich.
                      		<toolbarbutton label="ZK your killer Web application now!" href="http://www.zkoss.org"/>
                             	</vbox>
                          </popup>
                          </div>
</listcell >


could you modify the code to above structure and try again?

link publish delete flag offensive edit

answered 2008-11-14 00:52:20 +0800

umanga gravatar image umanga
180 3

hi dennis,

yes i tried that also ,but noluck..I tried almost all possible combinations ..nothing is working..
following is the code for above structure..

.
.
Listcell acell = new Listcell();
String val=getProtienSequence(...);

  Div div=new Div();
   
  if (val.length() > 25) { //enable tooltip only if the string is too long
	
        Popup popup = new Popup();										
	popup.setHeight("100px");
		Vbox vbox = new Vbox();
		Label lbl = new Label(val);										
		vbox.appendChild(lbl);
        popup.appendChild(vbox);					
	popup.setParent(div);
										
	        					
	div.appendChild(popup);					
	div.setTooltip(popup);

        val = val.substring(0, 20) + "...";					
  }
				
div.appendChild(new Label(val));
acell.appendChild(div);
.
.
litem.appendChild(acell);

Any idea?

thanks
umanga

link publish delete flag offensive edit

answered 2008-11-14 01:13:41 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

updated 2008-11-14 01:25:50 +0800

umanga,
don't put a popup inside a component whose's tooltip assign to this popup.
and, when you try to compare some thing, you should make sure the main logic is the same.
you code doesn't equals to xml to construct the component, isn't it?

here a example works from me.

<window title="Checkmark" border="normal">

<panel>
<panelchildren>
	<button label="Toggle checkmark" onClick="box.checkmark = !box.checkmark"/>
	<button label="Toggle multiple" onClick="box.multiple = !box.multiple"/>
	<separator bar="true"/>
	<listbox id="box" width="460px" multiple="true" checkmark="true">
		<listhead>
			<listheader label="Name"/>
			<listheader label="Gender"/>
			<listheader label="Age"/>
			<listheader label="Description"/>
		</listhead>
		<listitem>

			<listcell id="cell">
                         
                         <zscript>
Popup popup = new Popup();										
popup.setHeight("100px");
Vbox vbox = new Vbox();
Label lbl = new Label("the tips");							
vbox.appendChild(lbl);
popup.appendChild(vbox);

Div div = new Div();
Label target = new Label("Tooltips");
target.setTooltip(popup);
target.setParent(div);
popup.setParent(div);
div.setParent(cell);
</zscript>	
                       </listcell>


			<listcell label="FEMALE"/>
			<listcell label="18"/>
			<listcell label="A young lady."/>
		</listitem>
		<listitem>
			<listcell label="John"/>
			<listcell label="MALE"/>
			<listcell label="20"/>
			<listcell label="A college student."/>
		</listitem>
		<listitem>
			<listcell label="Jane"/>
			<listcell label="FEMALE"/>
			<listcell label="32"/>
			<listcell label="A remarkable artist."/>
		</listitem>
		<listitem>
			<listcell label="Henry"/>
			<listcell label="MALE"/>
			<listcell label="29"/>
			<listcell label="A graduate."/>
		</listitem>
	</listbox>
</panelchildren>
</panel>
</window>

link publish delete flag offensive edit

answered 2008-11-14 01:45:46 +0800

umanga gravatar image umanga
180 3

hi dennis,
thank you for the help.But it didnt work.
I tried by setting the parent of popup to its topmost 'Window' using:

popup.setParent(getParent().getParent().getParent()..//Till it reach the 'Window' container );

This didnt work.

But instead of lable.setTooltip(popup) , i used label.setContext(popup) ..and it works well..
Guess I have to stick with rightclick-context menu...

thank you for your help
umanga

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2008-11-11 05:16:38 +0800

Seen: 1,945 times

Last updated: Nov 06 '10

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