Exemplo n.º 1
0
        /// <summary>
        /// Checks if the <paramref name="blockStateView"/> block state belongs to a replicated block.
        /// </summary>
        /// <param name="blockStateView">The block state view.</param>
        public virtual bool IsInReplicatedBlock(FocusBlockStateView blockStateView)
        {
            IFocusBlockState BlockState = blockStateView.BlockState;

            Debug.Assert(BlockState != null);

            return(BlockState.ChildBlock.Replication == BaseNode.ReplicationStatus.Replicated);
        }
        private protected virtual void GetChildrenStateView(IFocusNodeStateView stateView, List <IFocusNodeStateView> stateViewList)
        {
            stateViewList.Add(stateView);

            foreach (string Key in stateView.State.InnerTable.Keys)
            {
                IFocusInner Value = (IFocusInner)stateView.State.InnerTable[Key];

                bool           IsHandled = false;
                IFocusTemplate Template;
                FocusAssignableCellViewReadOnlyDictionary <string> CellViewTable;
                IFocusCellViewCollection EmbeddingCellView;

                if (Value is IFocusPlaceholderInner <IFocusBrowsingPlaceholderNodeIndex> AsPlaceholderInner)
                {
                    Debug.Assert(StateViewTable.ContainsKey(AsPlaceholderInner.ChildState));
                    IFocusNodeStateView ChildStateView = (IFocusNodeStateView)StateViewTable[AsPlaceholderInner.ChildState];
                    Debug.Assert(ChildStateView != null);

                    GetChildrenStateView(ChildStateView, stateViewList);

                    Template      = ChildStateView.Template;
                    CellViewTable = ChildStateView.CellViewTable;

                    IsHandled = true;
                }
                else if (Value is IFocusOptionalInner <IFocusBrowsingOptionalNodeIndex> AsOptionalInner)
                {
                    if (AsOptionalInner.IsAssigned)
                    {
                        Debug.Assert(StateViewTable.ContainsKey(AsOptionalInner.ChildState));
                        IFocusOptionalNodeStateView ChildStateView = StateViewTable[AsOptionalInner.ChildState] as IFocusOptionalNodeStateView;
                        Debug.Assert(ChildStateView != null);

                        GetChildrenStateView(ChildStateView, stateViewList);

                        Template      = ChildStateView.Template;
                        CellViewTable = ChildStateView.CellViewTable;
                    }

                    IsHandled = true;
                }
                else if (Value is IFocusListInner <IFocusBrowsingListNodeIndex> AsListInner)
                {
                    foreach (IFocusNodeState ChildState in AsListInner.StateList)
                    {
                        IFocusNodeStateView ChildStateView = (IFocusNodeStateView)StateViewTable[ChildState];
                        GetChildrenStateView(ChildStateView, stateViewList);

                        Template      = ChildStateView.Template;
                        CellViewTable = ChildStateView.CellViewTable;
                    }

                    IsHandled = true;
                }
                else if (Value is IFocusBlockListInner <IFocusBrowsingBlockNodeIndex> AsBlockListInner)
                {
                    foreach (IFocusBlockState BlockState in AsBlockListInner.BlockStateList)
                    {
                        IFocusNodeStateView PatternStateView = (IFocusNodeStateView)StateViewTable[BlockState.PatternState];
                        GetChildrenStateView(PatternStateView, stateViewList);
                        Template      = PatternStateView.Template;
                        CellViewTable = PatternStateView.CellViewTable;

                        IFocusNodeStateView SourceStateView = (IFocusNodeStateView)StateViewTable[BlockState.SourceState];
                        GetChildrenStateView(SourceStateView, stateViewList);
                        Template      = SourceStateView.Template;
                        CellViewTable = SourceStateView.CellViewTable;

                        FocusBlockStateView BlockStateView = (FocusBlockStateView)BlockStateViewTable[BlockState];
                        Template          = BlockStateView.Template;
                        EmbeddingCellView = BlockStateView.EmbeddingCellView;

                        foreach (IFocusNodeState ChildState in BlockState.StateList)
                        {
                            IFocusNodeStateView ChildStateView = (IFocusNodeStateView)StateViewTable[ChildState];
                            GetChildrenStateView(ChildStateView, stateViewList);

                            Template      = ChildStateView.Template;
                            CellViewTable = ChildStateView.CellViewTable;
                        }
                    }

                    IsHandled = true;
                }

                Debug.Assert(IsHandled);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="FocusBlockCellView"/> 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.</param>
 /// <param name="blockStateView">The block state view of the state associated to this cell.</param>
 public FocusBlockCellView(IFocusNodeStateView stateView, IFocusCellViewCollection parentCellView, FocusBlockStateView blockStateView)
     : base(stateView, parentCellView, blockStateView)
 {
 }