private static void BuildActionModelTree(ActionModelNode actionModel, AbstractActionModelTreeBranch abstractActionModelTreeBranch) { foreach (ActionModelNode childNode in actionModel.ChildNodes) { if (childNode is ActionNode) { ActionNode actionNode = (ActionNode)childNode; if (actionNode.Action.Persistent) { if (actionNode.Action is IClickAction) { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafClickAction((IClickAction)actionNode.Action)); } else { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafAction(actionNode.Action)); } } } else if (childNode is SeparatorNode) { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafSeparator()); } else if (childNode is BranchNode) { AbstractActionModelTreeBranch treeBranch = new AbstractActionModelTreeBranch(childNode.PathSegment); BuildActionModelTree(childNode, treeBranch); abstractActionModelTreeBranch.AppendChild(treeBranch); } } }
private static void BuildFlatActionModelTree(ActionModelNode actionModel, AbstractActionModelTreeBranch abstractActionModelTreeBranch) { foreach (ActionModelNode childNode in actionModel.GetLeafNodesInOrder()) { if (childNode is ActionNode) { ActionNode actionNode = (ActionNode)childNode; if (actionNode.Action.Persistent) { if (actionNode.Action is IClickAction) { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafClickAction((IClickAction)actionNode.Action)); } else { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafAction(actionNode.Action)); } } } else if (childNode is SeparatorNode) { abstractActionModelTreeBranch.AppendChild(new AbstractActionModelTreeLeafSeparator()); } } }
public bool IsDescendantOf(AbstractActionModelTreeBranch node) { if (ReferenceEquals(node, null) || ReferenceEquals(_parent, null)) { return(false); } if (ReferenceEquals(_parent, node)) { return(true); } return(_parent.IsDescendantOf(node)); }
public void RemoveNode() { try { AbstractActionModelTreeNode selectedNode = base.SelectedNode; if (this.CanRemove && selectedNode.Parent != null) { AbstractActionModelTreeBranch branch = selectedNode as AbstractActionModelTreeBranch; if (branch != null && !branch.HasNoActions) { base.Context.DesktopWindow.ShowMessageBox(SR.MessageNodeNotEmpty, MessageBoxActions.Ok); return; } selectedNode.Parent.Children.Remove(selectedNode); } } catch (Exception ex) { ExceptionHandler.Report(ex, this.Context.DesktopWindow); } }