/** * Sets an attribute of the figure. * AttributeKey name and semantics are defined by the class implementing * the figure interface. */ @Override public <T> void set(AttributeKey<T> key, T newValue) { if (forbiddenAttributes == null || ! forbiddenAttributes.contains(key)) { T oldValue = (T) key.put(attributes, newValue); fireAttributeChanged(key, oldValue, newValue); } } /**
public <T> void removeAttribute(AttributeKey<T> key) { if (hasAttribute(key)) { T oldValue = get(key); attributes.remove(key); fireAttributeChanged(key, oldValue, key.getDefaultValue()); } }