use of com.cburch.draw.model.AttributeMapKey in project logisim-evolution by reds-heig.
the class AttrTableSelectionModel method setValueRequested.
@Override
public void setValueRequested(Attribute<Object> attr, Object value) throws AttrTableSetException {
SelectionAttributes attrs = (SelectionAttributes) getAttributeSet();
Map<AttributeMapKey, Object> oldVals;
oldVals = new HashMap<AttributeMapKey, Object>();
Map<AttributeMapKey, Object> newVals;
newVals = new HashMap<AttributeMapKey, Object>();
for (Map.Entry<AttributeSet, CanvasObject> ent : attrs.entries()) {
AttributeMapKey key = new AttributeMapKey(attr, ent.getValue());
oldVals.put(key, ent.getKey().getValue(attr));
newVals.put(key, value);
}
CanvasModel model = canvas.getModel();
canvas.doAction(new ModelChangeAttributeAction(model, oldVals, newVals));
fireTitleChanged();
}
use of com.cburch.draw.model.AttributeMapKey in project logisim-evolution by reds-heig.
the class ModelChangeAttributeAction method getName.
@Override
public String getName() {
Attribute<?> a = attr;
if (a == null) {
boolean found = false;
for (AttributeMapKey key : newValues.keySet()) {
Attribute<?> at = key.getAttribute();
if (found) {
if (a == null ? at != null : !a.equals(at)) {
a = null;
break;
}
} else {
found = true;
a = at;
}
}
attr = a;
}
if (a == null) {
return Strings.get("actionChangeAttributes");
} else {
return Strings.get("actionChangeAttribute", a.getDisplayName());
}
}
Aggregations