INTRO SPECS TUTORIALS RESOURCES TOOLS ABOUT US CONTACT US
 
 
  Proposal for <event> in <action>

Send comments to Cara Struble (mailto:cara@harmonia.com)
23 April 2001

Abstract

The name attribute of the event tag can be used to get further information on an event that occured. Currently, it can only be used in an <equal> tag like this (using the Java vocabulary for UIML in the example):

<condition>
  <equal>
    <event part-name="ComboBox" class="itemStateChanged" name="item"/>
    <constant value="Dog"/>
  </equal>
</condition>

In the equal tag above, the condition is true only when an "itemStateChanged" event occurs on the combo box (i.e., some item is selected) AND the "item" piece of that event has the value "Dog".

Events often have one or more pieces of data associated with them (referenced by the name attribute of <event>). In the above example, name="item" refers to the text string of the ComboBox item which was selected in the user interface. As another example, the pieces of data associated with a mouse event might be the X and Y coordinate of the mouse when the event was generated.

What if we wanted to use the pieces of data associated with an <event> in the list of actions in the rule? In the above code example, we might want to set the value of some property to the value of the "item" from the event. This is not possible in the UIML specification of 17 January 2000.

Proposal

To allow data from events to be used in the action element of a rule, we would like to write something like this:

<action>
  <property part-name="Label" name="text">
    <event part-name="ComboBox" class="itemStateChanged" name="item"/>
  </property>
</action>

The above code sets the text property of the label named Label to the string appearing in the combo box item which was selected in the user interface.

Since information about an event can only be retrieved after the event has occured, the body of <property> could only contain an <event> if the <property> appears in an <action> element whose corresponding <condition> names the event. Following is an example:

<rule>
  <condition>
    <event part-name="ComboBox" class="itemStateChanged"/>
  </condition>
  <action>
    <property part-name="Label" name="text">
      <event part-name="ComboBox" class="itemStateChanged" name="item"/>
    </property>
  </action>
</rule>

Another use of <event> in <action> is to make <event> a child of <param>. This allows a method to be called and to give a piece of data from an event as an argument to the method. Following is an example:

<rule>
  <condition>
    <event part-name="ComboBox" class="itemStateChanged"/>
  </condition>
  <action>
    <call name="O.HandleTheSelection">
      <param>
        <event part-name="ComboBox" class="itemStateChanged" name="item"/>
      </param>
    </call>
  </action>
</rule>

If the event firing the rule was selection of an element named "Dog"in the combo box, then the code above will call a method named O.HandleTheSelection with one parameter, namely "Dog".

Syntax changes

  • In the UIML DTD, allow <property> and <param> to contain <event>.
  • Any <event> that is a child of a <property> or a <param> MUST satisfy the following:
    • The <rule> containing the <event> must also contain a <condition> that contains another <event> element, and the name, class, part-name, and part-class attributes (whichever ones are present) must have the same value.
    • Any <event> that is nested in <action> must contain the name, class, and either part-name or part-class attributes.
Semantics

The semantics of <event> nested in <property> or <param> are the following:

  • When <event> is a child of <property> or <param>, the <event> element is replaced by a string corresponding to the value of the event data identified by the name attribute. In other words, the <event> acts to get the value of the event data.
Note

This use of <event> in <action> should not be confused with the case where <event> is a direct child of <action>. The case of <event> as a direct child of <action> retains the semantics in the UIML specification of 17 January 2000 that the named event must be fired.
 

© 1999-2001 UIML.org (all rights reserved)