0

Retrieving the controller associated with a Window

asked 2010-04-28 05:15:34 +0800

raevel2 gravatar image raevel2
72 1 2

I am using html macro components. My macro components have windows which in turn reference spring wired controllers, like so:

SampleMacroComponent.zul:

<window apply="${sampleController}">
</window>

Each component instance has its own controller, and I need to be able to call methods on these controllers. How do i retrieve the controller?
I tried doing myWindow.getAttribute("apply") but this gave me the value null.

Is there some preferred way of doing this? It just struck me that I might be able to create a dummy zul element in the component that has value="${sampleController}". Is this the best way of accomplishing the task?

Cheers

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-04-28 08:04:53 +0800

raevel2 gravatar image raevel2
72 1 2

What I ended up doing was:

<window apply="${myController}">
  <grid>
    <rows>
      <row id="row_controller" value="${myController}"/>
    </rows>
  </grid>
</window>

Then the code that uses this macro component can fetch the window through the macro element and use getFellow to get row_controller and then use getValue().

link publish delete flag offensive edit

answered 2010-04-28 08:17:27 +0800

ryanwong00 gravatar image ryanwong00
63 1

updated 2010-04-28 08:17:48 +0800

The instance of the controller shall be stored in the attribute of the component. You may find this useful.

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: 2010-04-28 05:15:34 +0800

Seen: 234 times

Last updated: Apr 28 '10

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