示例#1
0
        /// <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);
        }
示例#2
0
        /// <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));

            IFrameListInner <IFrameBrowsingListNodeIndex> Inner = State.InnerTable[PropertyName] as IFrameListInner <IFrameBrowsingListNodeIndex>;

            Debug.Assert(Inner != null);

            FrameNodeStateViewDictionary StateViewTable    = context.ControllerView.StateViewTable;
            FrameCellViewList            CellViewList      = CreateCellViewList();
            IFrameCellViewCollection     EmbeddingCellView = CreateEmbeddingCellView(context.StateView, parentCellView, CellViewList);

            ValidateEmbeddingCellView(context, EmbeddingCellView);

            foreach (IFrameNodeState ChildState in Inner.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(context.StateView, EmbeddingCellView);

            return(EmbeddingCellView);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
        /// <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)
        {
            FrameCellViewList        CellViewList      = CreateCellViewList();
            IFrameCellViewCollection EmbeddingCellView = CreateEmbeddingCellView(context.StateView, parentCellView, CellViewList);

            ValidateEmbeddingCellView(context, EmbeddingCellView);

            foreach (IFrameFrame Item in Items)
            {
                IFrameNodeFrame NodeFrame = Item as IFrameNodeFrame;
                Debug.Assert(NodeFrame != null);

                IFrameCellView ItemCellView = NodeFrame.BuildNodeCells(context, EmbeddingCellView);

                // Only add cell views that are not empty and that are not empty collections.
                if (!(ItemCellView is IFrameEmptyCellView) && !(ItemCellView is IFrameCellViewCollection AsCollection && AsCollection.CellViewList.Count == 0 && !AsCollection.IsAssignedToTable))
                {
                    CellViewList.Add(ItemCellView);
                }
            }

            return(EmbeddingCellView);
        }
示例#6
0
 /// <summary>
 /// Creates a IxxxCellViewCollection object.
 /// </summary>
 private protected override IFrameCellViewCollection CreateEmbeddingCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameCellViewList list)
 {
     ControllerTools.AssertNoOverride(this, Type.FromTypeof <FrameHorizontalPanelFrame>());
     return(new FrameLine(stateView, parentCellView, list, this));
 }
示例#7
0
 /// <summary>
 /// Creates a IxxxCellViewCollection object.
 /// </summary>
 private protected override IFrameCellViewCollection CreateEmbeddingCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameCellViewList list)
 {
     ControllerTools.AssertNoOverride(this, Type.FromTypeof <FrameVerticalCollectionPlaceholderFrame>());
     return(new FrameColumn(stateView, parentCellView, list, this));
 }
示例#8
0
 /// <summary>
 /// Creates a IxxxCellViewCollection object.
 /// </summary>
 private protected abstract IFrameCellViewCollection CreateEmbeddingCellView(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameCellViewList list);
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameEmptyCellViewCollection"/> 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="cellViewList">The list of child cell views.</param>
 /// <param name="frame">The frame that was used to create this cell. Can be null.</param>
 public FrameEmptyCellViewCollection(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameCellViewList cellViewList, IFrameFrame frame)
     : base(stateView, parentCellView, cellViewList, frame)
 {
 }
示例#10
0
 /// <inheritdoc/>
 public FrameCellViewReadOnlyList(FrameCellViewList list)
     : base(list)
 {
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameCellViewCollection"/> 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="cellViewList">The list of child cell views.</param>
 /// <param name="frame">The frame that was used to create this cell. Can be null.</param>
 public FrameCellViewCollection(IFrameNodeStateView stateView, IFrameCellViewCollection parentCellView, FrameCellViewList cellViewList, IFrameFrame frame)
     : base(stateView, parentCellView)
 {
     Frame        = frame;
     CellViewList = cellViewList;
 }