Search in sources :

Example 51 with XMLElement

use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.

the class PatternFormat method toXml.

public XMLElement toXml() {
    final XMLElement xmlElement = new XMLElement(ELEMENT_NAME);
    xmlElement.setAttribute("type", getType());
    xmlElement.setAttribute("style", getStyle());
    if (getName() != null)
        xmlElement.setAttribute("name", getName());
    if (getLocale() != null)
        xmlElement.setAttribute("locale", getLocale().toString());
    xmlElement.setContent(getPattern());
    return xmlElement;
}
Also used : XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Example 52 with XMLElement

use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.

the class ReminderHook method createExtension.

@Override
protected IExtension createExtension(final NodeModel node, final XMLElement element) {
    final ReminderExtension reminderExtension = new ReminderExtension(node);
    final XMLElement parameters = element.getFirstChildNamed("Parameters");
    final String time = parameters.getAttribute(REMINDUSERAT, "0");
    final String unit = parameters.getAttribute(UNIT, "DAY");
    final String period = parameters.getAttribute(PERIOD, "1");
    reminderExtension.setRemindUserAt(Long.parseLong(time));
    reminderExtension.setPeriodUnit(PeriodUnit.valueOf(unit));
    reminderExtension.setPeriod(Integer.parseInt(period));
    final String script = parameters.getAttribute(SCRIPT, null);
    reminderExtension.setScript(script);
    return reminderExtension;
}
Also used : XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Example 53 with XMLElement

use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.

the class EdgeBuilder method writeContent.

private void writeContent(final ITreeWriter writer, final NodeModel node, final EdgeModel model, final boolean forceFormatting) throws IOException {
    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();
    final DashVariant dash = forceFormatting ? ec.getDash(node) : model.getDash();
    if (forceFormatting || style != null || color != null || width != EdgeModel.DEFAULT_WIDTH || dash != null) {
        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) {
            ColorUtils.setColorAttributes(edge, "COLOR", "ALPHA", 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 (dash != null) {
            edge.setAttribute("DASH", dash.name());
            relevant = true;
        }
        if (relevant) {
            writer.addElement(model, edge);
        }
    }
}
Also used : DashVariant(org.freeplane.features.DashVariant) Color(java.awt.Color) XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Example 54 with XMLElement

use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.

the class OptionPanelWindowConfigurationStorage method decorateDialog.

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;
}
Also used : XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Example 55 with XMLElement

use of org.freeplane.n3.nanoxml.XMLElement in project freeplane by freeplane.

the class UnknownElementWriter method writeAttributes.

public void writeAttributes(final ITreeWriter writer, final Object userObject, final IExtension extension) {
    final UnknownElements elements = (UnknownElements) extension;
    final XMLElement unknownElements = elements.getUnknownElements();
    if (unknownElements != null) {
        final Enumeration<String> unknownAttributes = unknownElements.enumerateAttributeNames();
        while (unknownAttributes.hasMoreElements()) {
            final String name = unknownAttributes.nextElement();
            final String value = unknownElements.getAttribute(name, null);
            writer.addAttribute(name, value);
        }
    }
}
Also used : XMLElement(org.freeplane.n3.nanoxml.XMLElement)

Aggregations

XMLElement (org.freeplane.n3.nanoxml.XMLElement)63 IOException (java.io.IOException)8 IXMLParser (org.freeplane.n3.nanoxml.IXMLParser)7 IXMLReader (org.freeplane.n3.nanoxml.IXMLReader)7 StdXMLReader (org.freeplane.n3.nanoxml.StdXMLReader)7 BufferedInputStream (java.io.BufferedInputStream)5 File (java.io.File)5 FileInputStream (java.io.FileInputStream)5 ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)5 NodeModel (org.freeplane.features.map.NodeModel)5 XMLWriter (org.freeplane.n3.nanoxml.XMLWriter)4 Color (java.awt.Color)3 FileWriter (java.io.FileWriter)3 Writer (java.io.Writer)3 IXMLElement (net.n3.nanoxml.IXMLElement)3 XMLElement (net.n3.nanoxml.XMLElement)3 XMLException (org.freeplane.n3.nanoxml.XMLException)3 Point (java.awt.Point)2 FilenameFilter (java.io.FilenameFilter)2 HashMap (java.util.HashMap)2