public void AddChild(JavascriptNode node) { if (childJavascriptNodes.Add(node)) { node.Parent = this; } }
private JavascriptNode GetWidgetJavascriptNode(string identifier) { JavascriptNode result = GetJavascriptNode(identifier); if ((result.Parent == null) && !rootJavascriptNodes.Contains(result)) { rootJavascriptNodes.Add(result); } return(result); }
private JavascriptNode GetJavascriptNode(string identifier) { JavascriptNode javaScriptNode; if (!JavascriptNodes.TryGetValue(identifier, out javaScriptNode)) { javaScriptNode = new JavascriptNode(identifier); JavascriptNodes.Add(identifier, javaScriptNode); } return(javaScriptNode); }
private JavascriptNode GetBlockJavascriptNodeAndFillItsParent(OSUserControl block) { JavascriptNode result = GetJavascriptNode(block.WebBlockIdentifier); if ((result.Parent == null) && !rootJavascriptNodes.Contains(result)) { // find the correspondent parent block var parentBlock = Utils.GetOwnerOfControl(block.Parent) as OSUserControl; if (parentBlock == null) { rootJavascriptNodes.Add(result); } else { GetBlockJavascriptNodeAndFillItsParent(parentBlock).AddChild(result); } } return(result); }
private IEnumerable <JavascriptNode> GetChildNodesAndSelf(JavascriptNode javascriptNode) { return(javascriptNode.ChildJavascriptNodes.SelectMany(c => GetChildNodesAndSelf(c)).Concat(javascriptNode)); }