Search in sources :

Example 6 with XMLWriter

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

the class FilterController method saveConditions.

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);
        }
    }
    final XMLWriter xmlWriter = new XMLWriter(writer);
    xmlWriter.write(saver, true);
    writer.close();
}
Also used : FileWriter(java.io.FileWriter) NoFilteringCondition(org.freeplane.features.filter.condition.NoFilteringCondition) XMLElement(org.freeplane.n3.nanoxml.XMLElement) XMLWriter(org.freeplane.n3.nanoxml.XMLWriter) Writer(java.io.Writer) FileWriter(java.io.FileWriter) XMLWriter(org.freeplane.n3.nanoxml.XMLWriter) ASelectableCondition(org.freeplane.features.filter.condition.ASelectableCondition)

Aggregations

XMLElement (org.freeplane.n3.nanoxml.XMLElement)5 XMLWriter (org.freeplane.n3.nanoxml.XMLWriter)4 FileWriter (java.io.FileWriter)3 Writer (java.io.Writer)3 IOException (java.io.IOException)2 StringWriter (java.io.StringWriter)2 TreeXmlWriter (org.freeplane.core.io.xml.TreeXmlWriter)1 ASelectableCondition (org.freeplane.features.filter.condition.ASelectableCondition)1 NoFilteringCondition (org.freeplane.features.filter.condition.NoFilteringCondition)1 CdataContentXmlWriter (org.freeplane.n3.nanoxml.CdataContentXmlWriter)1