src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/Provider/VirtualTree.cs
/// <summary>
///     Get the number of descendants of a given node
/// </summary>
/// <param name="absRow">The row coordinate</param>
/// <param name="column">The column coordinate</param>
/// <param name="includeSubItems">Whether to include any subitems in the item count.</param>
/// <param name="complexColumnRoot">row and column are the first node in a complex subitem column. Return the count of all items in the root list, not the expanded count for the first item.</param>
/// <returns>0 if the node is not expanded and there are no subitems</returns>
Get the number of descendants of a given node
Get the number of descendants of a given node
protected int GetDescendantItemCount(int absRow, int column, bool includeSubItems, bool complexColumnRoot)
        {
            TREENODE tn;
            if (absRow < 0)
            {
                if (column > 0)
                {
                    throw new ArgumentOutOfRangeException(
                        "column", VirtualTreeStrings.GetString(VirtualTreeStrings.ColumnOutOfRangeException));
                }
                tn = myRootNode;
            }
            else if (complexColumnRoot)
            {
                var pos = TrackCell(absRow, ref column);
                tn = pos.ParentNode;
                if (!tn.ComplexSubItem)
                {
                    throw new ArgumentException(VirtualTreeStrings.GetString(VirtualTreeStrings.ComplexColumnRootException));
                }
                Debug.Assert(column == 0); 
            }
            else
            {
                var pos = TrackCell(absRow, ref column);
                tn = pos.IsBlank(column) ? null : pos.ParentNode.GetChildNode(pos.Index);
                if (column > 0
                    && tn != null)
                {
                    var sn = tn.SubItemAtColumn(column);
                    tn = (sn == null) ? null : sn.RootNode;
                    Debug.Assert(tn == null || !tn.ComplexSubItem); 
                }
            }
            var retVal = 0;
            if (tn != null)
            {
                if (includeSubItems)
                {
                    retVal = tn.Expanded ? tn.TotalCount : tn.ImmedSubItemGain;
                }
                else if (tn.Expanded)
                {
                    retVal = tn.FullCount;
                }
            }
            return retVal;
        }
protected int GetDescendantItemCount ( int absRow , int column , bool includeSubItems , bool complexColumnRoot ) { TREENODE tn ; if ( absRow < 0 ) { if ( column > 0 ) { throw new ArgumentOutOfRangeException ( " " , VirtualTreeStrings . GetString ( VirtualTreeStrings . ColumnOutOfRangeException ) ) ; } tn = myRootNode ; } else if ( complexColumnRoot ) { var pos = TrackCell ( absRow , ref column ) ; tn = pos . ParentNode ; if ( ! tn . ComplexSubItem ) { throw new ArgumentException ( VirtualTreeStrings . GetString ( VirtualTreeStrings . ComplexColumnRootException ) ) ; } Debug . Assert ( column == 0 ) ; } else { var pos = TrackCell ( absRow , ref column ) ; tn = pos . IsBlank ( column ) ? null : pos . ParentNode . GetChildNode ( pos . Index ) ; if ( column > 0 && tn != null ) { var sn = tn . SubItemAtColumn ( column ) ; tn = ( sn == null ) ? null : sn . RootNode ; Debug . Assert ( tn == null || ! tn . ComplexSubItem ) ; } } var retVal = 0 ; if ( tn != null ) { if ( includeSubItems ) { retVal = tn . Expanded ? tn . TotalCount : tn . ImmedSubItemGain ; } else if ( tn . Expanded ) { retVal = tn . FullCount ; } } return retVal ; }
Get the number of descendants of a given node
Get the number of descendants of a given node
// Return all items // column resolved by TrackCell for a complex item // A complex subitem should track to column 0
0 if the node is not expanded and there are no subitems
0 if the node is not expanded and there are no subitems
absRow
int
The row coordinate
The row coordinate
column
int
The column coordinate
The column coordinate
includeSubItems
bool
Whether to include any subitems in the item count.
Whether to include any subitems in the item count .
complexColumnRoot
bool
row and column are the first node in a complex subitem column. Return the count of all items in the root list, not the expanded count for the first item.
row and column are the first node in a complex subitem column . Return the count of all items in the root list not the expanded count for the first item .