/// <summary> /// Initializes a new instance of the <see cref="FrameBlockCellView"/> class. /// </summary> /// <param name="stateView">The state view containing the tree with this cell.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> /// <param name="blockStateView">The block state view of the state associated to this cell.</param> public FrameBlockCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameBlockStateView blockStateView) : base(stateView, parentCellView) { Debug.Assert(blockStateView.RootCellView != null); BlockStateView = blockStateView; }
/// <summary> /// Create cells for the provided state view. /// </summary> /// <param name="context">Context used to build the cell view tree.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> public virtual IFrameCellView BuildBlockCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView) { FrameBlockStateView BlockStateView = context.BlockStateView; IFrameBlockState BlockState = BlockStateView.BlockState; FrameCellViewList CellViewList = CreateCellViewList(); IFrameCellViewCollection EmbeddingCellView = CreateEmbeddingCellView(context.StateView, parentCellView, CellViewList); ValidateEmbeddingCellView(context, EmbeddingCellView); IFrameCellView ItemCellView = null; foreach (IFrameFrame Item in Items) { bool IsHandled = false; if (Item is IFrameBlockFrame AsBlockFrame) { ItemCellView = AsBlockFrame.BuildBlockCells(context, EmbeddingCellView); IsHandled = true; } else if (Item is FramePlaceholderFrame AsPlaceholderFrame) { ItemCellView = BuildBlockCellsForPlaceholderFrame(context, AsPlaceholderFrame, EmbeddingCellView, BlockState); IsHandled = true; } Debug.Assert(IsHandled); CellViewList.Add(ItemCellView); } return(EmbeddingCellView); }
private protected virtual bool IsRootCellViewEqual(CompareEqual comparer, FrameBlockStateView other) { if (!comparer.IsTrue((RootCellView == null && other.RootCellView == null) || (RootCellView != null && other.RootCellView != null))) { return(comparer.Failed()); } if (RootCellView != null) { if (!comparer.VerifyEqual(RootCellView, other.RootCellView)) { return(comparer.Failed()); } } return(true); }
/// <summary> /// Create cells for the provided state view. /// </summary> /// <param name="context">Context used to build the cell view tree.</param> /// <param name="parentCellView">The collection of cell views containing this view. Null for the root of the cell tree.</param> public virtual IFrameCellView BuildBlockCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView) { FrameBlockStateView BlockStateView = context.BlockStateView; IFrameBlockState BlockState = BlockStateView.BlockState; Debug.Assert(BlockState != null); IFrameBlockTemplate BlockTemplate = ParentTemplate as IFrameBlockTemplate; Debug.Assert(BlockTemplate != null); FrameNodeStateViewDictionary StateViewTable = context.ControllerView.StateViewTable; FrameCellViewList CellViewList = CreateCellViewList(); IFrameCellViewCollection EmbeddingCellView = CreateEmbeddingCellView(context.StateView, parentCellView, CellViewList); ValidateEmbeddingCellView(context, EmbeddingCellView); foreach (IFrameNodeState ChildState in BlockState.StateList) { Debug.Assert(StateViewTable.ContainsKey(ChildState)); IFrameNodeStateView StateView = context.StateView; IFrameNodeStateView ChildStateView = (IFrameNodeStateView)StateViewTable[ChildState]; Debug.Assert(ChildStateView.RootCellView == null); context.SetChildStateView(ChildStateView); ChildStateView.BuildRootCellView(context); context.RestoreParentStateView(StateView); Debug.Assert(ChildStateView.RootCellView != null); IFrameContainerCellView FrameCellView = CreateFrameCellView(context.StateView, EmbeddingCellView, ChildStateView); ValidateContainerCellView(context.StateView, EmbeddingCellView, ChildStateView, FrameCellView); ChildStateView.SetContainerCellView(FrameCellView); CellViewList.Add(FrameCellView); } AssignEmbeddingCellView(BlockStateView, EmbeddingCellView); return(EmbeddingCellView); }
/// <summary> /// Create cells for the provided state view. /// </summary> /// <param name="context">Context used to build the cell view tree.</param> /// <param name="parentCellView">The parent cell view.</param> public virtual IFrameCellView BuildNodeCells(IFrameCellViewTreeContext context, IFrameCellViewCollection parentCellView) { IFrameNodeState State = context.StateView.State; Debug.Assert(State != null); Debug.Assert(State.InnerTable != null); Debug.Assert(State.InnerTable.ContainsKey(PropertyName)); IFrameBlockListInner <IFrameBrowsingBlockNodeIndex> Inner = State.InnerTable[PropertyName] as IFrameBlockListInner <IFrameBrowsingBlockNodeIndex>; Debug.Assert(Inner != null); FrameBlockStateViewDictionary BlockStateViewTable = context.ControllerView.BlockStateViewTable; FrameCellViewList CellViewList = CreateCellViewList(); IFrameCellViewCollection EmbeddingCellView = CreateEmbeddingCellView(context.StateView, parentCellView, CellViewList); ValidateEmbeddingCellView(context, EmbeddingCellView); Type BlockType = Inner.BlockType; IFrameTemplateSet TemplateSet = context.ControllerView.TemplateSet; IFrameBlockTemplate BlockTemplate = TemplateSet.BlockTypeToTemplate(BlockType); foreach (IFrameBlockState BlockState in Inner.BlockStateList) { Debug.Assert(context.ControllerView.BlockStateViewTable.ContainsKey(BlockState)); FrameBlockStateView BlockStateView = (FrameBlockStateView)context.ControllerView.BlockStateViewTable[BlockState]; context.SetBlockStateView(BlockStateView); BlockStateView.BuildRootCellView(context); IFrameBlockCellView BlockCellView = CreateBlockCellView(context.StateView, EmbeddingCellView, BlockStateView); ValidateBlockCellView(context.StateView, EmbeddingCellView, BlockStateView, BlockCellView); CellViewList.Add(BlockCellView); } AssignEmbeddingCellView(context.StateView, EmbeddingCellView); return(EmbeddingCellView); }
private protected virtual void ValidateBlockCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameBlockStateView blockStateView, IFrameBlockCellView blockCellView) { Debug.Assert(blockCellView.StateView == stateView); Debug.Assert(blockCellView.ParentCellView == parentCellView); Debug.Assert(blockCellView.BlockStateView == blockStateView); }
/// <summary> /// Creates a IxxxBlockCellView object. /// </summary> private protected virtual IFrameBlockCellView CreateBlockCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameBlockStateView blockStateView) { ControllerTools.AssertNoOverride(this, Type.FromTypeof <FrameBlockListFrame>()); return(new FrameBlockCellView(stateView, parentCellView, blockStateView)); }
private protected virtual void AssignEmbeddingCellView(FrameBlockStateView blockStateView, IFrameCellViewCollection embeddingCellView) { blockStateView.AssignEmbeddingCellView(embeddingCellView); }
/// <summary> /// Changes the block state view. /// </summary> /// <param name="blockStateView">The new block state view.</param> public void SetBlockStateView(FrameBlockStateView blockStateView) { BlockStateView = blockStateView; }