org.jicengine.element
Interface ActionElement

All Superinterfaces:
Element
All Known Implementing Classes:
ElementImpl.ActionElementImpl, WrapperActionElement

public interface ActionElement
extends Element

ActionElements can execute an action on request. The request is made by the client or user of the ActionElement, which is usually the parent element.

Typically, ActionElement modify global objects or the instance of the parent element by setting the values of some properties or by calling some methods. ActionElements might also call some static methods.

Design-note: ActionElements don't return any value. the ActionElement-interface is otherwise similar to the ValueElement-interface. The two interfaces could have been put under a common interface, but in that case the action should have returned value. it was essential that action-elements don't return a value. a null-value could have been used for signalling "no value", but that approach works only if we don't use null-values otherwise..

Elements with the 'action'-attribute are compiled into ActionElements. However, also elements without the attribute may end up as ActionElements.

Author:
.timo

Field Summary
 
Fields inherited from interface org.jicengine.element.Element
VARIABLE_NAME_CDATA, VARIABLE_NAME_ELEMENT_INSTANCE, VARIABLE_NAME_PARENT_INSTANCE
 
Method Summary
 void execute(Context globalContext, java.lang.Object parentInstance)
           Executes the action of this element.
 
Methods inherited from interface org.jicengine.element.Element
getName
 

Method Detail

execute

public void execute(Context globalContext,
                    java.lang.Object parentInstance)
             throws ElementException

Executes the action of this element. The operation doesn't return any value to its caller, although it can internally produce a value.

The client/user of this element will call this method. currently, the method is called only once. However, the action should be able to be executed multiple times.

in general, the execution consists of the following steps:

  1. if the element has an instance, it is created first (with parameters)
  2. if the element has other ActionElements as children, they are executed next
  3. finally, the actual action is executed (with parameters)

Parameters:
globalContext - a Context where the instances marked with the 'id'-attribute are put.
parentInstance - the instance of the parent element. NOTE: null-value means that the value of the parent is not available (not yet or never), not that the instance of the parent is null!
Throws:
ElementException - if any part of the execution of the action fails.