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());
}
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);
}
}
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);
}
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());
}
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());
}
Aggregations