Class ViewportLayoutRequest<T>
A layout request is a signal to a virtualized container to tell its viewport to compute the layout. Every virtualized container has such mechanism, but most of the time the request is a simple boolean flag.
In the case of the table, however, the request is a class because we want to optimize the layout computation as much
as possible in both ColumnsLayoutMode.
We may want to do such optimizations mainly in two cases:
-
In
ColumnsLayoutMode.FIXEDif the table becomes bigger than all the columns' widths summed, then we want the last column to take all the available space. In such case, we want to lay out just the last column, and all the cells related to it, no need to re-size and re-position everything. -
The same logic applies to
ColumnsLayoutMode.VARIABLEfor the last column as well as for any other column. If a column, say in the middle, changes its size, then we want to re-compute the layout only from the column that changed to the end. And this is a great optimization indeed!
Also, this class can also be used as a callback, because you can query the wasDone() flag to check
whether the request lead to layout computation or not (there may be conditions that prevent it!)
Since we are using a class in this case, there are two special values to avoid creating objects every time:
-
NULLis used as both the initial value and the 'reset' value. The default table's skin sets the request property to this special value as soon as the layout methods complete their work. Also, this way we avoid potentialNullPointerExceptions. -
EMPTYis simply used to request a full layout. Statistically speaking, there are going to be many more cases when we want to perform a full layout than a partial one. After all, a partial layout is possible pretty much only in the above-mentioned cases.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ViewportLayoutRequeststatic final ViewportLayoutRequest -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionVFXTableColumn<T, ?> column()booleanbooleanisValid()protected ViewportLayoutRequest<T> setWasDone(boolean wasDone) booleanwasDone()
-
Field Details
-
NULL
-
EMPTY
-
-
Constructor Details
-
ViewportLayoutRequest
-
-
Method Details
-
isValid
public boolean isValid()- Returns:
- whether this instance is not equal to the special object
NULL.
-
isPartial
public boolean isPartial()- Returns:
- whether the column instance passed to this request is not
null.
-
column
- Returns:
- the column's instance that will serve as an indicator for a partial layout computation
-
wasDone
public boolean wasDone()- Returns:
- whether it was possible to fulfill the layout request
-
setWasDone
-