コード例 #1
0
        /// <summary>
        /// Gets the frame that creates cells associated to states in the inner.
        /// </summary>
        /// <param name="inner">The inner.</param>
        public virtual IFrameFrame InnerToFrame(IFrameInner <IFrameBrowsingChildIndex> inner)
        {
            // Call overloads of this method if they exist.
            ControllerTools.AssertNoOverride(this, Type.FromTypeof <FrameTemplateSet>());

            IFrameNodeState Owner     = inner.Owner;
            Type            OwnerType = Type.FromGetType(Owner.Node);

            //Type InterfaceType = NodeTreeHelper.NodeTypeToInterfaceType(OwnerType);
            //IFrameNodeTemplate Template = NodeTypeToTemplate(InterfaceType);
            IFrameNodeTemplate Template = NodeTypeToTemplate(OwnerType);

            IFrameFrame Frame = Template.PropertyToFrame(inner.PropertyName);

            if (Frame is IFrameBlockListFrame AsBlockListFrame)
            {
                IFrameBlockListInner <IFrameBrowsingBlockNodeIndex> BlockListInner = inner as IFrameBlockListInner <IFrameBrowsingBlockNodeIndex>;
                Debug.Assert(BlockListInner != null);

                Type BlockType = NodeTreeHelperBlockList.BlockListBlockType(Owner.Node, BlockListInner.PropertyName);
                IFrameBlockTemplate BlockTemplate = BlockTypeToTemplate(BlockType);

                Frame = BlockTemplate.GetPlaceholderFrame();
            }

            return(Frame);
        }
コード例 #2
0
        /// <summary>
        /// Builds the cell view tree for this view.
        /// </summary>
        /// <param name="context">Context used to build the cell view tree.</param>
        public virtual void BuildRootCellView(IFrameCellViewTreeContext context)
        {
            Debug.Assert(context.BlockStateView == this);

            IFrameBlockTemplate BlockTemplate = Template as IFrameBlockTemplate;

            Debug.Assert(BlockTemplate != null);

            SetRootCellView(BlockTemplate.BuildBlockCells(context, null));

            Debug.Assert(EmbeddingCellView != null);
        }
コード例 #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)
        {
            IFrameBlockStateView BlockStateView = context.BlockStateView;
            IFrameBlockState     BlockState     = BlockStateView.BlockState;

            Debug.Assert(BlockState != null);

            IFrameBlockTemplate BlockTemplate = ParentTemplate as IFrameBlockTemplate;

            Debug.Assert(BlockTemplate != null);

            IFrameStateViewDictionary StateViewTable    = context.ControllerView.StateViewTable;
            IFrameCellViewList        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 = 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);
        }