Search in sources :

Example 71 with Controller

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);
}
Also used : FreeplaneGUIStarter(org.freeplane.main.application.FreeplaneGUIStarter) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) BeforeClass(org.junit.BeforeClass)

Example 72 with Controller

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);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController)

Example 73 with Controller

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);
        }
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller) ResourceController(org.freeplane.core.resources.ResourceController)

Example 74 with Controller

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);
}
Also used : EditNodeBase(org.freeplane.features.text.mindmapmode.EditNodeBase) IEditBaseCreator(org.freeplane.features.text.mindmapmode.IEditBaseCreator) RootPaneContainer(javax.swing.RootPaneContainer) Controller(org.freeplane.features.mode.Controller)

Example 75 with Controller

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);
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) IMapSelection(org.freeplane.features.map.IMapSelection) Controller(org.freeplane.features.mode.Controller)

Aggregations

Controller (org.freeplane.features.mode.Controller)152 ModeController (org.freeplane.features.mode.ModeController)92 ResourceController (org.freeplane.core.resources.ResourceController)69 NodeModel (org.freeplane.features.map.NodeModel)46 MapController (org.freeplane.features.map.MapController)41 MapModel (org.freeplane.features.map.MapModel)34 LinkController (org.freeplane.features.link.LinkController)32 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)32 TextController (org.freeplane.features.text.TextController)27 MMapController (org.freeplane.features.map.mindmapmode.MMapController)24 ViewController (org.freeplane.features.ui.ViewController)23 IconController (org.freeplane.features.icon.IconController)22 Component (java.awt.Component)19 FilterController (org.freeplane.features.filter.FilterController)17 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)17 FormatController (org.freeplane.features.format.FormatController)16 ScannerController (org.freeplane.features.format.ScannerController)16 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)15 File (java.io.File)14 MTextController (org.freeplane.features.text.mindmapmode.MTextController)14