Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


    private void viewAttributes(Tool newTool, boolean force) {
        viewAttributes(null, newTool, force);
    }

    private void viewAttributes(Tool oldTool, Tool newTool, boolean force) {
        AttributeSet newAttrs;
        if (newTool == null) {
            newAttrs = null;
            if (!force) {
                return;
            }
View Full Code Here


    }

    @Override
    public <E> E getAttributeValue(Attribute<E> attr) {
        InstanceComponent c = comp;
        AttributeSet as = c == null ? attrs : c.getAttributeSet();
        return as.getValue(attr);
    }
View Full Code Here

            this.instance = instance;
        }

        @Override
        public void computeExpression(Map<Location,Expression> expressionMap) {
            AttributeSet attrs = instance.getAttributeSet();
            int intValue = attrs.getValue(ATTR_VALUE).intValue();

            expressionMap.put(instance.getLocation(),
                    Expressions.constant(intValue));
        }
View Full Code Here

import com.cburch.logisim.tools.key.KeyConfigurationResult;
import static com.cburch.logisim.util.LocaleString.*;

public class ToolAttributeAction extends Action {
    public static Action create(Tool tool, Attribute<?> attr, Object value) {
        AttributeSet attrs = tool.getAttributeSet();
        KeyConfigurationEvent e = new KeyConfigurationEvent(0, attrs, null, null);
        KeyConfigurationResult r = new KeyConfigurationResult(e, attr, value);
        return new ToolAttributeAction(r);
    }
View Full Code Here

        return getFromLocale("changeToolAttrAction");
    }

    @Override
    public void doIt(Project proj) {
        AttributeSet attrs = config.getEvent().getAttributeSet();
        Map<Attribute<?>,Object> newValues = config.getAttributeValues();
        Map<Attribute<?>,Object> oldValues = new HashMap<Attribute<?>,Object>(newValues.size());
        for (Map.Entry<Attribute<?>,Object> entry : newValues.entrySet()) {
            @SuppressWarnings("unchecked")
            Attribute<Object> attr = (Attribute<Object>) entry.getKey();
            oldValues.put(attr, attrs.getValue(attr));
            attrs.setValue(attr, entry.getValue());
        }
        this.oldValues = oldValues;
    }
View Full Code Here

        this.oldValues = oldValues;
    }

    @Override
    public void undo(Project proj) {
        AttributeSet attrs = config.getEvent().getAttributeSet();
        Map<Attribute<?>,Object> oldValues = this.oldValues;
        for (Map.Entry<Attribute<?>,Object> entry : oldValues.entrySet()) {
            @SuppressWarnings("unchecked")
            Attribute<Object> attr = (Attribute<Object>) entry.getKey();
            attrs.setValue(attr, entry.getValue());
        }
    }
View Full Code Here

    private HashMap<Component,Component> copyComponents(Collection<Component> components,
            int dx, int dy) {
        HashMap<Component,Component> ret = new HashMap<Component,Component>();
        for (Component comp : components) {
            Location oldLoc = comp.getLocation();
            AttributeSet attrs = (AttributeSet) comp.getAttributeSet().clone();
            int newX = oldLoc.getX() + dx;
            int newY = oldLoc.getY() + dy;
            Object snap = comp.getFactory().getFeature(ComponentFactory.SHOULD_SNAP, attrs);
            if (snap == null || ((Boolean) snap).booleanValue()) {
                newX = Canvas.snapXToGrid(newX);
View Full Code Here

    private Clipboard(Selection sel, AttributeSet viewAttrs) {
        components = new HashSet<Component>();
        oldAttrs = null;
        newAttrs = null;
        for (Component base : sel.getComponents()) {
            AttributeSet baseAttrs = base.getAttributeSet();
            AttributeSet copyAttrs = (AttributeSet) baseAttrs.clone();
            Component copy = base.getFactory().createComponent(base.getLocation(),
                    copyAttrs);
            components.add(copy);
            if (baseAttrs == viewAttrs) {
                oldAttrs = baseAttrs;
View Full Code Here

    }

    @Override
    public AttributeSet createAttributeSet() {
        Attribute<?>[] as = attrs;
        AttributeSet ret = as == null ? AttributeSets.EMPTY : AttributeSets.fixedSet(as, defaults);
        return ret;
    }
View Full Code Here

                    return defaults[i];
                }
            }
            return null;
        } else {
            AttributeSet dfltSet = defaultSet;
            if (dfltSet == null) {
                dfltSet = createAttributeSet();
                defaultSet = dfltSet;
            }
            return dfltSet.getValue(attr);
        }
    }
View Full Code Here

TOP

Related Classes of com.cburch.logisim.data.AttributeSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.