Declaring an Important Event

From Documentation
Revision as of 06:30, 14 July 2010 by Tmillsclare (talk | contribs) (Created page with 'The third argument of <mp>addClientEvent</mp> is used to declare an event as import. The argument is a combination of integer flags that indicate how to handle the event. The '''…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The third argument of addClientEvent is used to declare an event as import. The argument is a combination of integer flags that indicate how to handle the event. The CE_IMPORTANT flag is used to indicate that this event is very important and should be sent to the server even if there is no server side listener registered for the event. For other flags, please refer to the Java API.

For example, we require the onClear event to be sent to the server at all times so we are required to declare the following:

static {
		addClientEvent(SimpleLabel.class, ClearEvent.NAME, CE_IMPORTANT);
	}

Now the ClearEvent is guaranteed to be sent to the server which solves our syncing problem. Now we have a simple label with some additional features which works as advertised. This label has served as a good introduction to component development with ZK.