Revision history [back]

click to hide/show revision 1
initial version

asked 2014-03-20 16:32:01 +0800

demichev gravatar image demichev

How to fire custom events from server-side

All,

Would like to request some help with understanding the mechanism on how server side events can be fired and handled by custom components.

Trying to build an extended text box and subscribe to say "page refresh" event that ViewModel would throw.

  • In my TextBox class I'm doing: static { addClientEvent(ExtendedTextbox.class, PageRefreshEvent.PAGEREFRESHEVENT, CEIMPORTANT | CEDUPLICATEIGNORE | CENON_DEFERRABLE); } Where PageRefreshEvent is my event.
  • I'm overriding method void service(org.zkoss.zk.au.AuRequest request, boolean everError) and checking cmd for PageRefreshEvent.PAGEREFRESHEVENT a standard approach
  • Here's I need to fire an event from my ViewModel to notify all my text boxes that page was refreshed, but I don't see how it can be achieved. Tried several ways a) Events.postEvent(new PageRefreshEvent(this)); b) EventQueues.lookup(<queue_name_referred_from_zul>, BinderCtrl.DEFAULTQUEUESCOPE, false); que.publish(new PageRefreshEvent(this));

I don't see that service method in my text box is ever called with page refresh. Looks like the only type of events textbox component is intercepting is events fired from textbox widget and wrapped into AuRequest.

So the question that I have: is there any way to emulate a "page refresh" event for all the controls on the desktop? Somewhat similar to BindUtils.postNotifyChange() but with my own custom event type?

Thanks a lot in advance!

How to fire custom events from server-side

All,

Would like to request some help with understanding the mechanism on how server side events can be fired and handled by custom components.

Trying to build an extended text box and subscribe to say "page refresh" event that ViewModel would throw.

  •  - In my TextBox class I'm doing: 
     static {
             addClientEvent(ExtendedTextbox.class,
    PageRefreshEvent.PAGEREFRESHEVENT,
    CEIMPORTANT     PageRefreshEvent.PAGE_REFRESH_EVENT,
        CE_IMPORTANT | CEDUPLICATEIGNORE CE_DUPLICATE_IGNORE |
    CENON_DEFERRABLE);     CE_NON_DEFERRABLE);     } Where
     PageRefreshEvent is my event.
  • event. - I'm overriding method void service(org.zkoss.zk.au.AuRequest request, boolean everError) and checking cmd for PageRefreshEvent.PAGEREFRESHEVENT PageRefreshEvent.PAGE_REFRESH_EVENT a standard approach
  • approach - Here's I need to fire an event from my ViewModel to notify all my text boxes that page was refreshed, but I don't see how it can be achieved. Tried several ways a) Events.postEvent(new PageRefreshEvent(this)); b) EventQueues.lookup(<queue_name_referred_from_zul>, BinderCtrl.DEFAULTQUEUESCOPE, BinderCtrl.DEFAULT_QUEUE_SCOPE, false); que.publish(new PageRefreshEvent(this));
PageRefreshEvent(this));

I don't see that service method in my text box is ever called with page refresh. Looks like the only type of events textbox component is intercepting is events fired from textbox widget and wrapped into AuRequest.

So the question that I have: is there any way to emulate a "page refresh" event for all the controls on the desktop? Somewhat similar to BindUtils.postNotifyChange() but with my own custom event type?

Thanks a lot in advance!

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More