From Documentation

(Difference between revisions)
Jump to: navigation, search
m (Wire Event Listeners in Nested ID Space)
Line 43: Line 43:
=Version History=
=Version History=
-
Last Update : {{REVISIONYEAR}}/{{REVISIONMONTH}}/{{REVISIONDAY}}
+
{{LastUpdated}}
{| border='1px' | width="100%"
{| border='1px' | width="100%"
! Version !! Date !! Content
! Version !! Date !! Content

Revision as of 08:23, 17 December 2010






Contents

Wire Event Listeners

To wire an event listener, all you need is to declare a method with the event name. The method could have an optional argument for the event received. For example,

public void onChange(InputEvent event) {
   //it will be wired and called when onChange is received.
}
public void onMove() {
  //wired and called too, but no pass of the event
}

Wire Event Listeners Targeting Fellows

To wire a listener for an event targeting one of fellow, you could append the fellow's ID with a separator, $[1]. For example,

public void onClick$btn1() {
    //Called when the fellow named btn1 is clicked
}
public void onChange$inp(InputEvent event) {
    //Called when the fellow named inp's value is changed
}
  1. You could change the separator, if you want, by calling GenericForwardComposer.GenericForwardComposer(char, boolean, boolean) explicitly.

Wire Event Listeners in Nested ID Space

If the targeting component of an event is in a nest ID space, you could specify them one by one from target to the applied component. Notice that the order is different from wiring variable, which starts from the applied component. For example, if we want to wire the event listener for input's onChange event in the following example, we should name the method as onChange$input$inner().

<window apply="foo.MyComposer">
   <window id="inner">
        <textbox id="input"/>
...

Version History

Last Update : 2010/12/17


Version Date Content
     




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