public void setVisible(boolean newValue) { if (newValue != isVisible) { willChange(); isVisible = newValue; changed(); } }
/** * Informs that a figure is about to change something that * affects the contents of its display box. */ @Override public void willChange() { if (changingDepth == 0) { fireAreaInvalidated(); invalidate(); } changingDepth++; }
@Override public void addNotify(Drawing d) { this.drawing = d; fireFigureAdded(); }
/** * Notify all listenerList that have registered interest for * notification on this event type. */ public void fireAreaInvalidated() { fireAreaInvalidated(getDrawingArea()); }
@Override public void setBounds(Point2D.Double anchor, Point2D.Double lead) { Point2D.Double oldAnchor = getStartPoint(); Point2D.Double oldLead = getEndPoint(); if (!oldAnchor.equals(anchor) || !oldLead.equals(lead)) { willChange(); setBounds(anchor, lead); changed(); fireUndoableEditHappened(new SetBoundsEdit(this, oldAnchor, oldLead, anchor, lead)); } }
@Override public void redo() throws CannotRedoException { super.redo(); owner.willChange(); owner.setBounds(newAnchor, newLead); owner.changed(); } @Override
/** * Informs that a figure changed the area of its display box. */ @Override public void changed() { if (changingDepth == 1) { validate(); fireFigureChanged(getDrawingArea()); } else if (changingDepth < 0) { throw new InternalError("changed was called without a prior call to willChange. "+changingDepth); } changingDepth--; }
public void fireFigureChanged() { fireFigureChanged(getDrawingArea()); }
public void setRemovable(boolean newValue) { boolean oldValue = isRemovable; isRemovable = newValue; firePropertyChange(REMOVABLE_PROPERTY, oldValue, newValue); }
@Override public AbstractAttributedFigure clone() { AbstractAttributedFigure that = (AbstractAttributedFigure) super.clone(); that.attributes = new HashMap<AttributeKey,Object>(this.attributes); if (this.forbiddenAttributes != null) { that.forbiddenAttributes = new HashSet<AttributeKey>(this.forbiddenAttributes); } return that; }
@Override public Cursor getCursor(Point2D.Double p) { if (contains(p)) { return Cursor.getPredefinedCursor(Cursor.HAND_CURSOR); } else { return Cursor.getDefaultCursor(); } }
@Override public void removeNotify(Drawing d) { fireFigureRemoved(); this.drawing = null; }
@Override public void requestRemove() { fireFigureRequestRemove(); }
@Override public void changed() { for (Figure child : children) { child.changed(); } super.changed(); }
@Override public void addNotify(Drawing drawing) { super.addNotify(drawing); for (Figure child : getChildren()) { child.addNotify(drawing); } }
@Override public void undo() throws CannotUndoException { super.undo(); owner.willChange(); owner.setBounds(oldAnchor, oldLead); owner.changed(); } }
public void setTransformable(boolean newValue) { boolean oldValue = isTransformable; isTransformable = newValue; firePropertyChange(TRANSFORMABLE_PROPERTY, oldValue, newValue); }
@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 @Nullable public Figure findFigureInside(Point2D.Double p) { return (contains(p)) ? this : null; }
public void setConnectable(boolean newValue) { boolean oldValue = isConnectable; isConnectable = newValue; firePropertyChange(CONNECTABLE_PROPERTY, oldValue, newValue); }