Exemplo n.º 1
0
        protected void DirectLink(SENodeGroup group,
                                  ResourceMap.Node mapNode,
                                  dynamic link)
        {
            String linkTargetUrl = link.LinkTarget.ToObject <String>();

            void CreateDirectNode(SENodeGroup g)
            {
                if (this.map.TryGetNode(linkTargetUrl, out ResourceMap.Node linkTargetNode) == true)
                {
                    SENode node = this.CreateResourceNode(linkTargetNode, link);
                    g.AppendNode(node);
                }
            }

            dynamic[] childMapLinks = new Object[0];

            ResourceMap.Node childMapNode = null;

            bool linkToLastGroup = false;

            if (ShowChildren(link))
            {
                if (this.map.TryGetNode(linkTargetUrl, out childMapNode) == true)
                {
                    childMapNode  = this.map.GetNode(linkTargetUrl);
                    childMapLinks = childMapNode.LinksByLinkType(this.linkTypes).ToArray();
                    if (childMapLinks.Length > 0)
                    {
                        linkToLastGroup = !this.DifferentChildren(this.previousChildLinks, childMapLinks);
                    }
                }
            }

            if ((linkToLastGroup) & (group.Children.Count() > 0))
            {
                SENodeGroup groupChild = group.Children.Last();
                CreateDirectNode(groupChild);
            }
            else
            {
                SENodeGroup groupChild = group.AppendChild("", this.showCardinality);
                CreateDirectNode(groupChild);
                if (ShowChildren(link))
                {
                    this.AddChildren(childMapNode,
                                     childMapLinks,
                                     groupChild);
                }
                this.previousChildLinks = childMapLinks;
            }
        }
Exemplo n.º 2
0
 /*
  * Add children. If two adjacent children have same children, then dont create each in a seperate
  * group. Have the two nodes point to the same group of children.
  */
 protected void AddChildren(ResourceMap.Node mapNode,
                            SENodeGroup group)
 {
     dynamic[] links = mapNode.LinksByLinkType(this.linkTypes).ToArray();
     this.AddChildren(mapNode, links, group);
 }