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()); } } }