Package net.n3.nanoxml

Examples of net.n3.nanoxml.XMLElement


    }
  }

  void saveConditions(final DefaultComboBoxModel filterConditionModel, final String pathToFilterFile)
          throws IOException {
    final XMLElement saver = new XMLElement();
    saver.setName("filter_conditions");
    final Writer writer = new FileWriter(pathToFilterFile);
    for (int i = 0; i < filterConditionModel.getSize(); i++) {
      final ASelectableCondition cond = (ASelectableCondition) filterConditionModel.getElementAt(i);
      if (cond != null && !(cond instanceof NoFilteringCondition)) {
        cond.toXml(saver);
View Full Code Here


    public List<Parser> getParsers() {
        return new ArrayList<Parser>(parsers);
    }

  public XMLElement toXml() {
    final XMLElement xmlElement = new XMLElement(ELEM_SCANNER);
    xmlElement.setAttribute(ATTRIB_LOCALE, StringUtils.join(locales.iterator(), ","));
    if (isDefault)
    xmlElement.setAttribute(ATTRIB_DEFAULT, "true");
    xmlElement.addChild(firstCharsToXml());
    for (Parser parser : parsers) {
      xmlElement.addChild(parser.toXml());
    }
    return xmlElement;
  }
View Full Code Here

    }
    return xmlElement;
  }

  private XMLElement firstCharsToXml() {
    final XMLElement xmlElement = new XMLElement(ELEM_CHECKFIRSTCHAR);
    if (checkFirstChars)
      xmlElement.setAttribute(ATTRIB_CHARS, firstChars);
    else
      xmlElement.setAttribute(ATTRIB_DISABLED, "true");
    return xmlElement;
  }
View Full Code Here

    final EdgeStyle styleObj = forceFormatting ? ec.getStyle(node) : model.getStyle();
    final String style = EdgeStyle.toString(styleObj);
    final Color color = forceFormatting ? ec.getColor(node) : model.getColor();
    final int width = forceFormatting ? ec.getWidth(node) : model.getWidth();
    if (forceFormatting || style != null || color != null || width != EdgeModel.DEFAULT_WIDTH) {
      final XMLElement edge = new XMLElement();
      edge.setName("edge");
      boolean relevant = false;
      if (style != null) {
        if (style.equals(EdgeStyle.EDGESTYLE_HIDDEN)) {
          edge.setAttribute("HIDE", "true");
          relevant = true;
        }
        edge.setAttribute("STYLE", style);
        relevant = true;
      }
      if (color != null) {
        edge.setAttribute("COLOR", ColorUtils.colorToString(color));
        relevant = true;
      }
      if (width != EdgeModel.WIDTH_PARENT) {
        if (width == EdgeModel.WIDTH_THIN) {
          edge.setAttribute("WIDTH", EdgeModel.EDGEWIDTH_THIN);
        }
        else {
          edge.setAttribute("WIDTH", Integer.toString(width));
        }
        relevant = true;
      }
      if (relevant) {
        writer.addElement(model, edge);
View Full Code Here

      super("option_panel_window_configuration_storage");
    }

  public static OptionPanelWindowConfigurationStorage decorateDialog(final String marshalled, final JDialog dialog) {
    final OptionPanelWindowConfigurationStorage storage = new OptionPanelWindowConfigurationStorage();
    final XMLElement xml = storage.unmarschall(marshalled, dialog);
    if (xml != null) {
      storage.panel = xml.getAttribute("panel", null);
      return storage;
    }
    return null;
  }
View Full Code Here

  //     }
  //   }
  // }
  // writer.close()
  public XMLElement toXml() {
    final XMLElement addonElement = new XMLElement("addon");
    addonElement.setAttribute("name", name);
    addonElement.setAttribute("version", version);
    addonElement.setAttribute("latestVersion", latestVersion == null ? "" : latestVersion);
    addonElement.setAttribute("freeplaneVersionFrom", freeplaneVersionFrom.toString());
    if (freeplaneVersionTo != null)
      addonElement.setAttribute("freeplaneVersionTo", freeplaneVersionTo.toString());
    if (homepage != null)
      addonElement.setAttribute("homepage", homepage.toString());
    if (updateUrl != null)
      addonElement.setAttribute("updateUrl", updateUrl.toString());
    if (author != null)
      addonElement.setAttribute("author", author);
    addonElement.setAttribute("active", Boolean.toString(active));
    addAsChildWithContent(addonElement, "description", description);
    addAsChildWithContent(addonElement, "license", license);
    addAsChildWithContent(addonElement, "preferences.xml", preferencesXml);
    addTranslationsAsChild(addonElement);
    addDefaultPropertiesAsChild(addonElement);
View Full Code Here

    addDeinstallationRulesAsChild(addonElement);
    return addonElement;
  }

  private void addAsChildWithContent(XMLElement parent, String name, String content) {
    final XMLElement xmlElement = new XMLElement(name);
    xmlElement.setContent(content);
    parent.addChild(xmlElement);
  }
View Full Code Here

    xmlElement.setContent(content);
    parent.addChild(xmlElement);
  }

  private void addTranslationsAsChild(XMLElement parent) {
    final XMLElement translationsElement = new XMLElement("translations");
    for (Entry<String, Map<String, String>> localeEntry : translations.entrySet()) {
      final XMLElement localeElement = new XMLElement("locale");
      localeElement.setAttribute("name", localeEntry.getKey());
      for (Entry<String, String> translationEntry : localeEntry.getValue().entrySet()) {
        final XMLElement translationElement = new XMLElement("entry");
        translationElement.setAttribute("key", translationEntry.getKey());
        translationElement.setContent(StringEscapeUtils.escapeJava(translationEntry.getValue()));
        localeElement.addChild(translationElement);
      }
      translationsElement.addChild(localeElement);
    }
    parent.addChild(translationsElement);
View Full Code Here

    }
    parent.addChild(translationsElement);
  }

  private void addDefaultPropertiesAsChild(XMLElement parent) {
    final XMLElement xmlElement = new XMLElement("default.properties");
    for (Entry<String, String> entry : defaultProperties.entrySet()) {
      xmlElement.setAttribute(entry.getKey(), entry.getValue());
    }
    parent.addChild(xmlElement);
  }
View Full Code Here

    }
    parent.addChild(xmlElement);
  }

    private void addImagesAsChild(XMLElement parent) {
        final XMLElement xmlElement = new XMLElement("images");
        if (images != null) {
            for (String image : images) {
                final XMLElement imageElement = new XMLElement("image");
                imageElement.setAttribute("name", image);
                xmlElement.addChild(imageElement);
            }
        }
        parent.addChild(xmlElement);
    }
View Full Code Here

TOP

Related Classes of net.n3.nanoxml.XMLElement

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.