@Override public void figureRemoved(FigureEvent e) { invalidate(); } }
@Override public void attributeChanged(FigureEvent e) { invalidate(); }
@Override public void figureAdded(FigureEvent e) { invalidate(); }
@Override public Figure basicRemoveChild(int index) { Figure figure = children.remove(index); figure.removeFigureListener(eventHandler); invalidate(); return figure; }
@Override public void restoreTransformTo(Object geometry) { LinkedList list = (LinkedList) geometry; Iterator i = list.iterator(); for (Figure child : getChildren()) { child.restoreTransformTo(i.next()); } invalidate(); }
/** * Transforms the figure. */ @Override public void transform(AffineTransform tx) { for (Figure f : getChildren()) { f.transform(tx); } invalidate(); //invalidate(); }
@Override public <T> void set(AttributeKey<T> key, T value) { for (Figure child : getChildren()) { child.set(key, value); } invalidate(); }
@Override public void add(int index, Figure figure) { basicAdd(index, figure); if (getDrawing() != null) { figure.addNotify(getDrawing()); } fireFigureAdded(figure, index); invalidate(); }
public final void addAll(int index, Collection<? extends Figure> figures) { for (Figure f : figures) { basicAdd(index++, f); if (getDrawing() != null) { f.addNotify(getDrawing()); } fireFigureAdded(f, index); } invalidate(); }
/** * A layout algorithm is used to define how the child components * should be laid out in relation to each other. The task for * layouting the child components for presentation is delegated * to a Layouter which can be plugged in at runtime. */ @Override public void layout() { // Note: We increase and below decrease the changing depth here, // because we want to ignore change events from our children // why we lay them out. changingDepth++; for (Figure child : getChildren()) { if (child instanceof CompositeFigure) { CompositeFigure cf = (CompositeFigure) child; cf.layout(); } } changingDepth--; if (getLayouter() != null) { Rectangle2D.Double bounds = getBounds(); Point2D.Double p = new Point2D.Double(bounds.x, bounds.y); Rectangle2D.Double r = getLayouter().layout( this, p, p); setBounds(new Point2D.Double(r.x, r.y), new Point2D.Double(r.x + r.width, r.y + r.height)); invalidate(); } }
@Override public void figureChanged(FigureEvent e) { if (!isChanging()) { Rectangle2D.Double invalidatedArea = getDrawingArea(); invalidatedArea.add(e.getInvalidatedArea()); // We call invalidate/validate here, because we must layout // the figure again. invalidate(); validate(); // Forward the figureChanged event to listeners on AbstractCompositeFigure. invalidatedArea.add(getDrawingArea()); fireFigureChanged(invalidatedArea); } }