Search in sources :

Example 6 with NodeStyleModel

use of org.freeplane.features.nodestyle.NodeStyleModel in project freeplane by freeplane.

the class MNodeStyleController method setStrikedThrough.

public void setStrikedThrough(final NodeModel node, final Boolean strikedThrough) {
    final Boolean oldStrikedThrough = NodeStyleModel.isStrikedThrough(node);
    if (oldStrikedThrough == strikedThrough || oldStrikedThrough != null && oldStrikedThrough.equals(strikedThrough)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setStrikedThrough(strikedThrough);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }

        public String getDescription() {
            return "setStrikedThrough";
        }

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setStrikedThrough(oldStrikedThrough);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 7 with NodeStyleModel

use of org.freeplane.features.nodestyle.NodeStyleModel in project freeplane by freeplane.

the class UserPropertiesUpdater method updateDefaultStyle.

private void updateDefaultStyle(final NodeStyleController nodeStyleController, MapModel defaultStyleMap) {
    NodeModel styleNode1 = MapStyleModel.getExtension(defaultStyleMap).getStyleNode(MapStyleModel.DEFAULT_STYLE);
    NodeModel styleNode = styleNode1;
    styleNode.removeExtension(NodeStyleModel.class);
    styleNode.removeExtension(EdgeModel.class);
    final NodeStyleModel nodeStyleModel = new NodeStyleModel();
    nodeStyleModel.setBackgroundColor(nodeStyleController.getBackgroundColor(styleNode));
    nodeStyleModel.setBold(nodeStyleController.isBold(styleNode));
    nodeStyleModel.setColor(nodeStyleController.getColor(styleNode));
    nodeStyleModel.setFontFamilyName(nodeStyleController.getFontFamilyName(styleNode));
    nodeStyleModel.setFontSize(nodeStyleController.getFontSize(styleNode));
    nodeStyleModel.setItalic(nodeStyleController.isItalic(styleNode));
    nodeStyleModel.setShape(nodeStyleController.getShape(styleNode));
    styleNode.addExtension(nodeStyleModel);
    final NodeSizeModel nodeSizeModel = new NodeSizeModel();
    nodeSizeModel.setMaxNodeWidth(nodeStyleController.getMaxWidth(styleNode));
    nodeSizeModel.setMinNodeWidth(nodeStyleController.getMinWidth(styleNode));
    final EdgeModel standardEdgeModel = EdgeModel.getModel(styleNode);
    if (standardEdgeModel != null) {
        final EdgeModel edgeModel = new EdgeModel();
        edgeModel.setColor(standardEdgeModel.getColor());
        edgeModel.setStyle(standardEdgeModel.getStyle());
        edgeModel.setWidth(standardEdgeModel.getWidth());
        styleNode.addExtension(edgeModel);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) NodeSizeModel(org.freeplane.features.nodestyle.NodeSizeModel) EdgeModel(org.freeplane.features.edge.EdgeModel)

Example 8 with NodeStyleModel

use of org.freeplane.features.nodestyle.NodeStyleModel in project freeplane by freeplane.

the class MNodeStyleController method createOwnStyleModel.

private NodeStyleModel createOwnStyleModel(final NodeModel node) {
    {
        final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
        if (styleModel != null) {
            return styleModel;
        }
    }
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            node.addExtension(new NodeStyleModel());
        }

        public String getDescription() {
            return null;
        }

        public void undo() {
            node.removeExtension(NodeStyleModel.class);
        }
    };
    modeController.execute(actor, node.getMap());
    return NodeStyleModel.getModel(node);
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 9 with NodeStyleModel

use of org.freeplane.features.nodestyle.NodeStyleModel in project freeplane by freeplane.

the class MNodeStyleController method setBold.

/**
 * @param bold
 */
public void setBold(final NodeModel node, final Boolean bold) {
    final Boolean oldBold = NodeStyleModel.isBold(node);
    if (oldBold == bold || oldBold != null && oldBold.equals(bold)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setBold(bold);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }

        public String getDescription() {
            return "setBold";
        }

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setBold(oldBold);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Example 10 with NodeStyleModel

use of org.freeplane.features.nodestyle.NodeStyleModel in project freeplane by freeplane.

the class MNodeStyleController method setFontSize.

/**
 * @param fontSize
 */
public void setFontSize(final NodeModel node, final Integer fontSize) {
    final Integer oldFontSize = NodeStyleModel.getFontSize(node);
    if (oldFontSize == fontSize || oldFontSize != null && oldFontSize.equals(fontSize)) {
        return;
    }
    createOwnStyleModel(node);
    final ModeController modeController = Controller.getCurrentModeController();
    final IActor actor = new IActor() {

        public void act() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setFontSize(fontSize);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }

        public String getDescription() {
            return "setFontSize";
        }

        public void undo() {
            final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
            styleModel.setFontSize(oldFontSize);
            Controller.getCurrentModeController().getMapController().nodeChanged(node);
        }
    };
    modeController.execute(actor, node.getMap());
}
Also used : NodeStyleModel(org.freeplane.features.nodestyle.NodeStyleModel) IActor(org.freeplane.core.undo.IActor) ModeController(org.freeplane.features.mode.ModeController)

Aggregations

NodeStyleModel (org.freeplane.features.nodestyle.NodeStyleModel)10 IActor (org.freeplane.core.undo.IActor)6 ModeController (org.freeplane.features.mode.ModeController)6 NodeModel (org.freeplane.features.map.NodeModel)2 Font (java.awt.Font)1 JLabel (javax.swing.JLabel)1 EdgeModel (org.freeplane.features.edge.EdgeModel)1 NodeSizeModel (org.freeplane.features.nodestyle.NodeSizeModel)1