Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.XMLAttribute


    xmlwriter.write(comment);
    xmlwriter.write(" -->\n");
  }

  public void addElement(final Object userObject, final String name) throws IOException {
    final XMLElement element = new XMLElement(name);
    addElement(userObject, element);
  }
View Full Code Here


      return;
    final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
    final NodeModel node = (NodeModel) element;
    final Collection<MindIcon> icons = forceFormatting ? IconController.getController().getIcons(node) : node.getIcons();
    for (MindIcon icon : icons) {
      final XMLElement iconElement = new XMLElement();
      iconElement.setName("icon");
      iconElement.setAttribute("BUILTIN", icon.getName());
      writer.addElement(node, iconElement);
    }
  }
View Full Code Here

    xmlBuilder.elementAttributesProcessed(name, nsPrefix, nsURI);
    if (saveAsXmlUntil != null || nodeCreator != null) {
      return;
    }
    final Iterator<IElementHandler> iterator = getElementHandlers().iterator(tag);
    final XMLElement lastBuiltElement = xmlBuilder.getLastBuiltElement();
    while (iterator.hasNext() && currentElement == null) {
      nodeCreator = iterator.next();
      currentElement = nodeCreator.createElement(parentElement, name, lastBuiltElement);
    }
    if (currentElement != null) {
      if (nodeCreator instanceof IElementContentHandler) {
        parser.notParseNextElementContent();
      }
      attributeHandlersForTag = getAttributeLoaders().get(tag);
      if (attributeHandlersForTag == null) {
        return;
      }
      final Enumeration<String> attributeNames = lastBuiltElement.enumerateAttributeNames();
      while (attributeNames.hasMoreElements()) {
        final String atName = (String) attributeNames.nextElement();
        if (addAttribute(atName, lastBuiltElement.getAttribute(atName, null))) {
          lastBuiltElement.removeAttribute(atName);
        }
      }
    }
    else {
      currentElement = null;
View Full Code Here

   * @see
   * freeplane.persistence.xml.n3.nanoxml.IXMLBuilder#endElement(java.lang
   * .String, java.lang.String, java.lang.String)
   */
  public void endElement(final String name, final String nsPrefix, final String nsURI) throws Exception {
    final XMLElement lastBuiltElement = xmlBuilder.getParentElement();
    xmlBuilder.endElement(name, nsPrefix, nsURI);
    if (saveAsXmlUntil == lastBuiltElement) {
      saveAsXmlUntil = null;
    }
    if (saveAsXmlUntil != null) {
      return;
    }
    tag = null;
    if (0 == elementStack.size()) {
      return;
    }
    final Object element = currentElement;
    currentElement = elementStack.removeLast();
    if (nodeCreator instanceof IElementContentHandler) {
      ((IElementContentHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement,
          elementContentAsString);
    }
    else if (nodeCreator instanceof IElementDOMHandler) {
      ((IElementDOMHandler) nodeCreator).endElement(currentElement, name, element, lastBuiltElement);
    }
    final XMLElement top = lastBuiltElement.getParent();
    if (nodeCreator != null && top != null && top.hasChildren()) {
      final int lastChildIndex = top.getChildrenCount() - 1;
      top.removeChildAtIndex(lastChildIndex);
    }
    nodeCreator = (IElementHandler) nodeCreatorStack.removeLast();
    elementContentAsString = null;
  }
View Full Code Here

  public int getY() {
    return y;
  }

  private String marshall() {
    final XMLElement xml = new XMLElement();
    xml.setAttribute("x", Integer.toString(x));
    xml.setAttribute("y", Integer.toString(y));
    xml.setAttribute("width", Integer.toString(width));
    xml.setAttribute("height", Integer.toString(height));
    xml.setName(name);
    marshallSpecificElements(xml);
    final StringWriter string = new StringWriter();
    final XMLWriter writer = new XMLWriter(string);
    try {
      writer.write(xml);
View Full Code Here

        if (prettyPrint) {
          writer.println();
        }
        Enumeration<XMLElement> enumeration = xml.enumerateChildren();
        while (enumeration.hasMoreElements()) {
          final XMLElement child = enumeration.nextElement();
          this.write(child, prettyPrint, indent + 4, collapseEmptyElements, true);
        }
        if (prettyPrint) {
          for (int i = 0; i < indent; i++) {
            writer.print(' ');
View Full Code Here

    if (marshalled != null) {
      final IXMLParser parser = XMLParserFactory.createDefaultXMLParser();
      final IXMLReader xmlReader = new StdXMLReader(new StringReader(marshalled));
      parser.setReader(xmlReader);
      try {
        final XMLElement storage = (XMLElement) parser.parse();
        if (storage != null) {
          x = Integer.parseInt(storage.getAttribute("x", "-1"));
          y = Integer.parseInt(storage.getAttribute("y", "-1"));
          width = Integer.parseInt(storage.getAttribute("width", "-1"));
          height = Integer.parseInt(storage.getAttribute("height", "-1"));
          UITools.setBounds(dialog, x, y, width, height);
          return storage;
        }
      }
      catch (final NumberFormatException e) {
View Full Code Here

    parser.setComment(comment);
    return parser;
  }

  public XMLElement toXml() {
    final XMLElement xmlElement = new XMLElement("parser");
    xmlElement.setAttribute("type", getType());
    xmlElement.setAttribute("style", getStyle());
    if (getFormat() != null)
      xmlElement.setAttribute("format", getFormat());
    if (getComment() != null)
      xmlElement.setAttribute("comment", getComment());
    return xmlElement;
  }
View Full Code Here

      super("manage_style_editor_window_configuration_storage");
    }

  public static ScriptEditorWindowConfigurationStorage decorateDialog(final String marshalled, final JDialog dialog) {
    final ScriptEditorWindowConfigurationStorage storage = new ScriptEditorWindowConfigurationStorage();
    final XMLElement xml = storage.unmarschall(marshalled, dialog);
    if (xml != null) {
      storage.leftRatio = Integer.parseInt(xml.getAttribute("left_ratio", null));
      storage.topRatio = Integer.parseInt(xml.getAttribute("top_ratio", null));
      return storage;
    }
    return null;
  }
View Full Code Here

    if(! NodeWriter.shouldWriteSharedContent(writer))
      return;
    final NodeModel node = (NodeModel) element;
    final TransformedXMLExtension transformedXML = node.getExtension(TransformedXMLExtension.class);
    if (transformedXML != null || node.getXmlText() != null) {
      final XMLElement htmlElement = new XMLElement();
      htmlElement.setName(NodeTextBuilder.XML_NODE_XHTML_CONTENT_TAG);
      htmlElement.setAttribute(NodeTextBuilder.XML_NODE_XHTML_TYPE_TAG, NodeTextBuilder.XML_NODE_XHTML_TYPE_NODE);
      final String xmlText;
      if (transformedXML != null){
        xmlText = transformedXML.xml;
        node.removeExtension(transformedXML);
      }
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.