use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class RemoveNoteAction method doesNoteExist.
private boolean doesNoteExist() {
boolean foundNote = false;
final ModeController modeController = Controller.getCurrentModeController();
if (modeController == null) {
foundNote = false;
} else {
for (final NodeModel node : modeController.getMapController().getSelectedNodes()) {
if (NoteModel.getNoteText(node) != null) {
foundNote = true;
break;
}
}
}
return foundNote;
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class RemoveNoteAction method actionPerformed.
public void actionPerformed(final ActionEvent e) {
final int showResult = OptionalDontShowMeAgainDialog.show("really_remove_notes", "confirmation", MNoteController.RESOURCES_REMOVE_NOTES_WITHOUT_QUESTION, OptionalDontShowMeAgainDialog.ONLY_OK_SELECTION_IS_STORED);
if (showResult != JOptionPane.OK_OPTION) {
return;
}
final ModeController modeController = Controller.getCurrentModeController();
for (final Iterator<NodeModel> iterator = modeController.getMapController().getSelectedNodes().iterator(); iterator.hasNext(); ) {
final NodeModel node = iterator.next();
if (NoteModel.getNoteText(node) != null) {
removeNote(node);
}
}
}
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);
}
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 setNodeFormat.
public void setNodeFormat(final NodeModel node, final String format) {
final ModeController modeController = Controller.getCurrentModeController();
final String oldFormat = NodeStyleModel.getNodeFormat(node);
final IActor actor = new IActor() {
public void act() {
NodeStyleModel.setNodeFormat(node, format);
modeController.getMapController().nodeChanged(node);
}
public String getDescription() {
return "setNodeFormat";
}
public void undo() {
NodeStyleModel.setNodeFormat(node, oldFormat);
modeController.getMapController().nodeChanged(node);
}
};
modeController.execute(actor, node.getMap());
}
Aggregations