@Override public void updateConnection() { super.updateConnection(); layout(); }
/** * Ensures that a connection is updated if the connection * was moved. */ @Override public void transform(AffineTransform tx) { super.transform(tx); updateConnection(); // make sure that we are still connected } // ATTRIBUTES
public void reverseConnection() { if (startConnector != null && endConnector != null) { handleDisconnect(startConnector, endConnector); Connector tmpC = startConnector; startConnector = endConnector; endConnector = tmpC; Point2D.Double tmpP = getStartPoint(); setStartPoint(getEndPoint()); setEndPoint(tmpP); handleConnect(startConnector, endConnector); updateConnection(); } } }
/** * This method is invoked, when the Figure is being removed from a Drawing. * This method invokes handleConnect, if the Figure is connected. * * @see #handleConnect */ @Override public void addNotify(Drawing drawing) { super.addNotify(drawing); if (getStartConnector() != null && getEndConnector() != null) { handleConnect(getStartConnector(), getEndConnector()); updateConnection(); } }
@Override public void figureChanged(FigureEvent e) { if (!owner.isChanging()) { if (e.getSource() == owner.getStartFigure() || e.getSource() == owner.getEndFigure()) { owner.willChange(); owner.updateConnection(); owner.changed(); } } } };
@Override public LineConnectionFigure clone() { LineConnectionFigure that = (LineConnectionFigure) super.clone(); that.connectionHandler = new ConnectionHandler(that); if (this.liner != null) { that.liner = (Liner) this.liner.clone(); } // FIXME - For safety reasons, we clone the connectors, but they would // work, if we continued to use them. Maybe we should state somewhere // whether connectors should be reusable, or not. // To work properly, that must be registered as a figure listener // to the connected figures. if (this.startConnector != null) { that.startConnector = (Connector) this.startConnector.clone(); that.getStartFigure().addFigureListener(that.connectionHandler); } if (this.endConnector != null) { that.endConnector = (Connector) this.endConnector.clone(); that.getEndFigure().addFigureListener(that.connectionHandler); } if (that.startConnector != null && that.endConnector != null) { //that.handleConnect(that.getStartConnector(), that.getEndConnector()); that.updateConnection(); } return that; }
@Override public void setStartConnector(Connector newStart) { if (newStart != startConnector) { if (startConnector != null) { getStartFigure().removeFigureListener(connectionHandler); if (getEndFigure() != null) { handleDisconnect(getStartConnector(), getEndConnector()); } } startConnector = newStart; if (startConnector != null) { getStartFigure().addFigureListener(connectionHandler); if (getStartFigure() != null && getEndFigure() != null) { handleConnect(getStartConnector(), getEndConnector()); updateConnection(); } } } }
@Override public void setEndConnector(Connector newEnd) { if (newEnd != endConnector) { if (endConnector != null) { getEndFigure().removeFigureListener(connectionHandler); if (getStartFigure() != null) { if (getDrawing() != null) { handleDisconnect(getStartConnector(), getEndConnector()); } } } endConnector = newEnd; if (endConnector != null) { getEndFigure().addFigureListener(connectionHandler); if (getStartFigure() != null && getEndFigure() != null) { if (getDrawing() != null) { handleConnect(getStartConnector(), getEndConnector()); updateConnection(); } } } } }