/// <summary> /// Checks if the template associated to the <paramref name="propertyName"/> property of the <paramref name="stateView"/> state is complex. /// </summary> /// <param name="stateView">The state view for the node with property <paramref name="propertyName"/>.</param> /// <param name="propertyName">Name of the property pointing to the template to check.</param> public virtual bool IsTemplateComplex(IFocusNodeStateView stateView, string propertyName) { IFocusNodeState State = stateView.State; Debug.Assert(State.InnerTable.ContainsKey(propertyName)); IFocusPlaceholderInner ParentInner = State.InnerTable[propertyName] as IFocusPlaceholderInner; Debug.Assert(ParentInner != null); NodeTreeHelperChild.GetChildNode(stateView.State.Node, propertyName, out Node ChildNode); Debug.Assert(ChildNode != null); Type NodeType = Type.FromGetType(ChildNode); //Type InterfaceType = NodeTreeHelper.NodeTypeToInterfaceType(NodeType); //Debug.Assert(TemplateSet.NodeTemplateTable.ContainsKey(InterfaceType)); Debug.Assert(TemplateSet.NodeTemplateTable.ContainsKey(NodeType)); IFocusNodeTemplate ParentTemplate = TemplateSet.NodeTemplateTable[NodeType] as IFocusNodeTemplate; Debug.Assert(ParentTemplate != null); return(ParentTemplate.IsComplex); }
private protected virtual bool IsNodeTreeChildNodeValid(Node node, string propertyName) { NodeTreeHelperChild.GetChildNode(node, propertyName, out Node ChildNode); Debug.Assert(ChildNode != null); bool IsValid = InvariantFailed(IsNodeTreeValid(ChildNode)); return(IsValid); }
private protected virtual void BrowseChildrenOfNode(IReadOnlyBrowseContext browseNodeContext, INode node) { IList <string> PropertyNames = NodeTreeHelper.EnumChildNodeProperties(node); foreach (string PropertyName in PropertyNames) { INode ChildNode; Type ChildInterfaceType, ChildNodeType; IReadOnlyList <INode> ChildNodeList; IReadOnlyList <INodeTreeBlock> ChildBlockList; bool IsHandled = false; if (NodeTreeHelperChild.IsChildNodeProperty(node, PropertyName, out ChildNodeType)) { NodeTreeHelperChild.GetChildNode(node, PropertyName, out ChildNode); Debug.Assert(ChildNode != null); IReadOnlyBrowsingPlaceholderNodeIndex ChildNodeIndex = CreateChildNodeIndex(browseNodeContext, node, PropertyName, ChildNode); // Create a collection containing one index for this child node. IReadOnlyIndexCollection IndexCollection = CreatePlaceholderIndexCollection(browseNodeContext, PropertyName, ChildNodeIndex); browseNodeContext.AddIndexCollection(IndexCollection); IsHandled = true; } else if (NodeTreeHelperOptional.IsOptionalChildNodeProperty(node, PropertyName, out ChildNodeType)) { IReadOnlyBrowsingOptionalNodeIndex OptionalNodeIndex = CreateOptionalNodeIndex(browseNodeContext, node, PropertyName); // Create a collection containing one index for this optional node. IReadOnlyIndexCollection IndexCollection = CreateOptionalIndexCollection(browseNodeContext, PropertyName, OptionalNodeIndex); browseNodeContext.AddIndexCollection(IndexCollection); IsHandled = true; } else if (NodeTreeHelperList.IsNodeListProperty(node, PropertyName, out ChildNodeType)) { NodeTreeHelperList.GetChildNodeList(node, PropertyName, out ChildNodeList); Debug.Assert(ChildNodeList != null); // Create a collection containing indexes for each children. IReadOnlyIndexCollection IndexCollection = BrowseNodeList(browseNodeContext, node, PropertyName, ChildNodeList); browseNodeContext.AddIndexCollection(IndexCollection); IsHandled = true; } else if (NodeTreeHelperBlockList.IsBlockListProperty(node, PropertyName, out ChildInterfaceType, out ChildNodeType)) { NodeTreeHelperBlockList.GetChildBlockList(node, PropertyName, out ChildBlockList); Debug.Assert(ChildBlockList != null); // Create a collection containing indexes for each child blocks and their children. IReadOnlyIndexCollection IndexCollection = BrowseNodeBlockList(browseNodeContext, node, PropertyName, ChildBlockList); browseNodeContext.AddIndexCollection(IndexCollection); IsHandled = true; } else if (NodeTreeHelper.IsBooleanProperty(node, PropertyName)) { browseNodeContext.AddValueProperty(PropertyName, ValuePropertyType.Boolean); IsHandled = true; } else if (NodeTreeHelper.IsEnumProperty(node, PropertyName)) { browseNodeContext.AddValueProperty(PropertyName, ValuePropertyType.Enum); IsHandled = true; } else if (NodeTreeHelper.IsStringProperty(node, PropertyName)) { browseNodeContext.AddValueProperty(PropertyName, ValuePropertyType.String); IsHandled = true; } else if (NodeTreeHelper.IsGuidProperty(node, PropertyName)) { browseNodeContext.AddValueProperty(PropertyName, ValuePropertyType.Guid); IsHandled = true; } else if (NodeTreeHelper.IsDocumentProperty(node, PropertyName)) { IsHandled = true; // Ignore the doc node. } Debug.Assert(IsHandled); } }