UIEvolutin Inc.
UJML Language Reference
Scripting

Scripting, in UJML, is the addition of procedural steps to the declarative elements.

Scripting allows you to change the properties of visual elements at run time, to create animations, to react, to user input in complex ways, and even interact with external servers by sending and receiving data. See Data, State Transitions, Visual Elements. The result is a dynamic user interface and other functionality that UJML cannot otherwise provide.

Two kinds of UJML scripting

There are two different methods of adding scripting statements to UJML: XML scripting elements and the script block scripting language. See XML Scripts, Script Blocks. These provide similar capabilities, although the scripting language is the preferred scripting method. Both work with UJML in a manner similar to how JavaScript works with HTML. 

Note: XML scripting and the scripting language may be mixed in the same UJML program. Although this is not encouraged, UJML will allow it.

Procedural scripting

Both scripting methods allow you to add procedural, or one-step-at-a-time, code to the declarative elements of UJML. These procedural scripting statements are executed when the state transition, function, or other UJML element that contains them is executed. When this happens, the scripting statements are executed in they order they occur in the UJML code until all scripting code inside that UJML element is completed. See Execution Order.

Scripting expressions

Besides procedural scripting, both forms of UJML scripting allow runtime-evaluated expressions which return a value. See Script Expressions. This may be a function call, a mathematical calculation or a Boolean comparison—any single scripting statement that yields a value. For example, you might use an expression to calculate visual element property values, such as location and color, when the visual element is displayed.

Scripting and functions

Within both procedural and expression scripting statements you may also call functions. See Using Functions, Functions. You may also use scripting to create your own functions. See User Defined Functions.

Topic 
Description 
Script blocks contain code in a JavaScript-like language. 
XML scripting uses XML syntax to specify the scripting elements. 
Script expressions are operations in the scripting language or XML scripting elements that yield a value. 
You use a function by calling it by name, along with its parameter values. 
Flow control in scripting determines which script statements are executed, and when. 
A side effect occurs when scripting code in a function, event, or state transition alters the value of a module-level variable, leading to changes in the behavior of unrelated code which references the same module level variable. 
Copyright (c) 2000-2007 UIEvolution, Inc. All rights reserved.
What do you think about this topic? Send feedback!