public static HtmlComposite GenerateHtmlTree <T>(Tree <T> tree, string identityPrefix, ClassAcessor identityMember) { HtmlComposite ul = new HtmlComposite("ul"); foreach (TreeNode <T> child in tree) { ul.Children.AddLast(GenerateHtmlTreeNode <T>(child, identityPrefix, identityMember)); } return(ul); }
public static HtmlComposite GenerateHtmlTreeNode <T>(EixoX.Collections.TreeNode <T> treeNode, string identityPrefix, ClassAcessor identityMember) { HtmlComposite li = new HtmlComposite("li"); if (identityMember != null) { li.Attributes.AddLast("id", identityPrefix + identityMember.GetValue(treeNode.Value)); } li.Children.AddLast(new HtmlSimple("span", treeNode.Value)); if (treeNode.Count > 0) { li.Children.AddLast(GenerateHtmlTree <T>(treeNode, identityPrefix, identityMember)); } return(li); }
public static HtmlComposite AppendComposite(this HtmlComposite element, string tagName, params HtmlAttribute[] attributes) { HtmlComposite composite = new HtmlComposite(tagName, attributes); element.Children.AddLast(composite); return composite; }