Package com.cburch.logisim.data

Examples of com.cburch.logisim.data.AttributeSet


    }

    public void attributeListChanged(AttributeEvent e) { }

    public void attributeValueChanged(AttributeEvent e) {
      AttributeSet attrs = e.getSource();
      BitWidth addrBits = attrs.getValue(Mem.ADDR_ATTR);
      BitWidth dataBits = attrs.getValue(Mem.DATA_ATTR);
      getContents().setDimensions(addrBits.getWidth(), dataBits.getWidth());
    }
View Full Code Here


  //
  // static methods - shared with other classes
  //
  static Value repair(InstanceState state, Value v) {
    AttributeSet opts = state.getProject().getOptions().getAttributeSet();
    Object onUndefined = opts.getValue(Options.ATTR_GATE_UNDEFINED);
    boolean errorIfUndefined = onUndefined.equals(Options.GATE_UNDEFINED_ERROR);
    Value repaired;
    if (errorIfUndefined) {
      int vw = v.getWidth();
      BitWidth w = state.getAttributeValue(StdAttr.WIDTH);
View Full Code Here

  private static LinkedHashMap<Attribute<Object>,Object> computeAttributes(Collection<Component> newSel)  {
    LinkedHashMap<Attribute<Object>,Object> attrMap;
    attrMap = new LinkedHashMap<Attribute<Object>,Object>();
    Iterator<Component> sit = newSel.iterator();
    if (sit.hasNext()) {
      AttributeSet first = sit.next().getAttributeSet();
      for (Attribute<?> attr : first.getAttributes()) {
        @SuppressWarnings("unchecked")
        Attribute<Object> attrObj = (Attribute<Object>) attr;
        attrMap.put(attrObj, first.getValue(attr));
      }
      while (sit.hasNext()) {
        AttributeSet next = sit.next().getAttributeSet();
        Iterator<Attribute<Object>> ait = attrMap.keySet().iterator();
        while (ait.hasNext()) {
          Attribute<Object> attr = ait.next();
          if (next.containsAttribute(attr)) {
            Object v = attrMap.get(attr);
            if (v != null && !v.equals(next.getValue(attr))) {
              attrMap.put(attr, null);
            }
          } else {
            ait.remove();
          }
View Full Code Here

    }
  }
 
  private static boolean computeReadOnly(Collection<Component> sel, Attribute<?> attr) {
    for (Component comp : sel) {
      AttributeSet attrs = comp.getAttributeSet();
      if (attrs.isReadOnly(attr)) return true;
    }
    return false;
  }
View Full Code Here

    }
    ComponentFactory source = ((AddTool) tool).getFactory();

    // Determine attributes
    String loc_str = elt.getAttribute("loc");
    AttributeSet attrs = source.createAttributeSet();
    reader.initAttributeSet(elt, attrs, source);

    // Create component if location known
    if (loc_str == null || loc_str.equals("")) {
      throw new XmlReaderException(Strings.get("compLocMissingError", source.getName()));
View Full Code Here

  boolean isFactoryInstantiated() {
    return baseAttrs != null;
  }
 
  AttributeSet getBase() {
    AttributeSet ret = baseAttrs;
    if (ret == null) {
      ComponentFactory fact = factory;
      if (fact == null) {
        fact = desc.getFactory(descBase);
        factory = fact;
      }
      if (fact == null) {
        ret = AttributeSets.EMPTY;
      } else {
        ret = fact.createAttributeSet();
        ret.addAttributeListener(this);
      }
      baseAttrs = ret;
    }
    return ret;
  }
View Full Code Here

      Object newValue) {
    if (circuit.contains(comp)) {
      modified.add(circuit);
      @SuppressWarnings("unchecked")
      Attribute<Object> a = (Attribute<Object>) attr;
      AttributeSet attrs = comp.getAttributeSet();
      Object oldValue = attrs.getValue(a);
      log.add(CircuitChange.set(circuit, comp, attr, oldValue, newValue));
      attrs.setValue(a, newValue);
    }
  }
View Full Code Here

 
  public void setForCircuit(Circuit circuit, Attribute<?> attr,
      Object newValue) {
    @SuppressWarnings("unchecked")
    Attribute<Object> a = (Attribute<Object>) attr;
    AttributeSet attrs = circuit.getStaticAttributes();
    Object oldValue = attrs.getValue(a);
    log.add(CircuitChange.setForCircuit(circuit, attr, oldValue, newValue));
    attrs.setValue(a, newValue);
  }
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

    add(simLimitPanel);
    add(gateUndefinedPanel);
    add(simRandomness);
   
    window.getOptions().getAttributeSet().addAttributeListener(myListener);
    AttributeSet attrs = getOptions().getAttributeSet();
    myListener.loadSimLimit(attrs.getValue(Options.sim_limit_attr));
    myListener.loadGateUndefined(attrs.getValue(Options.ATTR_GATE_UNDEFINED));
    myListener.loadSimRandomness(attrs.getValue(Options.sim_rand_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.