Search in sources :

Example 16 with IExtension

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

the class PersistentNodeHook method isActiveForSelection.

private boolean isActiveForSelection(Enum<?> value) {
    final NodeModel[] nodes = getNodes();
    for (int i = 0; i < nodes.length; i++) {
        final NodeModel nodeModel = nodes[i];
        final IExtension nodeValue = nodeModel.getExtension(getExtensionClass());
        if (value == null && nodeValue != null || value != null && !value.equals(nodeValue)) {
            return false;
        }
    }
    return true;
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IExtension(org.freeplane.core.extension.IExtension)

Example 17 with IExtension

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

the class MapStyle method moveStyle.

private void moveStyle(final MapModel sourceMap, final MapModel targetMap, boolean overwrite) {
    final MapStyleModel source = (MapStyleModel) sourceMap.getRootNode().removeExtension(MapStyleModel.class);
    if (source == null)
        return;
    final IExtension undoHandler = targetMap.getExtension(IUndoHandler.class);
    source.getStyleMap().putExtension(IUndoHandler.class, undoHandler);
    final NodeModel targetRoot = targetMap.getRootNode();
    final MapStyleModel target = MapStyleModel.getExtension(targetRoot);
    if (target == null) {
        targetRoot.addExtension(source);
    } else {
        target.copyFrom(source, overwrite);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IExtension(org.freeplane.core.extension.IExtension)

Example 18 with IExtension

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

the class MapStyle method getBackground.

public Color getBackground(final MapModel map) {
    final IExtension extension = map.getRootNode().getExtension(MapStyleModel.class);
    final Color backgroundColor = extension != null ? ((MapStyleModel) extension).getBackgroundColor() : null;
    if (backgroundColor != null) {
        return backgroundColor;
    }
    final String stdcolor = ResourceController.getResourceController().getProperty(MapStyle.RESOURCES_BACKGROUND_COLOR);
    final Color standardMapBackgroundColor = ColorUtils.stringToColor(stdcolor);
    return standardMapBackgroundColor;
}
Also used : IExtension(org.freeplane.core.extension.IExtension) Color(java.awt.Color)

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