/// <summary> /// Creates a new node and attaches the default attributes DebugName and ExportType. /// </summary> /// <param name="label">The default label of the node.</param> /// <param name="description">The description of the node shown to the designer.</param> protected Node(string label, string description) { _children = new ConnectedChildren(this); _label = label; _description = description; _attachments = new List <Attachments.Attachment>(); }
/// <summary> /// Replace the children of this node from the source node. /// </summary> public void ReplaceChildren(BaseNode source) { _children = source._children; foreach (BaseNode child in source._children) { child._parent = this; } }
/// <summary> /// Creates a new connector. /// </summary> /// <param name="connectedChildren">Usually the _children member of a node.</param> /// <param name="label">The label which is used to generate the individual label for each connected child. May contain {0} to include the index.</param> /// <param name="identifier">The identifier of the connector.</param> /// <param name="minCount">The minimum number of subitems shown for the connector.</param> /// <param name="maxCount">The maximum number of children the connector can have.</param> public Connector(ConnectedChildren connectedChildren, string label, string identifier, int minCount, int maxCount) { Debug.Check(connectedChildren != null); Debug.Check(minCount >= 1); Debug.Check(maxCount >= minCount); _connectedChildren = connectedChildren; BaseLabel = label; _identifier = identifier; _minCount = minCount; _maxCount = maxCount; // register the connector _connectedChildren.RegisterConnector(this); }
/// <summary> /// Convenience method to check if all connected children are accepted. /// </summary> /// <param name="children">The children we want to adopt.</param> /// <param name="acceptEvenFull">Accepets the child even it is full.</param> /// <returns>Returns if the connector will accept the children.</returns> public bool AcceptsChildren(ConnectedChildren connectedChildren, bool acceptEvenFull = false) { List <BaseNode> children = new List <BaseNode>(connectedChildren.ChildCount); foreach (BaseNode node in connectedChildren) { // if the owner itself is part of the list we ignore him if (node == Owner) { continue; } children.Add(node); } return(AcceptsChildren(children, acceptEvenFull)); }
/// <summary> /// Convenience method to check if all connected children are accepted. /// </summary> /// <param name="children">The children we want to adopt.</param> /// <returns>Returns if the connector will accept the children.</returns> public bool AcceptsChildren(ConnectedChildren connectedChildren) { List <Type> children = new List <Type>(connectedChildren.ChildCount); foreach (BaseNode node in connectedChildren) { // if the owner itself is part of the list we ignore him if (node == Owner) { continue; } children.Add(node.GetType()); } return(AcceptsChildren(children)); }
public abstract Connector Clone(ConnectedChildren connectedChildren);
/// <summary> /// Creates a new node and attaches the default attributes DebugName and ExportType. /// </summary> protected BaseNode() { _children = new ConnectedChildren(this); }
public override Connector Clone(ConnectedChildren connectedChildren) { return new ConnectorMultiple(connectedChildren, _label, _identifier, _minCount, _maxCount); }
public override Connector Clone(ConnectedChildren connectedChildren) { return(new ConnectorSingle(connectedChildren, _label, _identifier)); }
/// <summary> /// Creates a new connector which can hold multiple children. /// </summary> /// <param name="connectedChildren">Usually the _children member of a node.</param> /// <param name="label">The label which is used to generate the individual label for each connected child. May contain {0} to include the index.</param> /// <param name="identifier">The identifier of the connector.</param> /// <param name="minCount">The minimum number of connectors shown on the node.</param> /// <param name="maxCount">The maximum number of children which can be connected via this connector.</param> public ConnectorMultiple(ConnectedChildren connectedChildren, string label, string identifier, int minCount, int maxCount) : base(connectedChildren, label, identifier, minCount, maxCount) { }
/// <summary> /// Creates a new connector which can hold a single child. /// </summary> /// <param name="connectedChildren">Usually the _children member of a node.</param> /// <param name="label">The label which is used to generate the individual label for each connected child. May contain {0} to include the index.</param> /// <param name="identifier">The identifier of the connector.</param> public ConnectorSingle(ConnectedChildren connectedChildren, string label, string identifier) : base(connectedChildren, label, identifier, 1, 1) { }
/// <summary> /// Creates a new node and attaches the default attributes DebugName and ExportType. /// </summary> /// <param name="shape">The shape of the node when being rendered.</param> /// <param name="defaultStyle">The stle of the node when being neither hovered over nor selected.</param> /// <param name="currentStyle">The style of the node when the mouse is hovering over it.</param> /// <param name="selectedStyle">The style of the node when it is selected.</param> /// <param name="draggedStyle">The style of the node when it is attached to the mouse cursor when moving nodes in the graph.</param> /// <param name="label">The default label of the node.</param> /// <param name="font">The font used for the label.</param> /// <param name="minWidth">The minimum width of the node.</param> /// <param name="minHeight">The minimum height of the node.</param> /// <param name="acceptsEvents">Defines if events may be attached to this node.</param> /// <param name="description">The description of the node shown to the designer.</param> public Node(NodeShape shape, Style defaultStyle, Style currentStyle, Style selectedStyle, Style draggedStyle, string label, Font font, int minWidth, int minHeight, bool acceptsEvents, string description) { _children= new ConnectedChildren(this); _label= label; _baselabel= label; _shape= shape; _font= font; _minWidth= minWidth; _minHeight= minHeight; _description= description; if(defaultStyle ==null) throw new Exception(Resources.ExceptionDefaultStyleNull); _defaultStyle= defaultStyle; _currentStyle= currentStyle; _selectedStyle= selectedStyle; _draggedStyle= draggedStyle; _acceptsEvents= acceptsEvents; }
public override Connector Clone(ConnectedChildren connectedChildren) { return new ConnectorSingle(connectedChildren, _label, _identifier); }
/// <summary> /// Creates a new node and attaches the default attributes DebugName and ExportType. /// </summary> /// <param name="label">The default label of the node.</param> /// <param name="description">The description of the node shown to the designer.</param> protected Node(string label, string description) { _children = new ConnectedChildren(this); _label = label; _description = description; _attachments = new List<Attachments.Attachment>(); }
/// <summary> /// Convenience method to check if all connected children are accepted. /// </summary> /// <param name="children">The children we want to adopt.</param> /// <param name="acceptEvenFull">Accepets the child even it is full.</param> /// <returns>Returns if the connector will accept the children.</returns> public bool AcceptsChildren(ConnectedChildren connectedChildren, bool acceptEvenFull = false) { List<Type> children = new List<Type>(connectedChildren.ChildCount); foreach (BaseNode node in connectedChildren) { // if the owner itself is part of the list we ignore him if (node == Owner) { continue; } children.Add(node.GetType()); } return AcceptsChildren(children, acceptEvenFull); }
public override Connector Clone(ConnectedChildren connectedChildren) { return(new ConnectorMultiple(connectedChildren, _label, _identifier, _minCount, _maxCount)); }
/// <summary> /// Replace the children of this node from the source node. /// </summary> public void ReplaceChildren(BaseNode source) { _children = source._children; foreach(BaseNode child in _children) { child._parent = this; } _fsmNodes = source._fsmNodes; foreach(BaseNode child in _fsmNodes) { child._parent = this; } }
/// <summary> /// Creates a new node and attaches the default attributes DebugName and ExportType. /// </summary> protected BaseNode() { _id = ++NodeCount; _children = new ConnectedChildren(this); }