use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class MNoteController method onWrite.
@Override
protected void onWrite(final MapModel map) {
final ModeController modeController = Controller.getCurrentModeController();
final Controller controller = modeController.getController();
final IMapSelection selection = controller.getSelection();
if (selection == null) {
return;
}
final NodeModel selected = selection.getSelected();
noteManager.saveNote(selected);
}
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 SetBooleanMapPropertyAction method setSelected.
@Override
public void setSelected() {
try {
final Controller controller = Controller.getCurrentController();
final NodeModel node = controller.getSelection().getSelected();
final ModeController modeController = controller.getModeController();
final MapStyle mapStyleController = MapStyle.getController(modeController);
final String value = mapStyleController.getPropertySetDefault(node.getMap(), propertyName);
boolean isSet = Boolean.parseBoolean(value);
setSelected(isSet);
} catch (Exception e) {
setSelected(false);
}
}
use of org.freeplane.features.mode.ModeController in project freeplane by freeplane.
the class ManageNodeConditionalStylesAction method actionPerformed.
public void actionPerformed(ActionEvent e) {
final Controller controller = Controller.getCurrentController();
final MapModel map = controller.getMap();
final ConditionalStyleModel conditionalStyleModel = getConditionalStyleModel();
Component pane = createConditionalStylePane(map, conditionalStyleModel);
final ModeController modeController = Controller.getCurrentModeController();
modeController.startTransaction();
try {
final int confirmed = JOptionPane.showConfirmDialog(controller.getMapViewManager().getMapViewComponent(), pane, TextUtils.getText(TextUtils.removeMnemonic("ManageNodeConditionalStylesAction.text")), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
if (JOptionPane.OK_OPTION == confirmed) {
modeController.commit();
modeController.getMapController().nodeChanged(controller.getSelection().getSelected(), NodeModel.UNKNOWN_PROPERTY, null, null);
} else {
modeController.rollback();
}
} catch (RuntimeException ex) {
ex.printStackTrace();
modeController.rollback();
}
}
Aggregations