Search in sources :

Example 41 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class NodeStyleController method getStyleShape.

private ShapeConfigurationModel getStyleShape(final MapModel map, final Collection<IStyle> style) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : style) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
        if (styleModel == null) {
            continue;
        }
        final ShapeConfigurationModel shapeConfiguration = styleModel.getShapeConfiguration();
        if (shapeConfiguration.getShape() == null) {
            continue;
        }
        return shapeConfiguration;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 42 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class NodeStyleController method getBorderWidth.

private Quantity<LengthUnits> getBorderWidth(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : styleKeys) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeBorderModel borderModel = NodeBorderModel.getModel(styleNode);
        if (borderModel == null) {
            continue;
        }
        final Quantity<LengthUnits> borderWidth = borderModel.getBorderWidth();
        if (borderWidth == null) {
            continue;
        }
        return borderWidth;
    }
    return DEFAULT_BORDER_WIDTH;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) LengthUnits(org.freeplane.core.ui.LengthUnits) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 43 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class NodeStyleController method getBorderColor.

private Color getBorderColor(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : styleKeys) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeBorderModel borderModel = NodeBorderModel.getModel(styleNode);
        if (borderModel == null) {
            continue;
        }
        final Color borderColor = borderModel.getBorderColor();
        if (borderColor == null) {
            continue;
        }
        return borderColor;
    }
    return EdgeController.STANDARD_EDGE_COLOR;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color)

Example 44 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class NodeStyleController method getBorderWidthMatchesEdgeWidth.

private Boolean getBorderWidthMatchesEdgeWidth(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : styleKeys) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeBorderModel borderModel = NodeBorderModel.getModel(styleNode);
        if (borderModel == null) {
            continue;
        }
        final Boolean borderWidthMatchesEdgeWidth = borderModel.getBorderWidthMatchesEdgeWidth();
        if (borderWidthMatchesEdgeWidth == null) {
            continue;
        }
        return borderWidthMatchesEdgeWidth;
    }
    return false;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 45 with MapStyleModel

use of org.freeplane.features.styles.MapStyleModel in project freeplane by freeplane.

the class NodeStyleController method getMaxNodeWidth.

private Quantity<LengthUnits> getMaxNodeWidth(final MapModel map, final Collection<IStyle> styleKeys) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : styleKeys) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeSizeModel sizeModel = NodeSizeModel.getModel(styleNode);
        if (sizeModel == null) {
            continue;
        }
        final Quantity<LengthUnits> maxTextWidth = sizeModel.getMaxNodeWidth();
        if (maxTextWidth == null) {
            continue;
        }
        return maxTextWidth;
    }
    return DEFAULT_MAXIMUM_WIDTH;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) LengthUnits(org.freeplane.core.ui.LengthUnits) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Aggregations

MapStyleModel (org.freeplane.features.styles.MapStyleModel)48 NodeModel (org.freeplane.features.map.NodeModel)39 IStyle (org.freeplane.features.styles.IStyle)30 Color (java.awt.Color)10 MapModel (org.freeplane.features.map.MapModel)10 Controller (org.freeplane.features.mode.Controller)6 LengthUnits (org.freeplane.core.ui.LengthUnits)5 IActor (org.freeplane.core.undo.IActor)5 MMapController (org.freeplane.features.map.mindmapmode.MMapController)5 StyleTranslatedObject (org.freeplane.features.styles.StyleTranslatedObject)4 ModeController (org.freeplane.features.mode.ModeController)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 MapStyle (org.freeplane.features.styles.MapStyle)3 Font (java.awt.Font)2 ArrayList (java.util.ArrayList)2 DashVariant (org.freeplane.features.DashVariant)2 ConditionalStyleModel (org.freeplane.features.styles.ConditionalStyleModel)2 MapView (org.freeplane.view.swing.map.MapView)2 NodeView (org.freeplane.view.swing.map.NodeView)2