Package com.cburch.logisim

Examples of com.cburch.logisim.LogisimVersion


    } catch (ParserConfigurationException ex) { }
    return builder.parse(is);
  }
 
  private void considerRepairs(Document doc, Element root) {
    LogisimVersion version = LogisimVersion.parse(root.getAttribute("source"));
    if (version.compareTo(LogisimVersion.get(2, 3, 0)) < 0) {
      // This file was saved before an Edit tool existed. Most likely
      // we should replace the Select and Wiring tools in the toolbar
      // with the Edit tool instead.
      for (Element toolbar : XmlIterator.forChildElements(root, "toolbar")) {
        Element wiring = null;
        Element select = null;
        Element edit = null;
        for (Element elt : XmlIterator.forChildElements(toolbar, "tool")) {
          String eltName = elt.getAttribute("name");
          if (eltName != null && !eltName.equals("")) {
            if (eltName.equals("Select Tool")) select = elt;
            if (eltName.equals("Wiring Tool")) wiring = elt;
            if (eltName.equals("Edit Tool")) edit = elt;
          }
        }
        if (select != null && wiring != null && edit == null) {
          select.setAttribute("name", "Edit Tool");
          toolbar.removeChild(wiring);
        }
      }
    }
    if (version.compareTo(LogisimVersion.get(2, 6, 3)) < 0) {
      for (Element circElt : XmlIterator.forChildElements(root, "circuit")) {
        for (Element attrElt : XmlIterator.forChildElements(circElt, "a")) {
          String name = attrElt.getAttribute("name");
          if (name != null && name.startsWith("label")) {
            attrElt.setAttribute("name", "c" + name);
View Full Code Here


        }
      }

      if (attrs == null) return;
     
      LogisimVersion ver = sourceVersion;
      boolean setDefaults = defaults != null
        && !defaults.isAllDefaultValues(attrs, ver);
      // We need to process this in order, and we have to refetch the
      // attribute list each time because it may change as we iterate
      // (as it will for a splitter).
View Full Code Here

  }

  void addAttributeSetContent(Element elt, AttributeSet attrs,
      AttributeDefaultProvider source) {
    if (attrs == null) return;
    LogisimVersion ver = Main.VERSION;
    if (source != null && source.isAllDefaultValues(attrs, ver)) return;
    for (Attribute<?> attrBase : attrs.getAttributes()) {
      @SuppressWarnings("unchecked")
      Attribute<Object> attr = (Attribute<Object>) attrBase;
      Object val = attrs.getValue(attr);
View Full Code Here

            AttributeDefaultProvider source) {
        if (attrs == null) {
            return;
        }

        LogisimVersion ver = Main.VERSION;
        if (source != null && source.isAllDefaultValues(attrs, ver)) {
            return;
        }

        for (Attribute<?> attrBase : attrs.getAttributes()) {
View Full Code Here

        } catch (ParserConfigurationException ex) { }
        return builder.parse(is);
    }

    private void considerRepairs(Document doc, Element root) {
        LogisimVersion version = LogisimVersion.parse(root.getAttribute("source"));
        if (version.compareTo(LogisimVersion.get(2, 3, 0)) < 0) {
            // This file was saved before an Edit tool existed. Most likely
            // we should replace the Select and Wiring tools in the toolbar
            // with the Edit tool instead.
            for (Element toolbar : XmlIterator.forChildElements(root, "toolbar")) {
                Element wiring = null;
                Element select = null;
                Element edit = null;
                for (Element elt : XmlIterator.forChildElements(toolbar, "tool")) {
                    String eltName = elt.getAttribute("name");
                    if (eltName != null && !eltName.equals("")) {
                        if (eltName.equals("Select Tool")) {
                            select = elt;
                        }

                        if (eltName.equals("Wiring Tool")) {
                            wiring = elt;
                        }

                        if (eltName.equals("Edit Tool")) {
                            edit = elt;
                        }

                    }
                }
                if (select != null && wiring != null && edit == null) {
                    select.setAttribute("name", "Edit Tool");
                    toolbar.removeChild(wiring);
                }
            }
        }
        if (version.compareTo(LogisimVersion.get(2, 6, 3)) < 0) {
            for (Element circElt : XmlIterator.forChildElements(root, "circuit")) {
                for (Element attrElt : XmlIterator.forChildElements(circElt, "a")) {
                    String name = attrElt.getAttribute("name");
                    if (name != null && name.startsWith("label")) {
                        attrElt.setAttribute("name", "c" + name);
View Full Code Here

            if (attrs == null) {
                return;
            }


            LogisimVersion ver = sourceVersion;
            boolean setDefaults = defaults != null
                && !defaults.isAllDefaultValues(attrs, ver);
            // We need to process this in order, and we have to refetch the
            // attribute list each time because it may change as we iterate
            // (as it will for a splitter).
View Full Code Here

TOP

Related Classes of com.cburch.logisim.LogisimVersion

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.