private void RemovePort(SPort port) { var target = port.Direction == PortDirection.Input ? inputContainer : outputContainer; var portView = target.Children().OfType <BasePortView>().First(v => v.Port.Id == port.Id); target.Remove(portView); _ports.Remove(portView); }
private void AddPort(SPort port) { var target = port.Direction == PortDirection.Input ? inputContainer : outputContainer; var portView = CreatePortView(port); target.Add(portView); _ports.Add(portView); }
/// <summary> /// Constructor /// </summary> /// <param name="port">Port that needs view</param> /// <param name="portOrientation">Orientation of port</param> /// <param name="edgeConnectorListener">Edge connector listener for a port</param> public BasePortView(SPort port, Orientation portOrientation, IEdgeConnectorListener edgeConnectorListener) : base(portOrientation, port.Direction == PortDirection.Input ? Direction.Input : Direction.Output, port.Capacity == PortCapacity.Multiple ? Capacity.Multi : Capacity.Single, port.Type) { Port = port; portName = ObjectNames.NicifyVariableName(port.Id); m_EdgeConnector = CreateEdgeConnector(edgeConnectorListener); this.AddManipulator(m_EdgeConnector); tooltip = port.Type.ToString(); }
/// <summary> /// Creates a view for <see cref="PortModel"/>. /// Override this to create custom view /// </summary> /// <param name="port"></param> protected virtual BasePortView CreatePortView(SPort port) { return(new BasePortView(port, Orientation.Horizontal, EdgeConnectorListener)); }
public void Init(IGraphType graphType, SPort fromPort, Func <SearchWindowResult, bool> nodeCreationRequested) { _graphType = graphType; _fromPort = fromPort; _nodeCreationRequested = nodeCreationRequested; }
public static IEnumerable <SConnection> GetConnections(this SGraph graph, SPort port) { return(graph.Connections.Where(connection => (connection.FromPortId == port.Id && connection.FromNodeId == port.NodeId) || (connection.ToPortId == port.Id && connection.ToNodeId == port.NodeId))); }