use of com.cburch.logisim.data.AttributeListener in project logisim-evolution by reds-heig.
the class AbstractCanvasObject method setValue.
public final <V> void setValue(Attribute<V> attr, V value) {
Object old = getValue(attr);
boolean same = old == null ? value == null : old.equals(value);
if (!same) {
updateValue(attr, value);
AttributeEvent e = new AttributeEvent(this, attr, value, old);
for (AttributeListener listener : listeners) {
listener.attributeValueChanged(e);
}
}
}
use of com.cburch.logisim.data.AttributeListener in project logisim-evolution by reds-heig.
the class DrawingAttributeSet method setValue.
public <V> void setValue(Attribute<V> attr, V value) {
Iterator<Attribute<?>> ait = attrs.iterator();
ListIterator<Object> vit = values.listIterator();
while (ait.hasNext()) {
Object a = ait.next();
vit.next();
if (a.equals(attr)) {
vit.set(value);
AttributeEvent e = new AttributeEvent(this, attr, value, null);
for (AttributeListener listener : listeners) {
listener.attributeValueChanged(e);
}
if (attr == DrawAttr.PAINT_TYPE) {
e = new AttributeEvent(this);
for (AttributeListener listener : listeners) {
listener.attributeListChanged(e);
}
}
return;
}
}
throw new IllegalArgumentException(attr.toString());
}
Aggregations