Search in sources :

Example 1 with IExtension

use of org.freeplane.core.extension.IExtension in project freeplane by freeplane.

the class TreeXmlWriter method addExtensionNodes.

public void addExtensionNodes(final Object map, final Collection<IExtension> extensions) throws IOException {
    final Iterator<IExtension> extensionIterator = extensions.iterator();
    while (extensionIterator.hasNext()) {
        final IExtension extension = extensionIterator.next();
        final Iterator<IExtensionElementWriter> writerIterator = writeManager.getExtensionElementWriters().iterator(extension.getClass());
        while (writerIterator.hasNext()) {
            writerIterator.next().writeContent(this, map, extension);
        }
    }
}
Also used : IExtension(org.freeplane.core.extension.IExtension) IExtensionElementWriter(org.freeplane.core.io.IExtensionElementWriter)

Example 2 with IExtension

use of org.freeplane.core.extension.IExtension in project freeplane by freeplane.

the class TreeXmlWriter method addExtensionAttributes.

public void addExtensionAttributes(final Object map, final Collection<IExtension> extensions) {
    final Iterator<IExtension> extensionIterator = extensions.iterator();
    while (extensionIterator.hasNext()) {
        final IExtension extension = extensionIterator.next();
        final Iterator<IExtensionAttributeWriter> writerIterator = writeManager.getExtensionAttributeWriters().iterator(extension.getClass());
        while (writerIterator.hasNext()) {
            writerIterator.next().writeAttributes(this, map, extension);
        }
    }
}
Also used : IExtensionAttributeWriter(org.freeplane.core.io.IExtensionAttributeWriter) IExtension(org.freeplane.core.extension.IExtension)

Example 3 with IExtension

use of org.freeplane.core.extension.IExtension in project freeplane by freeplane.

the class AttributeBuilder method registerBy.

/**
 */
public void registerBy(final ReadManager reader, final WriteManager writer) {
    reader.addElementHandler("attribute_registry", this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_ATTRIBUTE, this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_NAME, this);
    reader.addElementHandler(AttributeBuilder.XML_NODE_REGISTERED_ATTRIBUTE_VALUE, this);
    writer.addExtensionElementWriter(NodeAttributeTableModel.class, new IExtensionElementWriter() {

        public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
            final NodeAttributeTableModel attributes = (NodeAttributeTableModel) extension;
            save((NodeModel) node, attributes, writer);
        }
    });
    writer.addExtensionElementWriter(AttributeRegistry.class, new IExtensionElementWriter() {

        public void writeContent(final ITreeWriter writer, final Object node, final IExtension extension) throws IOException {
            final AttributeRegistry attributes = (AttributeRegistry) extension;
            attributes.write(writer);
        }
    });
    registerAttributeHandlers(reader);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IExtension(org.freeplane.core.extension.IExtension) ITreeWriter(org.freeplane.core.io.ITreeWriter) IOException(java.io.IOException) IExtensionElementWriter(org.freeplane.core.io.IExtensionElementWriter)

Example 4 with IExtension

use of org.freeplane.core.extension.IExtension in project freeplane by freeplane.

the class MMapController method moveNodeAsChild.

public void moveNodeAsChild(final NodeModel node, final NodeModel selectedParent, final boolean isLeft, final boolean changeSide) {
    int position = selectedParent.getChildCount();
    if (selectedParent.clones().contains(node.getParentNode())) {
        position--;
    }
    FreeNode r = Controller.getCurrentModeController().getExtension(FreeNode.class);
    final IExtension extension = node.getExtension(FreeNode.class);
    if (extension != null) {
        r.undoableToggleHook(node, extension);
        if (MapStyleModel.FLOATING_STYLE.equals(LogicalStyleModel.getStyle(node)))
            ((MLogicalStyleController) MLogicalStyleController.getController(getMModeController())).setStyle(node, null);
    }
    moveNode(node, selectedParent, position, isLeft, changeSide);
}
Also used : IExtension(org.freeplane.core.extension.IExtension) FreeNode(org.freeplane.features.map.FreeNode) Point(java.awt.Point)

Example 5 with IExtension

use of org.freeplane.core.extension.IExtension in project freeplane by freeplane.

the class PersistentNodeHook method createExtension.

protected IExtension createExtension(final NodeModel node, final XMLElement element) {
    try {
        final Class<? extends IExtension> extensionClass = getExtensionClass();
        if (extensionClass.isEnum()) {
            final String value = element.getAttribute("VALUE");
            final Method factory = extensionClass.getMethod("valueOf", String.class);
            return (IExtension) factory.invoke(null, value);
        }
        return extensionClass.newInstance();
    } catch (SecurityException e) {
        e.printStackTrace();
    } catch (Exception e) {
    }
    return null;
}
Also used : IExtension(org.freeplane.core.extension.IExtension) Method(java.lang.reflect.Method) IOException(java.io.IOException)

Aggregations

IExtension (org.freeplane.core.extension.IExtension)18 NodeModel (org.freeplane.features.map.NodeModel)7 ModeController (org.freeplane.features.mode.ModeController)4 Point (java.awt.Point)3 IOException (java.io.IOException)3 IExtensionElementWriter (org.freeplane.core.io.IExtensionElementWriter)3 IActor (org.freeplane.core.undo.IActor)3 MapModel (org.freeplane.features.map.MapModel)3 Color (java.awt.Color)2 ITreeWriter (org.freeplane.core.io.ITreeWriter)2 AutomaticLayout (org.freeplane.features.styles.AutomaticLayout)2 AutomaticLayoutController (org.freeplane.features.styles.AutomaticLayoutController)2 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)2 File (java.io.File)1 Method (java.lang.reflect.Method)1 MalformedURLException (java.net.MalformedURLException)1 URI (java.net.URI)1 Enumeration (java.util.Enumeration)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1