![]() UJML Language Reference |
An interface file contains one or more UJML component interface declarations each of which may be included into an application, partition, or component file.
Interface files have a file extension of '.ujmi'. For example, 'bar.ujmi'. An interface file contains a ujml root element, which contains a interfaces element which contains zero to many interface elements, each declaring a separate component interface. See Layout of UJML Files, ujml, interfaces, interface.
Interfaces are included using the include element into applications, partitions, or components that use variables of the interface data type. See Interface Types, include. Interfaces are also included into components which implement that interface. See Components, Interfaces.
The following example is an interface file that provides for timers and timer listeners. It is the itimer.ujmi sample and is implemented by the timer.ujml sample.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ujml PUBLIC "-//UIEVOLUTION//DTD UJML 2.0//EN" "ujml-2.0.dtd"[]>
<!--
Copyright (c) 2000-2007 UIEvolution, Inc.
http://www.uievolution.com
-->
<!--
itimer.ujmi
Interface declarations for timer components.
-->
<ujml>
<interfaces>
<!--
ITimerSource
A source of 'timers' that calls a tick method on zero or more
'listener' components and also raises a UJML event for each
tick. An implementation may support multiple timers using unique
ID numbers for each.
-->
<interface name="ITimerSource">
<functions>
<!--
Initializes the timer.
-->
<function name="init" type="void">
<parameters>
<!-- Default is 1. -->
<var name="maxListeners" type="int"/>
</parameters>
</function>
<!--
Adds an ITimerListener component to the listener list.
Returns true if the listener was successfully added.
Note: How many listeners a timer can contain depends on the
maxListeners argument passed in the init() function.
-->
<function name="addTimerListener" type="boolean">
<parameters>
<var name="listener" type="ITimerListener"/>
</parameters>
</function>
<!--
Clears the listener list.
-->
<function name="clearTimerListeners" type="void"/>
<!--
Add a timer for a specified ID with the specified tick
time.
Returns true if the timer was successfully added.
Note: How many timers can run at a time is implementation
dependent. Attempting to start too many timers will return
false.
-->
<function name="addTimer" type="boolean">
<parameters>
<!-- Can be any unique value, using existing ID overwrites tick time. -->
<var name="id" type="int"/>
<!-- Must be greater than zero. -->
<var name="tickMilliseconds" type="int"/>
</parameters>
</function>
<!--
Clears the timer list.
-->
<function name="clearTimers" type="void"/>
<!--
Starts all timers.
-->
<function name="start" type="void"/>
<!--
Stops all timers.
-->
<function name="stop" type="void"/>
</functions>
<events>
<!--
Fired after all listeners have been serviced for
a single tickID.
-->
<event name="onTick">
<parameters>
<var name="timerID" type="int"/>
</parameters>
</event>
</events>
</interface>
<!--
ITimerListener
A 'listener' that provides a tick method called by a 'timer' component.
-->
<interface name="ITimerListener">
<functions>
<!--
Called for each tick of a timer.
-->
<function name="tick" type="void">
<parameters>
<var name="id" type="int"/>
</parameters>
</function>
</functions>
</interface>
</interfaces>
</ujml>|
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
|
|
What do you think about this topic? Send feedback!
|