/** * Transforms the figure. */ @Override public void transform(AffineTransform tx) { super.transform(tx); for (Figure f : children) { f.transform(tx); } invalidate(); } @Override
@Override public boolean contains(Point2D.Double p) { boolean contains = super.contains(p); if (!contains && getPresentationFigure() != null) { contains = getPresentationFigure().contains(p); } return contains; }
@Override public void activate(DrawingEditor editor) { this.editor = editor; editorProxy.setTarget(editor); isActive = true; // Repaint all handles for (DrawingView v : editor.getDrawingViews()) { v.repaintHandles(); } }
@Override public Figure removeChild(int index) { willChange(); Figure figure = basicRemoveChild(index); if (getDrawing() != null) { figure.removeNotify(getDrawing()); } changed(); return figure; } @Override
@SuppressWarnings("rawtypes") @Override public void setAttributeEnabled(AttributeKey key, boolean b) { super.setAttributeEnabled(key, b); for (final BezierFigure figure : figures) { figure.setAttributeEnabled(key, b); } }
/** * Sends a figure to the back of the composite figure. * * @param figure that is part of this composite figure */ public void sendToBack(Figure figure) { if (basicRemove(figure) != -1) { basicAdd(0, figure); fireAreaInvalidated(figure.getDrawingArea()); } }
protected <T> void setAttributeOnChildren(AttributeKey<T> key, T newValue) { for (Figure child : getChildren()) { child.set(key, newValue); } }
@Override public void restoreAttributesTo(Object restoreData) { super.restoreAttributesTo(restoreData); for (final BezierFigure figure : figures) { figure.restoreAttributesTo(restoreData); } }
@Override public void removeNotify(Drawing drawing) { super.removeNotify(drawing); if (getPresentationFigure() != null) { getPresentationFigure().removeNotify(drawing); } }
/** * Standard presentation method which is delegated to the encapsulated presentation figure. * The presentation figure is moved as well as all contained figures. */ @Override public void transform(AffineTransform tx) { super.transform(tx); if (getPresentationFigure() != null) { getPresentationFigure().transform(tx); } }
/** * Return the logcal display area. This method is delegated to the encapsulated * presentation figure. */ @Override public Rectangle2D.Double getBounds() { if (getPresentationFigure() == null) { return super.getBounds(); } return getPresentationFigure().getBounds(); }
@Override public void addNotify(Drawing drawing) { super.addNotify(drawing); if (getPresentationFigure() != null) { getPresentationFigure().addNotify(drawing); } }
@Override public void addNotify(Drawing drawing) { super.addNotify(drawing); for (Figure child : getChildren()) { child.addNotify(drawing); } }
@Override public Figure findFigure(Point2D.Double p) { for (Figure f : getFiguresFrontToBack()) { if (f.isVisible() && f.contains(p)) { return f; } } return null; }
/** * Notify all listenerList that have registered interest for * notification on this event type. */ protected void fireUndoableEditHappened(UndoableEdit edit) { view.getDrawing().fireUndoableEditHappened(edit); }
@Override public void willChange() { super.willChange(); for (Figure child : children) { child.willChange(); } }
@Override public void read(DOMInput in) throws IOException { super.read(in); readAttributes(in); }