Package org.freeplane.n3.nanoxml

Examples of org.freeplane.n3.nanoxml.XMLAttribute


  }

  public void writeContent(final ITreeWriter writer, final Object element, final IExtension extension)
          throws IOException {
    final UnknownElements elements = (UnknownElements) extension;
    final XMLElement unknownElements = elements.getUnknownElements();
    if (unknownElements != null) {
      final Enumeration<XMLElement> unknownChildren = unknownElements.enumerateChildren();
      while (unknownChildren.hasMoreElements()) {
        writer.addElement(null, unknownChildren.nextElement());
      }
    }
  }
View Full Code Here


    }
  }

  private void writeAttributesGenerateContent(final ITreeWriter writer, final NodeModel node) {
    /** fc, 12.6.2005: XML must not contain any zero characters. */
    xmlNode = new XMLElement();
    EncryptionModel encryptionModel = EncryptionModel.getModel(node);
    mayWriteChildren = true;
    final Object mode = mode(writer);
    final boolean isNodeAlreadyWritten = isAlreadyWritten(node);
    if (encryptionModel != null && !(encryptionModel.isAccessible() && Mode.EXPORT.equals(mode)) && ! isNodeAlreadyWritten) {
View Full Code Here

  public static String getNameKey(final String name) {
        return "addons." + name;
    }

  public XMLElement toXml() {
    final XMLElement xmlElement = super.toXml();
    addScriptsAsChild(xmlElement);
        addLibAsChild(xmlElement);
    return xmlElement;
  }
View Full Code Here

        addLibAsChild(xmlElement);
    return xmlElement;
  }

  private void addScriptsAsChild(XMLElement parent) {
    XMLElement xmlElement = new XMLElement("scripts");
    for (Script script : scripts) {
      XMLElement scriptXmlElement = new XMLElement("script");
      scriptXmlElement.setAttribute("name", script.name);
      scriptXmlElement.setAttribute("menuTitleKey", script.menuTitleKey);
      scriptXmlElement.setAttribute("menuLocation", script.menuLocation);
      scriptXmlElement.setAttribute("executionMode", script.executionMode.toString());
      final List<String> permissionNames = ScriptingPermissions.getPermissionNames();
      for (String permission : permissionNames) {
        scriptXmlElement.setAttribute(permission, Boolean.toString(script.permissions.get(permission)));
      }
      xmlElement.addChild(scriptXmlElement);
    }
    parent.addChild(xmlElement);
  }
View Full Code Here

    }
    parent.addChild(xmlElement);
  }

    private void addLibAsChild(XMLElement parent) {
        final XMLElement xmlElement = new XMLElement("libs");
        if (lib != null) {
            for (String l : lib) {
                final XMLElement libElement = new XMLElement("lib");
                libElement.setAttribute("name", l);
                xmlElement.addChild(libElement);
            }
        }
        parent.addChild(xmlElement);
    }
View Full Code Here

  }

  private static final int DEFAULT_COLUMN_WIDTH = 75;
  private void saveLayout(AttributeTableLayoutModel layout, final ITreeWriter writer) throws IOException {
    if (layout != null) {
      XMLElement attributeElement = null;
      if (layout.getColumnWidth(0) != DEFAULT_COLUMN_WIDTH) {
        attributeElement = initializeNodeAttributeLayoutXMLElement(attributeElement);
        attributeElement.setAttribute("NAME_WIDTH", Integer.toString(layout.getColumnWidth(0)));
      }
      if (layout.getColumnWidth(1) != DEFAULT_COLUMN_WIDTH) {
        attributeElement = initializeNodeAttributeLayoutXMLElement(attributeElement);
        attributeElement.setAttribute("VALUE_WIDTH", Integer.toString(layout.getColumnWidth(1)));
      }
      if (attributeElement != null) {
        writer.addElement(layout, attributeElement);
      }
    }
View Full Code Here

      }
    }
  }
  private XMLElement initializeNodeAttributeLayoutXMLElement(XMLElement attributeElement) {
    if (attributeElement == null) {
      attributeElement = new XMLElement();
      attributeElement.setName(AttributeBuilder.XML_NODE_ATTRIBUTE_LAYOUT);
    }
    return attributeElement;
  }
View Full Code Here

  static final String ATTRIB_NAME = "SCRIPT"; // for backward compatibility
  final private IScript script;
  private boolean errorReported = false;

  static ASelectableCondition load(final XMLElement element) {
      final XMLElement child = element.getFirstChildNamed(TAG_NAME);
      if (child != null) {
    return new ScriptCondition(child.getContent());
      } else {
    // read attribute for backward compatibility
    return new ScriptCondition(element.getAttribute(ATTRIB_NAME, null));
      }
  }
View Full Code Here

    }
    return attributeElement;
  }

  private void saveAttribute(NodeModel node, final ITreeWriter writer, final Attribute attr) throws IOException {
    final XMLElement attributeElement = new XMLElement();
    attributeElement.setName(AttributeBuilder.XML_NODE_ATTRIBUTE);
    attributeElement.setAttribute("NAME", attr.getName());
    final Object value = attr.getValue();
    final boolean forceFormatting = Boolean.TRUE.equals(writer.getHint(MapWriter.WriterHint.FORCE_FORMATTING));
    if (forceFormatting) {
      attributeElement.setAttribute("VALUE", TextController.getController().getTransformedTextNoThrow(value, node, null));
    }
    else{
      attributeElement.setAttribute("VALUE", value.toString());
      if(! (value  instanceof String))
        attributeElement.setAttribute("OBJECT", TypeReference.toSpec(value));
    }
    writer.addElement(attr, attributeElement);
  }
View Full Code Here

      }
  }

  @Override
    public void fillXML(final XMLElement element) {
    final XMLElement child = new XMLElement(TAG_NAME);
    super.fillXML(element);
    child.setContent(script.getScript().toString());
    element.addChild(child);
  }
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.