Specializes TreeListColumn to optimize sizing.
Max uses BestFit and BestWidth to try to intelligently assign column widths in a MaxTreeList. Primarily, to keep the hierarchy clear, we would like to avoid cutting off text in the first column. Unfortunately, performance is inadequate for large data sets. The base class recalculates the best width for each cell upon each call to BestFit. The base implementation further degrades performance by visiting every node in the data set to compute the max indent width for child nodes. The resulting time complexity for every call to BestFit is O(n^2), where n is the number of nodes.
To improve performance, we have applied a few optimizations. To begin, computing the best fit width is reduced to linear time complexity. Then, to avoid recomputing the best fit width unnecessarily, we hold on to the most recently computed value. The MaxTreeList responds to display changes and DataSource events to mark this value as dirty and the MaxTreeListColumn recompute it the next time the best fit width is needed.
Classes |
|
class | ComputeBestWidthOperation |
Based on DevExpress's
TreeListOperationColumnBestWidth but optimized to avoid that
operation's n-squared time complexity. |
|
Public Member Functions |
|
override void | BestFit () |
Overridden to improve performance by using
the BestWidth property. |
|
virtual void | UpdateBestWidth () |
Recompute the BestWidth for this column.
|
|
void | SetBestWidthDirty () |
Set the current BestWidth value as dirty.
|
|
Properties |
|
virtual int |
BestWidth [get] |
This column's optimal cell width: the
smallest possible width that adequately fits all node values and
the column header without truncation. |
override void MaxCustomControls::MaxTreeListColumn::BestFit | ( | ) | [inline] |
Overridden to improve performance by using the BestWidth property.
virtual void MaxCustomControls::MaxTreeListColumn::UpdateBestWidth | ( | ) | [inline, virtual] |
Recompute the BestWidth for this column.
The cost for this operation is linear in the number of nodes in the data set.
void MaxCustomControls::MaxTreeListColumn::SetBestWidthDirty | ( | ) | [inline] |
Set the current BestWidth value as dirty.
BestWidth will recompute the value the next time it is accessed.
virtual int
MaxCustomControls::MaxTreeListColumn::BestWidth
[get] |
This column's optimal cell width: the smallest possible width that adequately fits all node values and the column header without truncation.
If the current BestWidth has been set as dirty, it will be recomputed, otherwise, the most recently computed best fit width will be returned.