예제 #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);
        }
        bool IDictionary <IFrameBlockState, IFrameBlockStateView> .TryGetValue(IFrameBlockState key, out IFrameBlockStateView value)
        {
            bool Result = TryGetValue((IFocusBlockState)key, out IFocusBlockStateView Value);

            value = Value;
            return(Result);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FrameBlockStateView"/> class.
        /// </summary>
        /// <param name="controllerView">The controller view to which this object belongs.</param>
        /// <param name="blockState">The block state.</param>
        public FrameBlockStateView(FrameControllerView controllerView, IFrameBlockState blockState)
            : base(controllerView, blockState)
        {
            Type BlockType = BlockState.ParentInner.BlockType;

            Template = ControllerView.TemplateSet.BlockTypeToTemplate(BlockType);
        }
        /// <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);
        }
 int IList <IFrameBlockState> .IndexOf(IFrameBlockState value)
 {
     return(IndexOf((IFocusBlockState)value));
 }
예제 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 public FrameBlockStateView(IFrameControllerView controllerView, IFrameBlockState blockState)
     : base(controllerView, blockState)
 {
 }
 void IDictionary <IFrameBlockState, IFrameBlockStateView> .Add(IFrameBlockState key, IFrameBlockStateView value)
 {
     Add((IFocusBlockState)key, (IFocusBlockStateView)value);
 }
예제 #8
0
        private protected override IFrameCellView BuildBlockCellsForPlaceholderFrame(IFrameCellViewTreeContext context, IFramePlaceholderFrame frame, IFrameCellViewCollection embeddingCellView, IFrameBlockState blockState)
        {
            Type   OldSelectorType = null;
            string OldSelectorName = null;

            ((IFocusCellViewTreeContext)context).AddOrReplaceSelectors(((IFocusPlaceholderFrame)frame).Selectors, out OldSelectorType, out OldSelectorName);

            IFrameCellView ItemCellView = base.BuildBlockCellsForPlaceholderFrame(context, frame, embeddingCellView, blockState);

            bool HasVisibleCellView = ItemCellView.HasVisibleCellView;

            Debug.Assert(((IFocusCellViewTreeContext)context).IsVisible || !HasVisibleCellView);

            ((IFocusCellViewTreeContext)context).RemoveOrRestoreSelectors(((IFocusPlaceholderFrame)frame).Selectors, OldSelectorType, OldSelectorName);

            return(ItemCellView);
        }
 bool ICollection <IFrameBlockState> .Contains(IFrameBlockState value)
 {
     return(Contains((IFocusBlockState)value));
 }
예제 #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FramePatternState{IInner}"/> class.
 /// </summary>
 /// <param name="parentBlockState">The parent block state.</param>
 /// <param name="index">The index used to create the state.</param>
 public FramePatternState(IFrameBlockState parentBlockState, IFrameBrowsingPatternIndex index)
     : base(parentBlockState, index)
 {
 }
 bool IFrameBlockStateReadOnlyList.Contains(IFrameBlockState value)
 {
     return(Contains((ILayoutBlockState)value));
 }
 int IFrameBlockStateReadOnlyList.IndexOf(IFrameBlockState value)
 {
     return(IndexOf((ILayoutBlockState)value));
 }
 bool IDictionary <IFrameBlockState, IFrameBlockStateView> .Remove(IFrameBlockState key)
 {
     return(Remove((IFocusBlockState)key));
 }
 bool IDictionary <IFrameBlockState, IFrameBlockStateView> .ContainsKey(IFrameBlockState key)
 {
     return(ContainsKey((IFocusBlockState)key));
 }
예제 #15
0
 void IList <IFrameBlockState> .Insert(int index, IFrameBlockState item)
 {
     Insert(index, (IFocusBlockState)item);
 }
예제 #16
0
 void ICollection <IFrameBlockState> .Add(IFrameBlockState item)
 {
     Add((IFocusBlockState)item);
 }
예제 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameBlockStateView"/> class.
 /// </summary>
 /// <param name="controllerView">The controller view to which this object belongs.</param>
 /// <param name="blockState">The block state.</param>
 /// <param name="template">The frame template.</param>
 protected FrameBlockStateView(FrameControllerView controllerView, IFrameBlockState blockState, IFrameTemplate template)
     : base(controllerView, blockState)
 {
     Template = template;
 }
예제 #18
0
 bool ICollection <IFrameBlockState> .Remove(IFrameBlockState item)
 {
     return(Remove((IFocusBlockState)item));
 }
 void IList <IFrameBlockState> .Insert(int index, IFrameBlockState item)
 {
     Insert(index, (ILayoutBlockState)item);
 }
예제 #20
0
        private protected virtual IFrameCellView BuildBlockCellsForPlaceholderFrame(IFrameCellViewTreeContext context, IFramePlaceholderFrame frame, IFrameCellViewCollection embeddingCellView, IFrameBlockState blockState)
        {
            IFrameCellView ItemCellView = null;
            bool           IsHandled    = false;

            if (frame.PropertyName == nameof(IBlock.ReplicationPattern))
            {
                ItemCellView = BuildPlaceholderCells(context, embeddingCellView, blockState.PatternState, frame);
                IsHandled    = true;
            }
            else if (frame.PropertyName == nameof(IBlock.SourceIdentifier))
            {
                ItemCellView = BuildPlaceholderCells(context, embeddingCellView, blockState.SourceState, frame);
                IsHandled    = true;
            }

            Debug.Assert(IsHandled);

            return(ItemCellView);
        }
 void ICollection <IFrameBlockState> .Add(IFrameBlockState item)
 {
     Add((ILayoutBlockState)item);
 }
예제 #22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FrameSourceState{IInner}"/> class.
 /// </summary>
 /// <param name="parentBlockState">The parent block state.</param>
 /// <param name="index">The index used to create the state.</param>
 public FrameSourceState(IFrameBlockState parentBlockState, IFrameBrowsingSourceIndex index)
     : base(parentBlockState, index)
 {
 }
 IFrameBlockStateView IDictionary <IFrameBlockState, IFrameBlockStateView> .this[IFrameBlockState key] {
     get { return(this[(IFocusBlockState)key]); } set { this[(IFocusBlockState)key] = (IFocusBlockStateView)value; }
 }