use of org.freeplane.features.styles.LogicalStyleModel in project freeplane by freeplane.
the class MLogicalStyleController method setStyle.
public void setStyle(final NodeModel node, final IStyle style) {
final ModeController modeController = Controller.getCurrentModeController();
final IStyle oldStyle = LogicalStyleModel.getStyle(node);
if (oldStyle != null && oldStyle.equals(style) || oldStyle == style) {
modeController.getMapController().nodeChanged(node, LogicalStyleModel.class, oldStyle, style);
return;
}
final IActor actor = new IActor() {
public String getDescription() {
return "setStyle";
}
public void act() {
changeStyle(modeController, node, oldStyle, style);
}
public void undo() {
changeStyle(modeController, node, style, oldStyle);
}
private void changeStyle(final ModeController modeController, final NodeModel node, final IStyle oldStyle, final IStyle style) {
if (style != null) {
final LogicalStyleModel model = LogicalStyleModel.createExtension(node);
model.setStyle(style);
} else {
node.removeExtension(LogicalStyleModel.class);
}
modeController.getMapController().nodeChanged(node, LogicalStyleModel.class, oldStyle, style);
selectActions();
}
};
modeController.execute(actor, node.getMap());
}
Aggregations