-
FEATURED COMPONENTS
First time here? Check out the FAQ!
How come when using the following ZUL -
<zk> <window id="mywin" title="Test Hello Window" border="normal" height="200px" apply="BobJavaController" width="200px" closable="true" sizable="true"> Hello World Message: </window> </zk>
with the java code (BobJavaController) :-
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.util.GenericForwardComposer; @SuppressWarnings("serial") public class BobJavaController extends GenericForwardComposer { public void onClose$mywin(Event event) { System.out.println("close"); event.stopPropagation(); } }
The event.stopPropagation has no effect. The window is closed.
If I change the ZUL to :
<zk> <window id="mywin" title="Test Hello Window" border="normal" height="200px" apply="BobJavaController" width="200px" closable="true" sizable="true" onClose="event.stopPropagation()"> Hello World Message: </window> </zk>
the stopPropagation works and the window does not close. Of course then the java code in BobJavaController is then not called at all.
public void onClose$mywin(Event event) { System.out.println("close"); Events.getRealOrigin(event).stopPropagation(); }
The event sent to onClose$mywin is a ForwardEvent that you need to get the original one to stop it from propagation.
Many thanks Henrichten
I new it would be me being stupid and something that I was not doing, so I didn't post it as a bug.
Only slight change is I needed to cast "event" as in :-
Events.getRealOrigin((ForwardEvent) event).stopPropagation();
Asked: 2010-01-27 08:28:57 +0800
Seen: 856 times
Last updated: Jan 30 '10