/// <summary>
 /// Initializes a new instance of the <see cref="ReadOnlyBlockListInner{IIndex}"/> class.
 /// </summary>
 /// <param name="owner">Parent containing the inner.</param>
 /// <param name="propertyName">Property name of the inner in <paramref name="owner"/>.</param>
 public ReadOnlyBlockListInner(IReadOnlyNodeState owner, string propertyName)
     : base(owner, propertyName)
 {
     BlockType       = NodeTreeHelperBlockList.BlockListBlockType(Owner.Node, PropertyName);
     _BlockStateList = CreateBlockStateList();
     BlockStateList  = _BlockStateList.ToReadOnly();
 }
        /// <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);
        }
        private protected virtual void AddBlockNodeTypes(FrameTemplateDictionary dictionary, Type nodeType)
        {
            IList <string> Properties = NodeTreeHelper.EnumChildNodeProperties(nodeType);

            foreach (string PropertyName in Properties)
            {
                if (NodeTreeHelperBlockList.IsBlockListProperty(nodeType, PropertyName, /*out Type ChildInterfaceType,*/ out Type ChildItemType))
                {
                    Type BlockListType = NodeTreeHelperBlockList.BlockListBlockType(nodeType, PropertyName);

                    if (!dictionary.ContainsKey(BlockListType))
                    {
                        dictionary.Add(BlockListType, null);
                    }
                }
            }
        }
示例#4
0
        /// <summary>
        /// Gets the frame that creates cells associated to states in the inner.
        /// This overload uses selectors to choose the correct frame.
        /// </summary>
        /// <param name="inner">The inner.</param>
        /// <param name="selectorStack">A list of selectors to choose the correct frame.</param>
        public virtual IFocusFrame InnerToFrame(IFocusInner <IFocusBrowsingChildIndex> inner, IList <IFocusFrameSelectorList> selectorStack)
        {
            IFocusNodeState    Owner         = inner.Owner;
            Type               OwnerType     = Owner.Node.GetType();
            Type               InterfaceType = NodeTreeHelper.NodeTypeToInterfaceType(OwnerType);
            IFocusNodeTemplate Template      = (IFocusNodeTemplate)NodeTypeToTemplate(InterfaceType);
            IFocusFrame        Frame         = Template.PropertyToFrame(inner.PropertyName, selectorStack);

            if (Frame is IFocusBlockListFrame AsBlockListFrame)
            {
                IFocusBlockListInner <IFocusBrowsingBlockNodeIndex> BlockListInner = inner as IFocusBlockListInner <IFocusBrowsingBlockNodeIndex>;
                Debug.Assert(BlockListInner != null);

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

                Frame = (IFocusFrame)BlockTemplate.GetPlaceholderFrame();
            }

            return(Frame);
        }