private static LinkedHashMap<Attribute<Object>,Object> computeAttributes(Collection<Component> newSel) {
LinkedHashMap<Attribute<Object>,Object> attrMap;
attrMap = new LinkedHashMap<Attribute<Object>,Object>();
Iterator<Component> sit = newSel.iterator();
if (sit.hasNext()) {
AttributeSet first = sit.next().getAttributeSet();
for (Attribute<?> attr : first.getAttributes()) {
@SuppressWarnings("unchecked")
Attribute<Object> attrObj = (Attribute<Object>) attr;
attrMap.put(attrObj, first.getValue(attr));
}
while (sit.hasNext()) {
AttributeSet next = sit.next().getAttributeSet();
Iterator<Attribute<Object>> ait = attrMap.keySet().iterator();
while (ait.hasNext()) {
Attribute<Object> attr = ait.next();
if (next.containsAttribute(attr)) {
Object v = attrMap.get(attr);
if (v != null && !v.equals(next.getValue(attr))) {
attrMap.put(attr, null);
}
} else {
ait.remove();
}