-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello everybody.
I am having trouble to find the best approach to maintain a communication beetwen two controllers which are running at the same time.
I have two controllers (A and B).
The A.zul file:
<window>
//Other components
<tabpanel>
<include src="/views/B.zul"/>
</tabpanel>
</tabpanels>
</tabbox>
</window>
The B.zul file:
<div id="divB" apply="pkg.B">
<button onClick="divB$composer.doSomething();"/>
</div>
A.java:
class A extends GenericForwardComposer {
public void doSomethigOnButtonInBControllerClicked() {
// Do something when the button in the B controller was clicked.
}
}
B.java:
class B extends GenericForwardComposer {
public void doSomething() {
// Call doSomethigOnButtonInBControllerClicked of A
}
}
B is included by others controllers, which means it has to warn his "parent" without know who is it.
What is the best approach in this case?
Thanks in advance.
Hello caiofilipemr,
In order to communicate between parent-child i usually use global command:
http://books.zkoss.org/zk-mvvm-book/8.0/databinding/globalcommand_binding.html
For the second case scenario that is a little tricky, and will have to give some thoughts.
Best,
Darksu
Asked: 2017-06-01 18:28:48 +0800
Seen: 26 times
Last updated: Jun 19 '17