-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi Everybody
In a zul file containing another zul file (using macro), i tried to get reference to a listbox component in the included file programmatically. But it seems the component is not found... hummm? any idea?
-bad
From developer's guide, "Each regular macro component is an ID space owner". Can it answer your question?
hi
i am facing the same problem.. the code is as follows..
zul file one
----------------------------------------------------------------------------
<?page title="mainScr" id="mainScr"?>
<window id="mainScr_win" width="100%" height="100%" style="background-color:#FFFFFF;">
<image id="logo_img" src="images/unitedAir/logo.gif" style="margin-top:20px;"></image>
<attribute name="onCreate">
com.zkBinding.RfidBinder rf= new com.zkBinding.RfidBinder();
rf.Identifier(desktop,"Howord","Davy");
</attribute>
<div id="process_div" height="550px" width="600px" style="margin-top:120px;margin-left:50px;">
<window id="process_win" height="100%" width="100%" style="background-color:#000000">
<include id="process_inc" />
</window>
</div>
</window>
-------------------------------------------------------------------------------------
zul file 2
-------------------------------------------------------------------------------------
<?page id="${param.pageId}"?>
<window id="identifier_win" height="530px" width="580px" style="margin-left:10px;margin-top:10px;background-color:#FFFFFF">
<div height="430px" width="480px" style="margin-left:50px;margin-top:50px;">
<vbox spacing="20px" style="margin-left:auto;margin-right:auto;">
<label value="WELCOME" style="font-size:40px;font-weight:bold;color:#FF0000;"></label>
</vbox>
<hbox spacing="25px" style="margin-left:auto;margin-right:auto;margin-top:40px;">
<label id="fname_lbl" style="font-size:35px;font-weight:bold;">Howord</label>
<label id="lname_lbl" style="font-size:35px;font-weight:bold;">Davy</label>
</hbox>
<vbox spacing="20px" style="margin-left:auto;margin-right:auto;margin-top:50px;">
<label value="Do you want to proceed with your checkin !" style="font-size:18px;font-weight:bold;color:#000000;"></label>
</vbox>
<hbox spacing="20px" style="margin-left:auto;margin-right:auto;margin-top:40px;">
<button id="yes_btn" height="20px" width="100px" label="YES"></button>
<button id="no_btn" height="20px" width="100px" label="NO"></button>
</hbox>
</div>
</window>
---------------------------------------------------------------------------------------
java code:
import java.util.List;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.Path;
import org.zkoss.zul.Include;
import org.zkoss.zul.Label;
import org.zkoss.zul.Window;
public class RfidBinder {
public void Identifier(Desktop desktop, String fname, String lname){
System.out.println("trying to create the UI for the rfid");
System.out.println("firstname:"+fname);
System.out.println("lastname:"+lname);
Window mainWin = (Window)desktop.getPage("mainScr").getFellow("mainScr_win");
System.out.println("mainWin:"+mainWin);
Include processInc =(Include) desktop.getPage("mainScr").getFellow("mainScr_win").getFellow("process_win").getFellow("process_inc");
System.out.println(processInc);
processInc.setSrc("Identifier.zul?pageId=Identifier");
setIdentifier(desktop);
}
public void setIdentifier(Desktop desktop){
System.out.println("tryign to access the page?");
Window processwin =(Window) desktop.getPage("mainScr").getFellow("mainScr_win").getFellow("process_win");
Window win = (Window)Path.getComponent(processwin,"//Identifier/identifier_win");
System.out.println(win);
}
}
------------------------------------------------------------------------------------
Problem scenario
i am able to successfully add my 2nd zul file into the 1st zul file through the java class.
But once included i am not able to access the componnts in the 2nd inscluded zul file through java, it gives a null.
I tried including the 2nd zul file through java in the onCreate method in the first zul file.
then once the page is rendered i called the function "setIdentifier"(this tries to access component on the included zul file) on the onClick method from the 1st zul file. It works , it returns the component id...
But i need to be able to access the components in the included file, with out havign to trigger another event.
Please could some one help me
Do you see that this thread is over 3 years old ?
Hi...
Well, this link take me to a thread of Nov 08, 2011 with title "How to locate?"... if it doesnt link the same for others sorry terrytornado (and you all), maybe I confused the link. You all can get the thread looking by that title.
Asked: 2008-10-17 13:37:33 +0800
Seen: 1,739 times
Last updated: Jan 23 '12