use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class ConvertibleTest method initStatics.
@BeforeClass
public static void initStatics() {
// we have to start Freeplane to create a Controller for script execution could we avoid that?
System.setProperty("org.freeplane.nosplash", "true");
final FreeplaneGUIStarter freeplaneGUIStarter = new FreeplaneGUIStarter();
final Controller controller = freeplaneGUIStarter.createController();
freeplaneGUIStarter.createModeControllers(controller);
ResourceController.getResourceController().setProperty(ScriptingPermissions.RESOURCES_EXECUTE_SCRIPTS_WITHOUT_ASKING, true);
}
use of org.freeplane.features.mode.Controller 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.Controller in project freeplane by freeplane.
the class Slide method scrollMapToSelectedNode.
private void scrollMapToSelectedNode() {
if (placedNodeId == null) {
final Controller controller = Controller.getCurrentController();
final IMapSelection selection = controller.getSelection();
if (selection != null) {
final NodeModel selected = selection.getSelected();
controller.getMapViewManager().scrollNodeToVisible(selected);
}
}
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class NoteDialogStarter method editNoteInDialog.
void editNoteInDialog(final NodeModel nodeModel) {
final Controller controller = Controller.getCurrentController();
stopEditing();
Controller.getCurrentModeController().setBlocked(true);
String text = NoteModel.getNoteText(nodeModel);
if (text == null) {
text = "";
}
final EditNodeBase.IEditControl editControl = new EditNodeBase.IEditControl() {
public void cancel() {
Controller.getCurrentModeController().setBlocked(false);
mCurrentEditDialog = null;
}
public void ok(final String newText) {
setHtmlText(nodeModel, newText);
cancel();
}
public void split(final String newText, final int position) {
}
public boolean canSplit() {
return false;
}
public EditedComponent getEditType() {
return EditedComponent.NOTE;
}
};
final IEditBaseCreator textFieldCreator = (IEditBaseCreator) Controller.getCurrentController().getMapViewManager();
mCurrentEditDialog = textFieldCreator.createEditor(nodeModel, editControl, text, true);
final RootPaneContainer frame = (RootPaneContainer) SwingUtilities.getWindowAncestor(controller.getMapViewManager().getMapViewComponent());
mCurrentEditDialog.show(frame);
}
use of org.freeplane.features.mode.Controller in project freeplane by freeplane.
the class SelectionActor method restoreSelection.
private void restoreSelection() {
final Controller controller = Controller.getCurrentController();
if (!map.equals(controller.getMap()))
return;
final IMapSelection selection = controller.getSelection();
if (this.equals(new SelectionActor(selection)))
return;
NodeModel[] nodes = new NodeModel[nodeIDs.length];
int index = 0;
for (String id : nodeIDs) nodes[index++] = map.getNodeForID(id);
selection.replaceSelection(nodes);
}
Aggregations