public AttributeValues clone() { try { AttributeValues result = (AttributeValues) super.clone(); if (transform != null) { // AffineTransform is mutable result.transform = new AffineTransform(transform); result.updateDerivedTransforms(); } // if transform is null, derived transforms are null // so there's nothing to do return result; } catch (CloneNotSupportedException e) { // never happens return null; } }
public static AttributeValues fromSerializableHashtable(Hashtable<Object, Object> ht) { AttributeValues result = new AttributeValues(); if (ht != null && !ht.isEmpty()) { for (Map.Entry<Object, Object> e : ht.entrySet()) { Object key = e.getKey(); Object val = e.getValue(); if (key.equals(DEFINED_KEY)) { result.defineAll(((Integer) val).intValue()); } else { try { EAttribute ea = EAttribute.forAttribute((Attribute) key); if (ea != null) { result.set(ea, val); } } catch (ClassCastException ex) { } } } } return result; }
public static AffineTransform getCharTransform(Map<?, ?> map) { if (map != null) { AttributeValues av = null; if (map instanceof AttributeMap && ((AttributeMap) map).getValues() != null) { av = ((AttributeMap) map).getValues(); } else if (map.get(TextAttribute.TRANSFORM) != null) { av = AttributeValues.fromMap((Map<Attribute, ?>) map); // yuck } if (av != null) { return av.charTransform; } } return null; }