0

How to control one file component in multiple/differents Composers

asked 2011-05-29 15:12:50 +0800

blacksensei gravatar image 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">
    <menupopup id="accountContextMenu">
        <menuitem id="sendMail" label="Send Mail" />
        <menuitem id="sendSms" label="Send Sms" />
        <menuitem id-"show" label="show" />
    </menupopup>
</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 flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2011-05-31 13:47:12 +0800

blacksensei gravatar image blacksensei
234 2

no one? :(

link publish delete flag offensive edit

answered 2011-06-01 11:52:52 +0800

matthewgo gravatar image matthewgo
375

updated 2011-06-01 11:53:15 +0800

I am not sure what you mean,
maybe you can refer here

link publish delete flag offensive edit

answered 2011-06-01 12:11:24 +0800

blacksensei gravatar image blacksensei
234 2

updated 2011-06-01 12:37:08 +0800

Hey! thanks for responding.

I think that's what it it.will try and give feedbacks.

thanks again

link publish delete flag offensive edit

answered 2011-06-01 17:22:09 +0800

blacksensei gravatar image 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
i've added an onClick to the menuItem :

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

i've added the method
onSendMail(){...}
to the GenericAutowireComposer. and it gaves a "Command not Found " error.


What am i missing here? thanks

link publish delete flag offensive edit

answered 2011-06-02 07:49:57 +0800

ftmichael gravatar image ftmichael
129 1

updated 2011-06-02 07:59:14 +0800

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

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: 2011-05-29 15:12:50 +0800

Seen: 385 times

Last updated: Jun 02 '11

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