forward"

From Documentation
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{ZUMLReferencePageHeader}}
 
{{ZUMLReferencePageHeader}}
  
'''Syntax:'''
+
=Syntax=
 +
 
 
  forward="''orginalEvent''=''targetId1''/''targetId2''.''targetEvent''"
 
  forward="''orginalEvent''=''targetId1''/''targetId2''.''targetEvent''"
 
  forward="''orginalEvent''=''targetId1''/''targetId2''.''targetEvent''(''eventData'')"
 
  forward="''orginalEvent''=''targetId1''/''targetId2''.''targetEvent''(''eventData'')"
Line 7: Line 8:
 
  forward="''targetEvent''"
 
  forward="''targetEvent''"
  
It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.
+
==orginalEvent==
 +
Optional. If it is not specified, <code>onClick</code> is assumed
  
The forward event is an instance of the <javadoc>org.zkoss.zk.ui.event.ForwardEvent</javadoc> class. you can invoke <javadoc method="getOrigin()">org.zkoss.zk.ui.event.ForwardEvent</javadoc>. to retrieve the original event.
+
==targetId1==
 +
Optional. If it's not specified, the '''space owner''' is assumed. If the space owner is not a component (a Page), the target is '''root component'''.
  
The original event is optional. If it is omitted, <tt>onClick</tt> is assumed. Similarly, the target ID is also optional. If omitted, the space owner is assumed.
+
<!-- AbstractComponent.ForwardListener -->
  
You could specify any application-specific data in the forward condition by surrunding it with the parenthesis as shown below.
+
==eventData==
 +
Optional.
 +
You could specify any application-specific data in the forward condition by surrounding it with the parenthesis as shown below.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 20: Line 25:
 
</source>
 
</source>
  
Then, the application-specific data can be retrieved by use of <javadoc method="getData()">org.zkoss.zk.ui.event.ForwardEvent</javadoc>.
+
Then, the application-specific data can be retrieved by the use of <javadoc method="getData()">org.zkoss.zk.ui.event.ForwardEvent</javadoc>.
  
 +
== Multiple forwarding ==
 
If you want to forward several events, you can specify all these conditions in the forward attribute by separating them with the comma (,):
 
If you want to forward several events, you can specify all these conditions in the forward attribute by separating them with the comma (,):
  
Line 27: Line 33:
 
  <textbox forward="onChanging=onUpdating, onChange=some.onUpdate"/>
 
  <textbox forward="onChanging=onUpdating, onChange=some.onUpdate"/>
 
</source>
 
</source>
 +
 +
 +
 +
= Description =
 +
It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.
 +
 +
The event listener receives a <javadoc>org.zkoss.zk.ui.event.ForwardEvent</javadoc> object. You can invoke <javadoc method="getOrigin()">org.zkoss.zk.ui.event.ForwardEvent</javadoc> to retrieve the original event.
  
 
The target component and the event data can be specified in EL expressions, while the event names cannot.
 
The target component and the event data can be specified in EL expressions, while the event names cannot.
  
Target component can also be specified using component [http://books.zkoss.org/wiki/ZK_Developer's_Guide/ZK_in_Depth/Component_Path_and_Accesibility/Access_UI_Component Path] within ZUML page. This is especially useful if target component is in different [http://books.zkoss.org/wiki/ZK_Developer's_Reference/UI_Composing/ID_Space IdSpace]
+
The target component can also be specified using component [http://books.zkoss.org/wiki/ZK_Developer's_Guide/ZK_in_Depth/Component_Path_and_Accesibility/Access_UI_Component Path] within ZUML page. This is especially useful if target component is in different [http://books.zkoss.org/wiki/ZK_Developer's_Reference/UI_Composing/ID_Space IdSpace]
 
<source lang="xml" >
 
<source lang="xml" >
 
   <button forward="//mainPage/mainWindow.onSave" /> <!-- default forward event is onClick -->
 
   <button forward="//mainPage/mainWindow.onSave" /> <!-- default forward event is onClick -->
 
</source>
 
</source>
  
=Version History=
 
  
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
|-
 
| &nbsp;
 
| &nbsp;
 
| &nbsp;
 
|}
 
  
 
{{ZUMLReferencePageFooter}}
 
{{ZUMLReferencePageFooter}}

Latest revision as of 01:58, 9 May 2023

Syntax

forward="orginalEvent=targetId1/targetId2.targetEvent"
forward="orginalEvent=targetId1/targetId2.targetEvent(eventData)"
forward="originalEvent=${el-target}.targetEvent(${el-eventdata})"
forward="targetEvent"

orginalEvent

Optional. If it is not specified, onClick is assumed

targetId1

Optional. If it's not specified, the space owner is assumed. If the space owner is not a component (a Page), the target is root component.


eventData

Optional. You could specify any application-specific data in the forward condition by surrounding it with the parenthesis as shown below.

 <button forward="onCancel(abort)"/><!-- "abort" is passed -->
 <button forward="onPrint(${inf})"/><!-- the object returned by ${inf} is passed -->

Then, the application-specific data can be retrieved by the use of ForwardEvent.getData().

Multiple forwarding

If you want to forward several events, you can specify all these conditions in the forward attribute by separating them with the comma (,):

 <textbox forward="onChanging=onUpdating, onChange=some.onUpdate"/>


Description

It is used to forward an event, that is targeting a specific component, to another component in another event name. It is called the forward condition.

The event listener receives a ForwardEvent object. You can invoke ForwardEvent.getOrigin() to retrieve the original event.

The target component and the event data can be specified in EL expressions, while the event names cannot.

The target component can also be specified using component Path within ZUML page. This is especially useful if target component is in different IdSpace

   <button forward="//mainPage/mainWindow.onSave" /> <!-- default forward event is onClick -->




Last Update : 2023/05/09

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