use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class LogicalStyleController method registerChangeListener.
private void registerChangeListener() {
ModeController modeController = Controller.getCurrentModeController();
final MapController mapController = modeController.getMapController();
mapController.addMapChangeListener(new IMapChangeListener() {
public void onPreNodeMoved(NodeModel oldParent, int oldIndex, NodeModel newParent, NodeModel child, int newIndex) {
clearCache();
}
public void onPreNodeDelete(NodeModel oldParent, NodeModel selectedNode, int index) {
clearCache();
}
public void onNodeMoved(NodeModel oldParent, int oldIndex, NodeModel newParent, NodeModel child, int newIndex) {
clearCache();
}
public void onNodeInserted(NodeModel parent, NodeModel child, int newIndex) {
clearCache();
}
public void onNodeDeleted(NodeModel parent, NodeModel child, int index) {
clearCache();
}
public void mapChanged(MapChangeEvent event) {
clearCache();
}
});
mapController.addNodeChangeListener(new INodeChangeListener() {
public void nodeChanged(NodeChangeEvent event) {
clearCache();
}
});
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class LocationController method install.
public static void install(final LocationController locationController) {
final ModeController modeController = Controller.getCurrentModeController();
modeController.addExtension(LocationController.class, locationController);
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNodeStyleController method setItalic.
/**
* @param italic
*/
public void setItalic(final NodeModel node, final Boolean italic) {
final Boolean oldItalic = NodeStyleModel.isItalic(node);
if (oldItalic == italic || oldItalic != null && oldItalic.equals(italic)) {
return;
}
createOwnStyleModel(node);
final ModeController modeController = Controller.getCurrentModeController();
final IActor actor = new IActor() {
public void act() {
final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
styleModel.setItalic(italic);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
public String getDescription() {
return "setItalic";
}
public void undo() {
final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
styleModel.setItalic(oldItalic);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
};
modeController.execute(actor, node.getMap());
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNodeStyleController method setFontFamily.
/**
* @param fontFamily
*/
public void setFontFamily(final NodeModel node, final String fontFamily) {
final String oldFontFamily = NodeStyleModel.getFontFamilyName(node);
if (oldFontFamily == fontFamily || oldFontFamily != null && oldFontFamily.equals(fontFamily)) {
return;
}
createOwnStyleModel(node);
final ModeController modeController = Controller.getCurrentModeController();
final IActor actor = new IActor() {
public void act() {
final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
styleModel.setFontFamilyName(fontFamily);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
public String getDescription() {
return "setFontFamily";
}
public void undo() {
final NodeStyleModel styleModel = NodeStyleModel.getModel(node);
styleModel.setFontFamilyName(oldFontFamily);
Controller.getCurrentModeController().getMapController().nodeChanged(node);
}
};
modeController.execute(actor, node.getMap());
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNodeStyleController method createOwnSizeModel.
private NodeSizeModel createOwnSizeModel(final NodeModel node) {
{
final NodeSizeModel sizeModel = NodeSizeModel.getModel(node);
if (sizeModel != null) {
return sizeModel;
}
}
final ModeController modeController = Controller.getCurrentModeController();
final IActor actor = new IActor() {
public void act() {
node.addExtension(new NodeSizeModel());
}
public String getDescription() {
return null;
}
public void undo() {
node.removeExtension(NodeSizeModel.class);
}
};
modeController.execute(actor, node.getMap());
return NodeSizeModel.getModel(node);
}
Aggregations