0

Fellow component not found for included zul file

asked 2008-10-17 13:37:33 +0800

Adanlessossi gravatar image Adanlessossi
105 3

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

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2008-10-21 04:38:45 +0800

robertlee gravatar image robertlee
561

Hi bad,
Can you show an example of what you have done? A code snippet would be nice :)
rob

link publish delete flag offensive edit

answered 2008-10-21 07:04:10 +0800

PeterKuo gravatar image PeterKuo
481 2

updated 2008-10-21 07:04:25 +0800

From developer's guide, "Each regular macro component is an ID space owner". Can it answer your question?

link publish delete flag offensive edit

answered 2008-10-21 12:02:58 +0800

divaa gravatar image divaa
21

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

link publish delete flag offensive edit

answered 2008-10-21 18:17:50 +0800

robertlee gravatar image robertlee
561

updated 2008-10-21 18:19:55 +0800

Hi divaa, Your problem is in two parts, you are correct that include happens as late as the rendering phase. (See component lifecycle chapter), so as dev guide suggested, you should use a macro component in this case, which I have tweaked your code:
link publish delete flag offensive edit

answered 2008-10-22 08:42:51 +0800

divaa gravatar image divaa
21

thank u robertlee, i spent hours together, trying to make it work, using various means.. i think this mthod should do the trick for me

thank u agaain

link publish delete flag offensive edit

answered 2011-12-20 17:21:40 +0800

DaniG gravatar image DaniG
78 1

Hi Adanlessossi

Maybe this could to help you:

http://www.zkoss.org/forum/listComment/17864

Good luck

link publish delete flag offensive edit

answered 2011-12-20 19:55:35 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/

Do you see that this thread is over 3 years old ?

link publish delete flag offensive edit

answered 2012-01-23 09:48:12 +0800

DaniG gravatar image DaniG
78 1

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.

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-10-17 13:37:33 +0800

Seen: 1,739 times

Last updated: Jan 23 '12

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