Search in sources :

Example 11 with CanvasModel

use of com.cburch.draw.model.CanvasModel 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();
}
Also used : AttributeMapKey(com.cburch.draw.model.AttributeMapKey) CanvasObject(com.cburch.draw.model.CanvasObject) AttributeSet(com.cburch.logisim.data.AttributeSet) CanvasObject(com.cburch.draw.model.CanvasObject) CanvasModel(com.cburch.draw.model.CanvasModel) ModelChangeAttributeAction(com.cburch.draw.actions.ModelChangeAttributeAction) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

CanvasModel (com.cburch.draw.model.CanvasModel)11 CanvasObject (com.cburch.draw.model.CanvasObject)6 ModelAddAction (com.cburch.draw.actions.ModelAddAction)4 Location (com.cburch.logisim.data.Location)3 Selection (com.cburch.draw.canvas.Selection)2 Poly (com.cburch.draw.shapes.Poly)2 Bounds (com.cburch.logisim.data.Bounds)2 ModelChangeAttributeAction (com.cburch.draw.actions.ModelChangeAttributeAction)1 ModelMoveHandleAction (com.cburch.draw.actions.ModelMoveHandleAction)1 ModelRemoveAction (com.cburch.draw.actions.ModelRemoveAction)1 ModelTranslateAction (com.cburch.draw.actions.ModelTranslateAction)1 AttributeMapKey (com.cburch.draw.model.AttributeMapKey)1 Handle (com.cburch.draw.model.Handle)1 HandleGesture (com.cburch.draw.model.HandleGesture)1 Curve (com.cburch.draw.shapes.Curve)1 AttributeSet (com.cburch.logisim.data.AttributeSet)1 Graphics (java.awt.Graphics)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1