internal bool InsertAfter(GeneratorNode insert) { if (insert == null) { throw new DataGridInternalException("GeneratorNode is null."); } var insertionCount = default(int); var chainLength = default(int); var insertLast = GeneratorNodeHelper.EvaluateChain(insert, out insertionCount, out chainLength); var nextNode = m_state.Node.Next; if (nextNode != null) { nextNode.Previous = insertLast; } insertLast.Next = nextNode; insert.Previous = m_state.Node; m_state.Node.Next = insert; // Move the current node to the last node inserted if (!this.MoveToNextBy(chainLength)) { throw new DataGridInternalException("Unable to move to the requested generator index."); } return(true); }
public bool InsertAfter(GeneratorNode insert) { if (insert == null) { throw new DataGridInternalException(); } int insertionCount; int chainLength; GeneratorNode insertLast = GeneratorNodeHelper.EvaluateChain(insert, out insertionCount, out chainLength); if (m_currentNode.Next != null) { m_currentNode.Next.Previous = insertLast; } insertLast.Next = m_currentNode.Next; insert.Previous = m_currentNode; m_currentNode.Next = insert; // Move the current node to the last node inserted if (!this.MoveToNextBy(chainLength)) { throw new DataGridInternalException(); } return(true); }
internal bool InsertBefore(GeneratorNode insert) { if (insert == null) { throw new DataGridInternalException("GeneratorNode is null"); } var insertionCount = default(int); var chainLength = default(int); var insertLast = GeneratorNodeHelper.EvaluateChain(insert, out insertionCount, out chainLength); var previousNode = m_state.Node.Previous; if (previousNode != null) { previousNode.Next = insert; } insert.Previous = previousNode; m_state.Node.Previous = insertLast; insertLast.Next = m_state.Node; var parentGroup = insert.Parent as GroupGeneratorNode; if (parentGroup != null) { if (parentGroup.Child == m_state.Node) { parentGroup.Child = insert; } } // Move the current to the first item inserted. // No need to update the indexes since they will still be with the correct value. m_state.Node = insert; this.EnsureState(); return(true); }
public bool InsertBefore(GeneratorNode insert) { if (insert == null) { throw new DataGridInternalException(); } int insertionCount; int chainLength; GeneratorNode insertLast = GeneratorNodeHelper.EvaluateChain(insert, out insertionCount, out chainLength); GeneratorNode previous = m_currentNode.Previous; if (previous != null) { previous.Next = insert; } insert.Previous = previous; m_currentNode.Previous = insertLast; insertLast.Next = m_currentNode; GroupGeneratorNode parentGroup = insert.Parent as GroupGeneratorNode; if (parentGroup != null) { if (parentGroup.Child == m_currentNode) { parentGroup.Child = insert; } } // Move the current to the first item inserted. // No need to change m_index, m_sourceDataIndex since they will still be with the correct value. m_currentNode = insert; return(true); }