protected void writeAttributes(DOMOutput out) throws IOException { Figure prototype = (Figure) out.getPrototype(); boolean isElementOpen = false; for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) { AttributeKey key = entry.getKey(); if (forbiddenAttributes == null || !forbiddenAttributes.contains(key)) { Object prototypeValue = key.get(prototype); Object attributeValue = key.get(this); if (prototypeValue != attributeValue || (prototypeValue != null && attributeValue != null && !prototypeValue.equals(attributeValue))) { if (!isElementOpen) { out.openElement("a"); isElementOpen = true; } out.openElement(key.getKey()); out.writeObject(entry.getValue()); out.closeElement(); } } } if (isElementOpen) { out.closeElement(); } }
public <T> void removeAttribute(AttributeKey<T> key) { if (hasAttribute(key)) { T oldValue = key.get(this); attributes.remove(key); fireAttributeChanged(key, oldValue, key.getDefaultValue()); } }
private Locator getLocator(Figure f) { return LAYOUT_LOCATOR.get(f); }
/** Gets an attribute from the figure. */ public <T> T getAttribute(AttributeKey<T> key) { return hasAttribute(key) ? key.get(attributes) : key.getDefaultValue(); }