Search in sources :

Example 46 with MapStyleModel

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

the class NodeStyleController method getStyleFont.

private Font getStyleFont(final Font baseFont, final MapModel map, final Collection<IStyle> collection) {
    final MapStyleModel model = MapStyleModel.getExtension(map);
    Boolean bold = null;
    Boolean strikedThrough = null;
    Boolean italic = null;
    String fontFamilyName = null;
    Integer fontSize = null;
    for (IStyle styleKey : collection) {
        final NodeModel styleNode = model.getStyleNode(styleKey);
        if (styleNode == null) {
            continue;
        }
        final NodeStyleModel styleModel = NodeStyleModel.getModel(styleNode);
        if (styleModel == null) {
            continue;
        }
        if (bold == null)
            bold = styleModel.isBold();
        if (strikedThrough == null)
            strikedThrough = styleModel.isStrikedThrough();
        if (italic == null)
            italic = styleModel.isItalic();
        if (fontFamilyName == null)
            fontFamilyName = styleModel.getFontFamilyName();
        if (fontSize == null)
            fontSize = styleModel.getFontSize();
        if (bold != null && italic != null && fontFamilyName != null && fontSize != null && strikedThrough == null)
            break;
    }
    return createFont(baseFont, fontFamilyName, fontSize, bold, italic, strikedThrough);
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel)

Example 47 with MapStyleModel

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

the class NodeStyleController method getHorizontalTextAlignment.

private HorizontalTextAlignment getHorizontalTextAlignment(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 HorizontalTextAlignment textAlignment = styleModel.getHorizontalTextAlignment();
        if (textAlignment == null) {
            continue;
        }
        return textAlignment;
    }
    return null;
}
Also used : IStyle(org.freeplane.features.styles.IStyle) NodeModel(org.freeplane.features.map.NodeModel) MapStyleModel(org.freeplane.features.styles.MapStyleModel) HorizontalTextAlignment(org.freeplane.features.nodestyle.NodeStyleModel.HorizontalTextAlignment)

Example 48 with MapStyleModel

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

the class NodeStyleController method getBorderDash.

private DashVariant getBorderDash(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 DashVariant borderDash = borderModel.getBorderDash();
        if (borderDash == null) {
            continue;
        }
        return borderDash;
    }
    return DashVariant.DEFAULT;
}
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)

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