0

Access to Controller instance of a component.

asked 2010-10-13 08:03:00 +0800

shumy gravatar image shumy
244 1

Is there any way to access the instance created by the apply property when we create components with "Executions.createComponents(...)".
I what to use the controller to interact directly insted of use events/messages that are not type safe.
Using "Events.sendEvent(new Event(...))" is not very elegant when I just want to set a property.

I use ZK 3.6.4 version.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-10-14 01:10:35 +0800

RyanWu gravatar image RyanWu
533 2
about.me/flyworld

you can save the instance to the desktop
(in doAfterCompose)

desktop.setAttribute("myPorductComposer", this);

link publish delete flag offensive edit

answered 2010-10-14 09:29:26 +0800

shumy gravatar image shumy
244 1

Nice. You give me an idea.
Since I am using a my own GenericController extending the GenericForwardComposer, I can put it in the component:

comp.setAttribute("controller", this);

and then when creating the component:

Window comp = (Window) Executions.createComponents(...);
Controller controller  = (Controller) comp.getAttribute("controller");

link publish delete flag offensive edit

answered 2010-10-14 10:00:34 +0800

RyanWu gravatar image RyanWu
533 2
about.me/flyworld

in my web application, i have several region of page, each of them control different things.

i gave each of them a ZUL + Composer and save them all into the desktop, then i can communication with each other zul

by using composer and Executions.createComponents(another zul), i use extends technology and autowire by my self


i have a composer and a customized window --> productWindow


In Composer

productWindow pw = new productWindow();

In productWindow

	public class productWindowextends Window {
          private textbox txtb;  //<----------autowired by my self  ( actual, it's in the subData.zul)
          private textbox txtbValue;  //<----------autowired by my self  ( actual, it's in the subData.zul)
        public productWindow(){
		Executions.createComponents("subData.zul", this, null);
		Components.wireVariables(this, this);          //i do the wire
		Components.addForwards(this, this, '$');                
        }

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-10-13 08:03:00 +0800

Seen: 333 times

Last updated: Oct 14 '10

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