/// <summary> /// Expands an existing node. In the node: /// * All optional children are assigned if they aren't /// * If the node is a feature call, with no arguments, an empty argument is inserted. /// </summary> /// <param name="expandedIndex">Index of the expanded node.</param> /// <param name="isChanged">True upon return if the node was changed. False if the node was already expanded.</param> public virtual void Expand(IWriteableNodeIndex expandedIndex, out bool isChanged) { Contract.RequireNotNull(expandedIndex, out IWriteableNodeIndex ExpandedIndex); Debug.Assert(StateTable.ContainsKey(ExpandedIndex)); Debug.Assert(StateTable[ExpandedIndex] is IWriteablePlaceholderNodeState); WriteableOperationList OperationList = CreateOperationList(); DebugObjects.AddReference(OperationList); Expand(ExpandedIndex, OperationList); if (OperationList.Count > 0) { WriteableOperationReadOnlyList OperationReadOnlyList = OperationList.ToReadOnly(); WriteableOperationGroup OperationGroup = CreateOperationGroup(OperationReadOnlyList, null); SetLastOperation(OperationGroup); CheckInvariant(); isChanged = true; } else { isChanged = false; } }
private protected virtual ReadOnlyInnerReadOnlyDictionary <string> BuildInnerTable(ReadOnlyBrowseContext browseContext) { IReadOnlyNodeState State = browseContext.State; Debug.Assert(State.InnerTable == null); ReadOnlyIndexCollectionReadOnlyList IndexCollectionList = browseContext.IndexCollectionList; ReadOnlyInnerDictionary <string> InnerTable = CreateInnerTable(); foreach (IReadOnlyIndexCollection NodeIndexCollection in IndexCollectionList) { string PropertyName = NodeIndexCollection.PropertyName; Debug.Assert(!InnerTable.ContainsKey(PropertyName)); IReadOnlyInner Inner = BuildInner(State, NodeIndexCollection); InnerTable.Add(PropertyName, Inner); } if (InnerTable.Count > 0) { DebugObjects.AddReference(InnerTable); } return(InnerTable.ToReadOnly()); }
/// <summary> /// Initializes a new instance of the <see cref="WriteableController"/> class. /// </summary> private protected WriteableController() { _OperationStack = CreateOperationGroupStack(); DebugObjects.AddReference(_OperationStack); OperationStack = _OperationStack.ToReadOnly(); RedoIndex = 0; }
/// <summary> /// Returns a list of states for all child nodes. /// </summary> public IReadOnlyNodeStateReadOnlyList GetAllChildren() { IReadOnlyNodeStateList StateList = CreateNodeStateList(); AddChildStates(StateList, this); DebugObjects.AddReference(StateList); return(StateList.ToReadOnly()); }
/// <summary> /// Checks if the tree of cell views under this state is valid. /// </summary> public virtual bool IsCellViewTreeValid() { bool IsValid = true; IsValid &= RootCellView != null; if (IsValid && !(RootCellView is IFrameEmptyCellView)) { FrameAssignableCellViewDictionary <string> ActualCellViewTable = CreateCellViewTable(); IsValid &= RootCellView.IsCellViewTreeValid(CellViewTable, ActualCellViewTable); IsValid &= AllCellViewsProperlyAssigned(CellViewTable, ActualCellViewTable); DebugObjects.AddReference(ActualCellViewTable); } return(IsValid); }
private protected virtual void UpdateFocusChain(IFocusNodeState state, Node focusedNode, IFocusFrame focusedFrame) { FocusFocusList NewFocusChain = CreateFocusChain(); IFocusNodeState RootState = Controller.RootState; IFocusNodeStateView RootStateView = (IFocusNodeStateView)StateViewTable[RootState]; IFocusFocus MatchingFocus = null; RootStateView.UpdateFocusChain(NewFocusChain, focusedNode, focusedFrame, ref MatchingFocus); // Ensured by all templates having at least one preferred (hence focusable) frame. Debug.Assert(NewFocusChain.Count > 0); // First run, initialize the focus to the first focusable cell. if (Focus == null) { Debug.Assert(FocusChain == null); Focus = NewFocusChain[0]; ResetCaretPosition(0, true); } else if (MatchingFocus != null) { Focus = MatchingFocus; UpdateMaxCaretPosition(); // The focus didn't change, but the content may have. } else { RecoverFocus(state, NewFocusChain); // The focus has forcibly changed. } FocusChain = NewFocusChain; DebugObjects.AddReference(NewFocusChain); Debug.Assert(Focus != null); Debug.Assert(FocusChain.Contains(Focus)); SelectionAnchor = Focus.CellView.StateView; SelectionExtension = 0; }
public void DebugGetStateList() { DebugObjects.AddReference(_StateList); }
public void DebugGetStateTable() { DebugObjects.AddReference(_StateTable); }