-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have created a ZK application which, as expected, contains several windows and dialogs. One window, say window1, contains a grid with values and buttons. The renderer class of this grid, say GridRenderer.java, contains code for handling the click of a specific button:
final Button myButton = new Button(buttonName);
myButton.setWidth("70px");
myButton.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
EventQueues.lookup("applicationqueue", EventQueues.DESKTOP, true)
.publish(new Event("buttonClicked", null, data));
}
});
I want two windows, window1(where the grid is placed) and window2, to subscribe to this event. In the controller classes of both windows I have inserted the following code:
EventQueues.lookup("applicationqueue", EventQueues.DESKTOP, true).subscribe(
new EventListener() {
public void onEvent(Event evt) {
if (evt.getName().equals("buttonClicked")) {
//do something
}
}
});
My problem is the following: window1 can 'listen' to the subscribed event, but window2 cannot. Does anyone know a way to solve this problem.
Not quite sure this is what you are after, we would probably do it all differently (not that I am saying your way is wrong of course). So have a look at "forward" - here is how we use it in one of our zul's on an anchor:
<a id="nb_grid_1d" forward="onClick=onNearbyFromClick">None</a>
Or maybe put all windows in a "border" and have a border controller?
Asked: 2014-05-13 11:34:30 +0800
Seen: 13 times
Last updated: May 14 '14