}                                                              // If color is left as clear, it will not apply a custom color

        public void SetNodeView(NodeView nodeView, SerializedProperty serializedNode, NodeGraph nodeGraph, NodeDisplayContainers nodeDisplayContainers)
        {
            TargetView              = nodeView;
            TargetProperty          = serializedNode;
            NodeGraph               = nodeGraph;
            m_nodeDisplayContainers = nodeDisplayContainers;
        }
        public NodeView(ANode node,
                        SerializedProperty serializedNode,
                        NodeGraphView nodeGraphView,
                        IEdgeConnectorListener edgeConnectorListener,
                        NodeViewDrawer nodeViewDrawer) : base()
        {
            if (serializedNode == null)
            {
                return;
            }

            Node                    = node;
            NodeType                = Node.GetType();
            SerializedNode          = serializedNode;
            m_nodeGraphView         = nodeGraphView;
            m_edgeConnectorListener = edgeConnectorListener;

            NodeId = SerializedNode.FindPropertyRelative(ANode.IdVarname).stringValue;

            m_nodeViewDrawer        = nodeViewDrawer;
            m_nodeDisplayContainers = new NodeDisplayContainers(this, m_nodeViewDrawer);
            m_nodeViewDrawer.SetNodeView(this, SerializedNode, nodeGraphView.NodeGraph, m_nodeDisplayContainers);
            m_nodeViewDrawer.OnSetup();

            title = m_nodeViewDrawer.DisplayName;

            bool isEntryNode = (typeof(BuiltInNodes.EntryNode)).IsAssignableFrom(NodeType);

            if (isEntryNode)
            {
                this.capabilities = this.capabilities & (~Capabilities.Deletable);
            }

            if (!isEntryNode)
            {
                //Add ports
                m_inport = new PortView(this,
                                        Orientation.Horizontal,
                                        Direction.Input,
                                        Port.Capacity.Single,
                                        typeof(bool),
                                        0,
                                        m_nodeViewDrawer.NodeColor,
                                        m_edgeConnectorListener);
                m_inport.portName = "";
                m_nodeDisplayContainers.SetInport(m_inport);
            }

            CreateOutports();

            // Draw node
            m_nodeViewDrawer.Repaint(m_outports);

            RefreshExpandedState();
            RefreshPorts();

            Vector2 pos = SerializedNode.FindPropertyRelative(ANode.PositionVarName).vector2Value;

            SetPosition(new Rect(pos, Vector2.zero));

            //this.RegisterCallback<GeometryChangedEvent>((GeometryChangedEvent gce) => { Debug.Log(gce.newRect.position); });
        }