/** * Applies all attributes of this figure to that figure. */ @SuppressWarnings("unchecked") protected void applyAttributesTo(Figure that) { for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) { that.set(entry.getKey(), entry.getValue()); } }
@SuppressWarnings("unchecked") @Override public void applyDefaultAttributesTo(Figure f) { for (Map.Entry<AttributeKey, Object> entry : defaultAttributes.entrySet()) { f.set(entry.getKey(), entry.getValue()); } }
/** * Applies all attributes of this figure to that figure. */ @SuppressWarnings("unchecked") protected void applyAttributesTo(Figure that) { for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) { that.set(entry.getKey(), entry.getValue()); } }
/** * Applies all attributes of this figure to that figure. */ @SuppressWarnings("unchecked") protected void applyAttributesTo(Figure that) { for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) { that.set(entry.getKey(), entry.getValue()); } }
protected <T> void setAttributeOnChildren(AttributeKey<T> key, T newValue) { for (Figure child : getChildren()) { child.set(key, newValue); } }
@Override public void redo() throws CannotRedoException { super.redo(); for (Figure f : editedFigures) { f.set(attributeKey, editRedoValue); } }
/** * Convenience method for setting a value on a Figure. * <p> * Note: Unlike in previous versions of JHotDraw 7, this method does * not call {@code f.willChange()} before setting the value, and * {@code f.changed()} afterwards. * * @param f the Figure * @param value the attribute value */ public void set(Figure f, @Nullable T value) { if (value == null && !isNullValueAllowed) { throw new NullPointerException("Null value not allowed for AttributeKey " + key); } f.set(this, value); }
protected void initDefaultSettings(final F figure) { final OverlayService overlayService = getContext().getService(OverlayService.class); final OverlaySettings settings = overlayService.getDefaultSettings(); figure.set(AttributeKeys.STROKE_WIDTH, getDefaultLineWidth(settings)); figure.set(AttributeKeys.FILL_COLOR, getDefaultFillColor(settings)); figure.set(AttributeKeys.STROKE_COLOR, getDefaultStrokeColor(settings)); // Avoid IllegalArgumentException: miter limit < 1 on the EDT figure.set(AttributeKeys.IS_STROKE_MITER_LIMIT_FACTOR, false); }
@Override @SuppressWarnings("unchecked") public void redo() { super.redo(); //restoreData.add(drawing.getAttributesRestoreData()); drawing.willChange(); for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) { drawing.set(entry.getKey(), entry.getValue()); } drawing.changed(); } };
@SuppressWarnings("unchecked") protected Figure createFigure() { Figure f = (Figure) prototype.clone(); getEditor().applyDefaultAttributesTo(f); if (prototypeAttributes != null) { for (Map.Entry<AttributeKey, Object> entry : prototypeAttributes.entrySet()) { f.set(entry.getKey(), entry.getValue()); } } return f; }
@Override public void redo() { super.redo(); for (Figure figure : selectedFigures) { //restoreData.add(figure.getAttributesRestoreData()); figure.willChange(); for (Map.Entry<AttributeKey, Object> entry : a.entrySet()) { figure.set(entry.getKey(), entry.getValue()); } figure.changed(); } } };
@Override public <T> void set(AttributeKey<T> key, T value) { for (Figure child : getChildren()) { child.set(key, value); } invalidate(); }
private <T> void set(final F fig, final AttributeKey<T> key, final T value) { if (MiscUtils.equal(value, fig.get(key))) { // NB: Do not trigger an attribute change event if value already matches. return; } fig.set(key, value); }
@Override public void redo() { super.redo(); for (Figure figure : selectedFigures) { //restoreData.add(figure.getAttributesRestoreData()); figure.willChange(); figure.set(key, undoValue); figure.changed(); } } };
@Override public void redo() { super.redo(); f.willChange(); f.set(AttributeKey.this, value); f.changed(); } };
@Override public void redo() { super.redo(); for (Figure figure : selectedFigures) { //restoreData.add(figure.getAttributesRestoreData()); figure.willChange(); figure.set(key, newValue); figure.changed(); } } };
@Override public void redo() throws CannotRedoException { super.redo(); owner.willChange(); owner.set(name, newValue); owner.changed(); } @Override
@Override public <T> void set(AttributeKey<T> key, T newValue) { super.set(key, newValue); if (getDecorator() != null) { getDecorator().set(key, newValue); } } }
@Override public void undo() throws CannotUndoException { super.undo(); owner.willChange(); owner.set(name, oldValue); owner.changed(); } }
@Override public void redo() { super.redo(); for (Figure figure : selectedFigures) { //restoreData.add(figure.getAttributesRestoreData()); figure.willChange(); figure.set(key, undoValue); figure.changed(); } } };