# How to control one file component in multiple/differents Composers

blacksensei
234 2

Hello Again!!

the title provided might confuse you a little bit, but let me clarify that.
let's say i have 4 files for which there is a need of the very same menu context(at least in the view point of it ).
So me trying to be smart thought that i would save time by putting the actual menu
in a separate file and include the file in each of the 4 files.

<zk xmlns="http://www.zkoss.org/2005/zul">
</zk>

that works well but very soon i realized that i lack the knowledge to control each of the menuitems
in every of the 4 GenericForwardComposers of the files which have the context menu included.

is there a way to make that possible? where in the have

onClick$sendMail(){} in every GenericForwardComposer and depending on which composer, do specific operation in the method? thank you reading this. and thank you very much in advance for the anwser. delete retag edit ## 5 Replies Sort by » oldest newest answered 2011-05-31 13:47:12 +0800 blacksensei 234 2 no one? :( answered 2011-06-01 11:52:52 +0800 matthewgo 375 I am not sure what you mean, maybe you can refer here answered 2011-06-01 12:11:24 +0800 blacksensei 234 2 Hey! thanks for responding. I think that's what it it.will try and give feedbacks. thanks again answered 2011-06-01 17:22:09 +0800 blacksensei 234 2 Hello again, here is what i've tried. i've changed the GenericForwardComposer to GenericAutowireComposer . i've added an id to the include making it : <include id="mn" src="accountmenu.zul" /> the id of the popupmenu is still accountContextMenu <menupopup id="accountContextMenu"> now case 1 where i tried this: public void onClick$mn$accountContextMenu$sendMail{ ..
and this :
public void onClick$mn$sendMail() { ....

none of this worked.

case 2

<menuitem id="sendMail" label="Send Mail" onClick="onSendMail()" />

onSendMail(){...}
to the GenericAutowireComposer. and it gaves a "Command not Found " error.

What am i missing here? thanks

ftmichael
129 1

hey, the GenericForwardComposer inherits all methods from GenericAutowireComposer. i'm doing this like follows:

container.zul

<window id="container" use="myWindow">
<borderlayout>
<north id="north"/>
<east id="east"/>
<west id="west"/>
</borderlayout>
</window>

in myWindow i'm controlling the loaded views like this:

LayoutRegian north;
north.clearChilds();
Window win = Executions.createComponents("/accountmenu.zul" north, null )

and then u can make a methode like
public Window getNorth(){
return win;
}

i have had the same problem, i've first done all with includes but that sucks.

its the same if u define an onClick-Event or did it like onChange$id(){} in accountmenu.zul you have to apply your composer where the onChange$id is implemented

[hide preview]