OpenWGA 7.6 - TMLScript reference


Object:

List

Description A list represents a dynamic amount of single values that have a defined order and are accessible via index  numbers. Lists have a dynamic size. Elements can be added, inserted and deleted from the list. Their functionality is mostly equal to JavaScript arrays. They are effectively the TMLScript representation of the Java interface java.util.List.

The index numbers of lists are zero based. The first element of the list has index number 0.

Lists are used at most places in TMLScript where some kind of multiple value field is concerned.. They can contain any value or object, even values and objects of mixed size, although this is not recommended.

Everywhere in TMLScript and WGAPI where a List argument is needed a native JavaScript array may be used instead.

Lists can be used to create JavaScript iterators by passing them as argument to the Iterator() function.

Retrieval Diverse methods in TMLScript, but especially:

WGA.createList()
this.itemList()
this.metaList()
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
    portletevent
Properties and methods
Name Purpose
add([index, ] wert) Adds a value to the list
addAll([index,] list) Adds all values of another list to this list
clear() Removes all values  from the list
contains(wert) Controls if a value is contained in the list
containsAll(list) Controls if this list contains all values of another list
equals(list) Tests two lists for equality
get(idx) Reads a value from the list
indexOf(wert) Returns the index position of a value in the list
isEmpty() Controls if the list is empty
lastIndexOf(wert) Returns the (last) index position of a value in the list
remove(wert)
remove(idx)
Removes a value from the list
removeAll(list) Removes all values from the list that are contained in the parameter list
retainAll(list) Removes all values from the list that are not contained in the parameter list
set(idx, wert) Sets a value at an index position
size() Returns the number of values in the list
subList(from ,to) Extracts a partial list
toArray() Creates a JavaScript array containing the list values