public double getStrokeMiterLimitFactor() { Number value = (Number) get(AttributeKeys.STROKE_MITER_LIMIT); return (value != null) ? value.doubleValue() : 10f; }
public void drawFigure(Graphics2D g) { drawChildren(g); if (get(FILL_COLOR) != null) { g.setColor(get(FILL_COLOR)); drawFill(g); } if (get(STROKE_COLOR) != null && get(STROKE_WIDTH) > 0d) { g.setStroke(AttributeKeys.getStroke(this)); g.setColor(get(STROKE_COLOR)); drawStroke(g); } if (get(TEXT_COLOR) != null) { if (get(TEXT_SHADOW_COLOR) != null && get(TEXT_SHADOW_OFFSET) != null) { Dimension2DDouble d = get(TEXT_SHADOW_OFFSET); g.translate(d.width, d.height); g.setColor(get(TEXT_SHADOW_COLOR)); drawText(g); g.translate(-d.width, -d.height); } g.setColor(get(TEXT_COLOR)); drawText(g); } }
public <T> void removeAttribute(AttributeKey<T> key) { if (hasAttribute(key)) { T oldValue = get(key); attributes.remove(key); fireAttributeChanged(key, oldValue, key.getDefaultValue()); } }
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)) { @SuppressWarnings("unchecked") Object prototypeValue = prototype.get(key); @SuppressWarnings("unchecked") Object attributeValue = get(key); 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(); } }