The view path is an array of indexes that allows to navigate from a view to another one in the containment hierarchy. It is used in several methods of the AbstractActionContextAware
class that is extended by all actions, but that you can also extend from any application class that would need utility methods to explore the action context.
The rationale behind this view path is to start from the view from which the action was triggered and to follow the view path to reach the target view and, for instance, get its selected index.
The navigation rules are the following :
- a negative step index (-n) in the path means navigate up to the n'th parent
- a positive step index (+n) in the path means navigate down to the n'th child
The index of the child view when a positive step is found depends on the type of container you're on. Here are the rules :
- children indexes are zero-based.
- the children of a border container are indexed following this fixed order : north, west, center, east, south. I one child is missing then it is not taken into account, e.g. in a border with only a north and center children views, the center child will have index 1.
- the children of a grid container (either even or constrained), tab container are indexed following their order of declaration.
- the children of a split container are indexed from top to bottom or left to right depending of its orientation.
For instance, given the following UI :
split_horizontal {
left {
tabs {
form
table('A')
}
}
right {
border {
top {
form
}
center {
table('B')
}
}
}
}
the view path from table `A`
to table `B`
will be :
[-1, -1, 1, 1]