-
Bug
-
Resolution: Fixed
-
Normal
-
7.0.3
-
None
-
None
In http://tracker.zkoss.org/browse/ZK-2076, if we use customized extended class, it will cause object conversion error.
reproduce code is shown below.
<zk> <div apply="test.SubscribeBugController"> <button id="btn" label="test"/> </div> </zk>
package test; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventQueue; import org.zkoss.zk.ui.event.EventQueues; import org.zkoss.zk.ui.select.SelectorComposer; import org.zkoss.zk.ui.select.annotation.Listen; import org.zkoss.zk.ui.util.Clients; import org.zkoss.zkmax.ui.select.annotation.Subscribe; public class SubscribeBugController extends SelectorComposer<Component> { private static final long serialVersionUID = 1L; private EventQueue<Event> eq = EventQueues.lookup("testqueue"); @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); } @Listen("onClick=#btn") public void onClick$btn(Event e) throws InterruptedException { eq.publish(new CustomEvent("dummy", null, "mydata")); } @Subscribe("testqueue") public void handleEvent(CustomEvent e) { Clients.showNotification(e.getName()); } public class CustomEvent extends Event { public CustomEvent(String name, Component target, Object data) { super(name, target, data); } } }
case on zkfiddle.
http://zkfiddle.org/sample/2vr86iv/1-eventqueue-subscribe-error#source-2