Declaring an Important Event"

From Documentation
m (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 '''…')
 
m
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
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 '''''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.
+
{{ZKComponentDevelopmentEssentialsPageHeader}}
 +
 
 +
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 '''''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 such as CE_NON_DEFERRABLE (send immediately) or CE_REPEAT_IGNORE please refer to the Java API: <javadoc>org.zkoss.zk.ui.sys.ComponentCtrl</javadoc>.
  
 
For example, we require the <mp>onClear</mp> event to be sent to the server at all times so we are required to declare the following:
 
For example, we require the <mp>onClear</mp> event to be sent to the server at all times so we are required to declare the following:
Line 9: Line 11:
 
</source>
 
</source>
  
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.
+
Now the ''ClearEvent'' is guaranteed to be sent to the server which solves our syncing problem. 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.
 +
 
 +
{{ZKComponentDevelopmentEssentialsPageFooter}}

Latest revision as of 06:31, 15 October 2014


Declaring an Important Event



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 such as CE_NON_DEFERRABLE (send immediately) or CE_REPEAT_IGNORE please refer to the Java API: ComponentCtrl.

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. 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.



Last Update : 2014/10/15

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.