+

Search Tips   |   Advanced Search

Organization | Portal Scripting Interface

For some beans, in particular the Content and Layout beans, the order of nodes is significant. In tree beans, the parent relationship of the nodes defines the hierarchy. Only nodes with the same parent node are in a particular order in trees.


Sequence

The move command is used to reorder nodes. The order of nodes is tracked as a non-negative integer position assigned to each node, with the first node at position 0. For tree beans, the positions compare only among the children of a common parent node. We can query the position as a read-only plain attribute.

The order of nodes is changed by the move command. It is used on a single node to assign an absolute position or to displace by a distance. The positions of the other affected nodes are updated automatically. In both cases, the new position of the node always remains within bounds. The position or displacement argument is adjusted by the bean.

The move command expects the ID of the node to be moved, a keyword that indicates whether the change is absolute or relative, and the new position or distance. If the bean supports a current selection, the ID is omitted to move the selected object.Jython example:

Jacl example:


Hierarchy

In some tree beans, we can change the parent of a node in the tree, moving the whole subtree under that node to another part of the tree.

This change of the parent of a node in the tree is achieved by the commands transfer or adopt. With transfer, the ID of the node and new parent are specified explicitly, whereas adopt uses the selected layout mode as the new parent. To improve readability and avoid confusion about the interpretation of the two IDs, the arguments of the transfer command are separated by the keyword "to".Jython example:

Jacl example:

Parent topic: Command reference for the Portal Scripting Interface