Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-2445

Feature ZK-2076 doesn't consider about extended event class

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 7.0.3
    • Fix Version/s: 7.0.4
    • Component/s: None
    • Labels:
      None

      Description

      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

        Attachments

          Activity

            People

            Assignee:
            JerryChen JerryChen
            Reporter:
            JerryChen JerryChen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: