Package com.axelor.meta.headless
Class FormPath
java.lang.Object
com.axelor.meta.headless.FormPath
A node of a form's record tree: the root, a line of one of its collections, a line of a line, to
any depth.
| (empty) | the root |
items[#42] | the line of items with id 42 |
items[-1] | the first new line of the session: new lines get
negative ids, in the order they arrive, as the client's cid — whether a step adds
them or an action brings them, as a form's onNew its default lines |
items[0] | the first line of items as it stands when the step
runs |
items[-1].subTasks[#7] | a line of a line |
An id and a cid name the same line for the whole session, whatever actions do to the order of lines, and a cid keeps naming its line after a save gives it an id. A position is for authors who know no id.
A field of a node is written after its path: items[-1].product; split(java.lang.String)
separates the two.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumHow a segment names its line.static final recordOne step down the tree: a line of a collection of the node above.static final recordA node's path and a name under it, assplit(java.lang.String)finds them. -
Method Summary
Modifier and TypeMethodDescriptionA line of a collection of this node: by cid whennis negative, else by position.booleaninthashCode()The line of a collection of this node with this id.booleanisRoot()last()The last segment: how this line is named in its collection; null for the root.static FormPathA line of a collection of the root: by cid whennis negative, else by position.parent()The node above this line; the root's parent is null.static FormPathParses a path: segmentsname[#id],name[-cid]orname[position], joined by dots; blank or null is the root.static FormPathroot()The root record.segments()static FormPath.SplitSeparates a node's path from the name written after it:items[-1].productis the lineitems[-1]and its fieldproduct;customer.nameis the root andcustomer.name;items[0]is the line and an empty name.toString()
-
Method Details
-
root
The root record. -
line
A line of a collection of the root: by cid whennis negative, else by position.- See Also:
-
child
A line of a collection of this node: by cid whennis negative, else by position. -
id
The line of a collection of this node with this id. -
parse
Parses a path: segmentsname[#id],name[-cid]orname[position], joined by dots; blank or null is the root.- Throws:
IllegalArgumentException- when the text is not a path
-
split
Separates a node's path from the name written after it:items[-1].productis the lineitems[-1]and its fieldproduct;customer.nameis the root andcustomer.name;items[0]is the line and an empty name.- Throws:
IllegalArgumentException- when a segment is malformed
-
segments
-
isRoot
public boolean isRoot() -
parent
The node above this line; the root's parent is null. -
last
The last segment: how this line is named in its collection; null for the root. -
equals
-
hashCode
public int hashCode() -
toString
-