Search in sources :

Example 11 with IStyle

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

the class NodeStyleController method getMaxWidth.

public Quantity<LengthUnits> getMaxWidth(NodeModel node) {
    final MapModel map = node.getMap();
    final LogicalStyleController styleController = LogicalStyleController.getController(modeController);
    final Collection<IStyle> style = styleController.getStyles(node);
    final Quantity<LengthUnits> maxTextWidth = getMaxNodeWidth(map, style);
    return maxTextWidth;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) LengthUnits(org.freeplane.core.ui.LengthUnits) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) MapModel(org.freeplane.features.map.MapModel)

Example 12 with IStyle

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

the class NodeStyleController method getBorderWidthMatchesEdgeWidth.

public Boolean getBorderWidthMatchesEdgeWidth(NodeModel node) {
    final MapModel map = node.getMap();
    final LogicalStyleController styleController = LogicalStyleController.getController(modeController);
    final Collection<IStyle> style = styleController.getStyles(node);
    final Boolean borderWidthMatchesEdgeWidth = getBorderWidthMatchesEdgeWidth(map, style);
    return borderWidthMatchesEdgeWidth;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) MapModel(org.freeplane.features.map.MapModel)

Example 13 with IStyle

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

the class EdgeController method getStyleDash.

private DashVariant getStyleDash(final MapModel map, final Collection<IStyle> collection) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : collection) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final EdgeModel styleModel = EdgeModel.getModel(styleNode);
        if (styleModel == null) {
            continue;
        }
        final DashVariant dash = styleModel.getDash();
        if (dash == null) {
            continue;
        }
        return dash;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) DashVariant(org.freeplane.features.DashVariant) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 14 with IStyle

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

the class EdgeController method getStyleEdgeColorRule.

private ObjectRule<Color, Rules> getStyleEdgeColorRule(NodeModel node) {
    MapModel map = node.getMap();
    Collection<IStyle> collection = LogicalStyleController.getController(modeController).getStyles(node);
    final MapStyleModel styles = MapStyleModel.getExtension(map);
    for (IStyle styleKey : collection) {
        final NodeModel styleNode = styles.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        if (node != styleNode && map.getRootNode().containsExtension(AutomaticEdgeColor.class)) {
            AutomaticLayoutController automaticLayoutController = modeController.getExtension(AutomaticLayoutController.class);
            if (automaticLayoutController != null && automaticLayoutController.isAutomaticLevelStyle(styleNode)) {
                continue;
            }
        }
        ObjectRule<Color, Rules> nodeColor = getNodeColorRule(styleNode);
        if (nodeColor != null)
            return nodeColor;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MapStyleModel(org.freeplane.features.styles.MapStyleModel) Color(java.awt.Color) MapModel(org.freeplane.features.map.MapModel)

Example 15 with IStyle

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

the class EdgeController method getStyleWidth.

private Integer getStyleWidth(final MapModel map, final Collection<IStyle> collection) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    for (IStyle styleKey : collection) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final EdgeModel styleModel = EdgeModel.getModel(styleNode);
        if (styleModel == null) {
            continue;
        }
        final int width = styleModel.getWidth();
        if (width == EdgeModel.DEFAULT_WIDTH) {
            continue;
        }
        return width;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Aggregations

IStyle (org.freeplane.features.styles.IStyle)43 NodeModel (org.freeplane.features.map.NodeModel)31 MapStyleModel (org.freeplane.features.styles.MapStyleModel)30 MapModel (org.freeplane.features.map.MapModel)14 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)10 LengthUnits (org.freeplane.core.ui.LengthUnits)9 Color (java.awt.Color)5 IActor (org.freeplane.core.undo.IActor)5 MMapController (org.freeplane.features.map.mindmapmode.MMapController)4 DashVariant (org.freeplane.features.DashVariant)3 StyleTranslatedObject (org.freeplane.features.styles.StyleTranslatedObject)3 Controller (org.freeplane.features.mode.Controller)2 ModeController (org.freeplane.features.mode.ModeController)2 ArrayList (java.util.ArrayList)1 TranslatedObject (org.freeplane.core.resources.TranslatedObject)1 IMapSelection (org.freeplane.features.map.IMapSelection)1 HorizontalTextAlignment (org.freeplane.features.nodestyle.NodeStyleModel.HorizontalTextAlignment)1 AutomaticLayoutController (org.freeplane.features.styles.AutomaticLayoutController)1 LogicalStyleModel (org.freeplane.features.styles.LogicalStyleModel)1