public override object GetAt(int index) { object retval = null; GroupGeneratorNode parentGroup = this.Parent as GroupGeneratorNode; if ((parentGroup != null) && (parentGroup.IsExpanded == false)) { retval = this.ComputeCollapsedGetAt(index); } else { retval = base.GetAt(index); } if (parentGroup != null) { retval = new GroupHeaderFooterItem(parentGroup.CollectionViewGroup, retval); } return(retval); }
void IDataGridContextVisitor.Visit(DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit) { switch (m_status) { case SaveRestoreStateVisitorStatus.Saving: { this.SavingVisit(sourceContext, groupHeaderFooter); break; } case SaveRestoreStateVisitorStatus.Restoring: { this.RestoringVisit(sourceContext, groupHeaderFooter); break; } default: { throw new InvalidOperationException("An attempt was made to visit using a method other than the SaveRestoreStateVisitor's Save and Restore methods."); } } }
public override int IndexOf(object item) { int retval = -1; if (item != null) { GroupGeneratorNode parentGroup = this.Parent as GroupGeneratorNode; //if the node is the child of a GroupGeneratorNode (then its a GroupHeader or GroupFooter). if (parentGroup != null) { //Debug.Assert( ( item.GetType() == typeof( GroupHeaderFooterItem ) ), "item must be a GroupHeaderFooterItem for HeadersFootersGeneratorNode whose parent is a GroupGeneratorNode" ); if (item.GetType() == typeof(GroupHeaderFooterItem)) { //only process further is the ParentGroup match the requested group. GroupHeaderFooterItem ghf = ( GroupHeaderFooterItem )item; if (ghf.Group == parentGroup.CollectionViewGroup) { retval = this.IndexOfHelper(parentGroup, ghf.Template); } } else { retval = this.IndexOfHelper(parentGroup, item); } } else { //if there is no parent group (or no parent at all), then process the item directly! retval = this.IndexOfHelper(parentGroup, item); } } return(retval); }
public void Visit( DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit ) { throw new NotSupportedException( "The RangeSelectionVisitor is only capable of handling data items block." ); }
protected virtual void RestoringVisit(DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter) { throw new NotImplementedException(); }
public void Visit( DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit ) { throw new NotSupportedException(); }
public static bool Equals( GroupHeaderFooterItem item1, GroupHeaderFooterItem item2 ) { return ( ( item1.m_template == item2.m_template ) && ( item1.Group == item2.Group ) ); }
public void Visit(DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit) { throw new NotSupportedException("The RangeSelectionVisitor is only capable of handling data items block."); }
public bool Equals(GroupHeaderFooterItem item) { return(GroupHeaderFooterItem.Equals(this, item)); }
void IDataGridContextVisitor.Visit( DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit ) { switch( m_status ) { case SaveRestoreStateVisitorStatus.Saving: { this.SavingVisit( sourceContext, groupHeaderFooter ); break; } case SaveRestoreStateVisitorStatus.Restoring: { this.RestoringVisit( sourceContext, groupHeaderFooter ); break; } default: { throw new InvalidOperationException( "An attempt was made to visit using a method other than the SaveRestoreStateVisitor's Save and Restore methods." ); } } }
protected virtual void RestoringVisit( DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter ) { throw new NotImplementedException(); }
public void Visit(DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit) { throw new NotSupportedException(); }
public bool Equals( GroupHeaderFooterItem item ) { return GroupHeaderFooterItem.Equals( this, item ); }
//This method cannot be used for groups. //This method will search for items independently of the Expanded/Collpased status of GroupGeneratorNodes public bool Contains(object item) { bool skipCollectionGeneratorNodeCheck = false; do { HeadersFootersGeneratorNode headersFootersNode = m_currentNode as HeadersFootersGeneratorNode; skipCollectionGeneratorNodeCheck = false; //If the node is a HeadersFootersGeneratorNode, do some specific handling. if (headersFootersNode != null) { //If the item passed to the function is a GroupHeaderFooterItem, then its because we are looking for a GroupHeader/Footer if (item.GetType() == typeof(GroupHeaderFooterItem)) { GroupHeaderFooterItem groupHeaderFooterItem = ( GroupHeaderFooterItem )item; //Determine the parent node/collectionViewGroup GroupGeneratorNode parentGroup = headersFootersNode.Parent as GroupGeneratorNode; if (parentGroup != null) { if (groupHeaderFooterItem.Group == parentGroup.CollectionViewGroup) { if (headersFootersNode.Items.Contains(groupHeaderFooterItem.Template)) { return(true); } } } //If there is no parent node, then its because the current HeadersFootersGeneratorNode is not a GroupHeaders/Footers node (FixedHeaders/Fotoers or Headers/Footers). skipCollectionGeneratorNodeCheck = true; //force skip CollectionGeneratorNode verification, this is to limit amount of job done by loop body. } //If the item passed is not a GroupHeaderFooterItem, not need to do specific processing, reverting to "Common" algo. } if (!skipCollectionGeneratorNodeCheck) { CollectionGeneratorNode collectionNode = m_currentNode as CollectionGeneratorNode; if (collectionNode != null) { // When dealing with a DataView, the DataView's IList's Contains implementation will return false // for a dataRowView which is in edition and was modified even though it is really part of the collection. // Therefore, we must use a for loop of Object.Equals method calls. System.Data.DataRowView dataRowViewItem = item as System.Data.DataRowView; if (dataRowViewItem != null) { IList items = collectionNode.Items; int itemsCount = items.Count; System.Data.DataRow itemDataRow = dataRowViewItem.Row; for (int i = 0; i < itemsCount; i++) { System.Data.DataRowView currentDataRowView = items[i] as System.Data.DataRowView; if ((currentDataRowView != null) && (itemDataRow == currentDataRowView.Row)) { return(true); } } } else { //Since the GetAt() methods can be overriden to compensate for the Expand/Collapse status of Groups // AND the details features, accessing the collection directly prevent pre-processing of the content of the collection node. if (collectionNode.Items.Contains(item)) { //if the item is from a detail, then I don't want to "use" it!!! return(true); } } } } //if we reach this point, it's because the item we are looking //for is not in this node... Try to access the child //Note: Since I want to search independently of the Expand/Collapse status, //pass false to the method to systematically visit childs. if (this.MoveToChild(false)) { continue; } //if we reach this point, it's because we have no child... if (this.MoveToNext()) { continue; } //final try, try "advancing" to the next item. if (this.MoveToFollowing()) { continue; } //up to this, we are in an endpoint, we failed. break; } while(true); return(false); }
public static bool Equals(GroupHeaderFooterItem item1, GroupHeaderFooterItem item2) { return((item1.m_template == item2.m_template) && (item1.Group == item2.Group)); }
public void Visit(DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit) { throw new NotSupportedException("Only DataGridContexts can be visited by this visitor."); }
public static bool operator !=(GroupHeaderFooterItem item1, GroupHeaderFooterItem item2) { return(!GroupHeaderFooterItem.Equals(item1, item2)); }
public void Visit( DataGridContext sourceContext, GroupHeaderFooterItem groupHeaderFooter, ref bool stopVisit ) { throw new NotSupportedException( "Only DataGridContexts can be visited by this visitor." ); }
public override object GetAt( int index ) { object retval = null; GroupGeneratorNode parentGroup = this.Parent as GroupGeneratorNode; if( ( parentGroup != null ) && ( parentGroup.IsExpanded == false ) ) { retval = this.ComputeCollapsedGetAt( index ); } else { retval = base.GetAt( index ); } if( parentGroup != null ) { retval = new GroupHeaderFooterItem( parentGroup.CollectionViewGroup, retval ); } return retval; }