@Override
    public void mouseReleased(final MouseEvent e) {
        if (this.draggedComponent != null) {
            final Point p = e.getPoint();
            final Set<Element> ignoreSelection = new HashSet<>();
            ignoreSelection.add(this.draggedEdge);
            final Element element = getGraphicPanel().getElementAt(p, ignoreSelection);
            if (element instanceof Vertex) {
                System.out.println("edge move: element hit");
                final Vertex vertex = (Vertex) element;
                if (this.handlerPos == HandlerPosition.SOURCE) {
                    if (vertex.canHaveOutput()) {
                        this.draggedEdge.updateSource(vertex, null);
                        final BPComponent vertexComponent = (BPComponent) vertex.getComponent();
                        this.draggedComponent.setSourceX(p.x);
                        this.draggedComponent.setSourceY(p.y);
                        this.draggedComponent.updateComponent(vertexComponent, null);
                    }
                } else if (this.handlerPos == HandlerPosition.TARGET) {
                    if (vertex.canHaveInput()) {
                        this.draggedEdge.updateTarget(vertex, null);
                        final BPComponent vertexComponent = (BPComponent) vertex.getComponent();
                        this.draggedComponent.setTargetX(p.x);
                        this.draggedComponent.setTargetY(p.y);
                        this.draggedComponent.updateComponent(null, vertexComponent);
                    }
                }
            } else {
                if (this.handlerPos == HandlerPosition.SOURCE) {
                    this.draggedComponent.setSourceX(this.startX);
                    this.draggedComponent.setSourceY(this.startY);
                } else if (this.handlerPos == HandlerPosition.TARGET) {
                    this.draggedComponent.setTargetX(this.startX);
                    this.draggedComponent.setTargetY(this.startY);
                }
            }
            getGraphicPanel().repaint();
        }


        this.draggedEdge = null;
        this.draggedComponent = null;
        getPanel().getStateManager().moveToState(StateType.SELECT);
    }