public BezierNodeHandle(BezierFigure owner, int index, Figure transformOwner) { super(owner); this.index = index; this.transformOwner = transformOwner; transformOwner.addFigureListener(this); }
public BezierControlPointHandle(BezierFigure owner, int index, int coord, Figure transformOwner) { super(owner); this.index = index; this.controlPointIndex = coord; this.transformOwner = transformOwner; transformOwner.addFigureListener(this); }
/** Creates a new instance. */ public AbstractHandle(Figure owner) { if (owner == null) { throw new IllegalArgumentException("owner must not be null"); } this.owner = owner; owner.addFigureListener(this); }
@Override public void basicAdd(int index, Figure figure) { children.add(index, figure); figure.addFigureListener(eventHandler); }
@Override public void basicAdd(int index, Figure figure) { children.add(index, figure); figure.addFigureListener(childHandler); invalidate(); } @Override
@Override public void remap(Map<Figure,Figure> oldToNew, boolean disconnectIfNotInMap) { super.remap(oldToNew, disconnectIfNotInMap); if (target != null) { Figure newTarget = (Figure) oldToNew.get(target); if (newTarget != null) { target.removeFigureListener(this); target = (TextHolderFigure) newTarget; newTarget.addFigureListener(this); } } }
@Override public void basicAdd(int index, Figure figure) { children.add(index, figure); quadTree.add(figure, figure.getDrawingArea()); figure.addFigureListener(figureHandler); needsSorting = true; } @Override
@Override public LabeledLineConnectionFigure clone() { LabeledLineConnectionFigure that = (LabeledLineConnectionFigure) super.clone(); that.childHandler = new ChildHandler(that); that.children = new ArrayList<Figure>(); for (Figure thisChild : this.children) { Figure thatChild = (Figure) thisChild.clone(); that.children.add(thatChild); thatChild.addFigureListener(that.childHandler); } return that; } @Override
@Override public AbstractCompositeFigure clone() { AbstractCompositeFigure that = (AbstractCompositeFigure) super.clone(); that.children = new ArrayList<Figure>(); that.eventHandler = that.createEventHandler(); for (Figure thisChild : this.children) { Figure thatChild = (Figure) thisChild.clone(); that.children.add(thatChild); thatChild.addFigureListener(that.eventHandler); } return that; }
@Override @SuppressWarnings("unchecked") public GraphicalCompositeFigure clone() { GraphicalCompositeFigure that = (GraphicalCompositeFigure) super.clone(); that.presentationFigure = (this.presentationFigure == null) ? null : (Figure) this.presentationFigure.clone(); if (that.presentationFigure != null) { that.presentationFigure.addFigureListener(that.presentationFigureHandler); } that.attributes=(HashMap<AttributeKey, Object>) this.attributes.clone(); that.forbiddenAttributes= this.forbiddenAttributes==null?null:(HashSet<AttributeKey>) this.forbiddenAttributes.clone(); return that; }
selectionChanged = true; newSelection.add(figure); figure.addFigureListener(handleInvalidator); if (handlesAreValid && getEditor() != null) { for (Handle h : figure.createHandles(detailLevel)) {
@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; }
figure.addFigureListener(handleInvalidator); Set<Figure> newSelection = new HashSet<Figure>(selectedFigures); Rectangle invalidatedArea = null;
/** * Set a figure which renders this BasicCompositeFigure. The presentation * tasks for the BasicCompositeFigure are delegated to this presentation * figure. * * * * * * @param newPresentationFigure figure takes over the presentation tasks */ public void setPresentationFigure(@Nullable Figure newPresentationFigure) { if (this.presentationFigure != null) { this.presentationFigure.removeFigureListener(presentationFigureHandler); if (getDrawing() != null) { this.presentationFigure.removeNotify(getDrawing()); } } this.presentationFigure = newPresentationFigure; if (this.presentationFigure != null) { this.presentationFigure.addFigureListener(presentationFigureHandler); if (getDrawing() != null) { this.presentationFigure.addNotify(getDrawing()); } } // FIXME: We should calculate the layout here. }
protected void updateActiveView() { DrawingView newValue = (view != null) ? // view : // ((editor != null && editor.getActiveView() != null) ? // editor.getActiveView() : null); DrawingView oldValue = activeView; if (activeView != null) { activeView.removePropertyChangeListener(eventHandler); activeView.removeFigureSelectionListener(eventHandler); if (figuresOfInterest != null) { for (Figure f : figuresOfInterest) { f.removeFigureListener(eventHandler); } } } activeView = newValue; if (activeView != null) { activeView.addPropertyChangeListener(eventHandler); activeView.addFigureSelectionListener(eventHandler); figuresOfInterest = getEditedFigures(); for (Figure f : figuresOfInterest) { f.addFigureListener(eventHandler); } } attributeRestoreData = null; updateAttributeEditor(); }
@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(); } } } }
this.figure = figure; this.figure.addFigureListener(new FigureAdapter() {
this.figure = figure; this.figure.addFigureListener(new FigureAdapter() {
@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(); } } } } }