Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.XMLAttribute


    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

        }
        parent.addChild(xmlElement);
    }

  private void addDeinstallationRulesAsChild(XMLElement parent) {
      final XMLElement xmlElement = new XMLElement("deinstall");
      for (String[] rule : deinstallationRules) {
          final XMLElement ruleElement = new XMLElement(rule[0]);
          ruleElement.setContent(rule[1]);
          xmlElement.addChild(ruleElement);
      }
      parent.addChild(xmlElement);
  }
View Full Code Here

          return isLast;
        }
   
    public void toXml(XMLElement conditionalStylesRoot)
    {
      final XMLElement itemElement = conditionalStylesRoot.createElement("conditional_style");
      conditionalStylesRoot.addChild(itemElement);
      itemElement.setAttribute("ACTIVE", Boolean.toString(isActive()));
      final IStyle style = getStyle();
      if (style instanceof StyleNamedObject) {
        final String referencedStyle = ((StyleNamedObject)style).getObject().toString();
        itemElement.setAttribute("LOCALIZED_STYLE_REF", referencedStyle);
      }
      else {
        final String referencedStyle = style.toString();
        itemElement.setAttribute("STYLE_REF", referencedStyle);
      }
      itemElement.setAttribute("LAST", Boolean.toString(isLast()));
      if(condition != null)
        condition.toXml(itemElement);

    }
View Full Code Here

      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final URL resource = ResourceController.getResourceController().getResource(xmlDescriptorFile);
      xmlDescriptorStream = resource.openStream();
      final IXMLReader reader = new StdXMLReader(xmlDescriptorStream);
      parser.setReader(reader);
      final XMLElement xml = (XMLElement) parser.parse();
      final Enumeration<XMLElement> actionDescriptors = xml.enumerateChildren();
      while (actionDescriptors.hasMoreElements()) {
        final XMLElement descriptor = actionDescriptors.nextElement();
        final String name = descriptor.getAttribute("name", null);
        final XMLElement xmlProperties = descriptor.getFirstChildNamed("properties");
        final Properties properties = xmlProperties.getAttributes();
        final ExportWithXSLT action = new ExportWithXSLT(name, properties);
        addExportEngine(action.getFileFilter(), action);
      }
    }
    catch (final Exception e) {
View Full Code Here

TOP

Related Classes of org.freeplane.n3.nanoxml.XMLAttribute

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.