Examples of AttributeSet


Examples of com.cburch.logisim.data.AttributeSet

      }
    }
   
    ComponentFactory source = getFactory();
    if (source != null) {
      AttributeSet base = getBaseAttributes();
      source.paintIcon(c, x, y, base);
    }
  }
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

    if (ret == null) {
      ComponentFactory source = getFactory();
      if (source == null) {
        ret = Bounds.EMPTY_BOUNDS;
      } else {
        AttributeSet base = getBaseAttributes();
        ret = source.getOffsetBounds(base).expand(5);
      }
      bounds = ret;
    }
    return ret;
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

    painter.drawLabel();
  }
 
  private void drawCircuitLabel(InstancePainter painter, Bounds bds,
      Direction facing, Direction defaultFacing) {
    AttributeSet staticAttrs = source.getStaticAttributes();
    String label = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_ATTR);
    if (label != null && !label.equals("")) {
      Direction up = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_FACING_ATTR);
      Font font = staticAttrs.getValue(CircuitAttributes.CIRCUIT_LABEL_FONT_ATTR);

      int back = label.indexOf('\\');
      int lines = 1;
      boolean backs = false;
      while (back >= 0 && back <= label.length() - 2) {
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

      CircuitMutation xn = new CircuitMutation(circuit);
      for (Component comp : toReplace) {
        xn.remove(comp);
        ComponentFactory factory = compMap.get(comp.getFactory());
        if (factory != null) {
          AttributeSet newAttrs = createAttributes(factory, comp.getAttributeSet());
          xn.add(factory.createComponent(comp.getLocation(), newAttrs));
        }
      }
      xn.execute();
    }
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

      xn.execute();
    }
  }
 
  private static AttributeSet createAttributes(ComponentFactory factory, AttributeSet src) {
    AttributeSet dest = factory.createAttributeSet();
    copyAttributes(dest, src);
    return dest;
  }
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

import com.cburch.logisim.tools.key.KeyConfigurationEvent;
import com.cburch.logisim.tools.key.KeyConfigurationResult;

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

Examples of com.cburch.logisim.data.AttributeSet

    return Strings.get("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

Examples of com.cburch.logisim.data.AttributeSet

    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

Examples of com.cburch.logisim.data.AttributeSet

      Object value = values.get(i);
      if (circuit.contains(comp)) {
        oldValues.add(null);
        xn.set(comp, attr, value);
      } else {
        AttributeSet compAttrs = comp.getAttributeSet();
        oldValues.add(compAttrs.getValue(attr));
        compAttrs.setValue(attr, value);   
      }
    }
   
    if (!xn.isEmpty()) {
      CircuitTransactionResult result = xn.execute();
View Full Code Here

Examples of com.cburch.logisim.data.AttributeSet

    } else if (control == Value.ERROR || control == Value.UNKNOWN) {
      state.setPort(0, Value.createError(width), GateAttributes.DELAY);
    } else {
      Value out;
      if (control == Value.UNKNOWN || control == Value.NIL) {
        AttributeSet opts = state.getProject().getOptions().getAttributeSet();
        if (opts.getValue(Options.ATTR_GATE_UNDEFINED)
            .equals(Options.GATE_UNDEFINED_ERROR)) {
          out = Value.createError(width);
        } else {
          out = Value.createUnknown(width);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.