public override IStepNode BuildGraph() { IStepNode root = base.BuildGraph(); _node.ConnectBranch(_branch, root); return(root); }
private void AddNode(IStepNode node, SimpleStepNode simpleNode) { if (_rootNode == null) { _rootNode = node; } else if (_lastSimpleNode != null) { _lastSimpleNode.AttachNode(node); // HAX: attach the node to the top-level decorator so that Previous works correctly node.AttachTo(_lastNode); } _lastNode = node; _lastSimpleNode = simpleNode; }
public bool Back() { if (_currentNode == null) { return(false); } IStepNode previousNode = _currentNode.Previous; if (previousNode == null) { return(false); } ViewNode(previousNode); return(true); }
public void ViewNode(IStepNode node) { if (BeforeViewNode != null) { ViewNodeEventArgs args = new ViewNodeEventArgs(node, node.Previous != null, node.Next != null); BeforeViewNode(this, args); } IStepNode previousNode = _currentNode; _currentNode = node; node.Load(); if (previousNode != null) { previousNode.Hide(); } node.Show(); }
public void AttachNode(IStepNode node) { if (node == null) { throw new ArgumentNullException("node cannot be null"); } // Place the new node in-between this node and the current next node IStepNode oldNext = _next; node.AttachTo(this); if (oldNext != null) { oldNext.AttachTo(node); } // Link the node to us _next = node; }
public bool Forward() { if (_currentNode == null) { return(false); } if (!_currentNode.Save()) { return(true); } IStepNode nextNode = _currentNode.Next; if (nextNode == null) { return(false); } ViewNode(nextNode); return(true); }
public ViewNodeEventArgs(IStepNode nextNode, bool canGoBack, bool canGoForward) { NextNode = nextNode; _canGoBack = canGoBack; _canGoForward = canGoForward; }
public void AttachTo(IStepNode node) { _previous = node; }
/// <summary> /// Connects an IStepNode to one of the IBranchStep's branches. /// </summary> /// <param name="branch">The branch to connect to (see the concrete IBranchStep implementation this wraps).</param> /// <param name="node">The IStepNode that should be jumped to if the branch is selected.</param> public void ConnectBranch(T branch, IStepNode node) { node.AttachTo(this); _branches[branch] = node; }