0

how to wire two controllers

asked 2014-03-20 15:43:16 +0800

gk gravatar image gk
1 1

updated 2014-03-20 15:56:59 +0800

hi,

i have two controllers (classes that extends SelectorComposer<Component> )

how can i wire the first controller to the second?

What i actually need is the first controller to access the components of the second

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-03-24 08:51:16 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

You can save your first controller in the session in the doAfterCompose like this :

public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   Sessions.getCurrent().setAttribute("controllerX", this);
}

and in the other controller you can do the following :

 private ControllerX controllerX;

 public void doAfterCompose(Component comp) throws Exception {
   super.doAfterCompose(comp);
   controlerX = (ControllerX)Sessions.getCurrent().getAttribute("controllerX");
}

This will work when ControllerX is created before the other controller. Otherwise shall controllerX be null.

Hope this can help you.

Greetz chill.

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2014-03-20 15:43:16 +0800

Seen: 14 times

Last updated: Mar 24 '14

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