Search in sources :

Example 96 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class SaveAction method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final boolean success = ((MModeController) Controller.getCurrentModeController()).save();
    final Controller controller = Controller.getCurrentController();
    if (success) {
        controller.getViewController().out(TextUtils.getText("saved"));
    } else {
        controller.getViewController().out(TextUtils.getText("saving_canceled"));
    }
    controller.getMapViewManager().setTitle();
}
Also used : Controller(org.freeplane.features.mode.Controller) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 97 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class FreeplaneGUIStarter method createController.

public Controller createController() {
    try {
        Controller controller = new Controller(applicationResourceController);
        Controller.setCurrentController(controller);
        Compat.macAppChanges();
        controller.addAction(new QuitAction());
        applicationResourceController.init();
        LogUtils.createLogger();
        FreeplaneGUIStarter.showSysInfo();
        final String lookandfeel = System.getProperty("lookandfeel", applicationResourceController.getProperty("lookandfeel"));
        FrameController.setLookAndFeel(lookandfeel);
        final JFrame frame;
        USE_RIBBONS_MENU = UITools.useRibbonsMenu();
        if (USE_RIBBONS_MENU) {
            frame = new JRibbonFrame("Freeplane");
            initIcons(applicationResourceController);
        } else {
            frame = new JFrame("Freeplane");
        }
        frame.setName(UITools.MAIN_FREEPLANE_FRAME);
        splash = new FreeplaneSplashModern(frame);
        if (!System.getProperty("org.freeplane.nosplash", "false").equals("true")) {
            splash.setVisible(true);
        }
        final MMapViewController mapViewController = new MMapViewController(controller);
        viewController = new ApplicationViewController(controller, mapViewController, frame);
        System.setSecurityManager(new FreeplaneSecurityManager());
        mapViewController.addMapViewChangeListener(applicationResourceController.getLastOpenedList());
        FilterController.install();
        PrintController.install();
        FormatController.install(new FormatController());
        final ScannerController scannerController = new ScannerController();
        ScannerController.install(scannerController);
        scannerController.addParsersForStandardFormats();
        ModelessAttributeController.install();
        TextController.install();
        TimeController.install();
        LinkController.install();
        IconController.install();
        HelpController.install();
        controller.addAction(new UpdateCheckAction());
        controller.addAction(new NextNodeAction(Direction.FORWARD));
        controller.addAction(new NextNodeAction(Direction.BACK));
        controller.addAction(new NextNodeAction(Direction.FORWARD_N_FOLD));
        controller.addAction(new NextNodeAction(Direction.BACK_N_FOLD));
        controller.addAction(new NextPresentationItemAction());
        controller.addAction(new ShowSelectionAsRectangleAction());
        controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
        FilterController.getCurrentFilterController().getConditionFactory().addConditionController(70, new LogicalStyleFilterController());
        MapController.install();
        NodeHistory.install(controller);
        return controller;
    } catch (final Exception e) {
        LogUtils.severe(e);
        throw new RuntimeException(e);
    }
}
Also used : MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) QuitAction(org.freeplane.features.mode.QuitAction) LogicalStyleFilterController(org.freeplane.features.styles.LogicalStyleFilterController) FormatController(org.freeplane.features.format.FormatController) FModeController(org.freeplane.features.mode.filemode.FModeController) TimeController(org.freeplane.features.time.TimeController) FilterController(org.freeplane.features.filter.FilterController) HelpController(org.freeplane.features.help.HelpController) MapController(org.freeplane.features.map.MapController) LogicalStyleFilterController(org.freeplane.features.styles.LogicalStyleFilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) TextController(org.freeplane.features.text.TextController) ModelessAttributeController(org.freeplane.features.attribute.ModelessAttributeController) PrintController(org.freeplane.features.print.PrintController) BModeController(org.freeplane.features.mode.browsemode.BModeController) FormatController(org.freeplane.features.format.FormatController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) FrameController(org.freeplane.features.ui.FrameController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController) ScannerController(org.freeplane.features.format.ScannerController) NextPresentationItemAction(org.freeplane.features.filter.NextPresentationItemAction) InvocationTargetException(java.lang.reflect.InvocationTargetException) JFrame(javax.swing.JFrame) JRibbonFrame(org.pushingpixels.flamingo.api.ribbon.JRibbonFrame) ViewLayoutTypeAction(org.freeplane.view.swing.map.ViewLayoutTypeAction) NextNodeAction(org.freeplane.features.filter.NextNodeAction) ShowSelectionAsRectangleAction(org.freeplane.core.ui.ShowSelectionAsRectangleAction)

Example 98 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class FreeplaneGUIStarter method createFrame.

public void createFrame(final String[] args) {
    Controller controller = Controller.getCurrentController();
    ModeController modeController = controller.getModeController(MModeController.MODENAME);
    controller.selectModeForBuild(modeController);
    Compat.macMenuChanges();
    new UserPropertiesUpdater().importOldDefaultStyle();
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            final Options options = CommandLineParser.parse(args);
            viewController.init(Controller.getCurrentController());
            splash.toBack();
            final Frame frame = viewController.getFrame();
            final int extendedState = frame.getExtendedState();
            Container contentPane = viewController.getContentPane();
            contentPane.setVisible(false);
            splash.dispose();
            splash = null;
            frame.setVisible(true);
            if (extendedState != frame.getExtendedState()) {
                frame.setExtendedState(extendedState);
            }
            loadMaps(options.getFilesToOpenAsArray());
            focusCurrentView();
            viewController.getContentPane().setVisible(true);
            frame.toFront();
            startupFinished = true;
            System.setProperty("nonInteractive", Boolean.toString(options.isNonInteractive()));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            MenuUtils.executeMenuItems(options.getMenuItemsToExecute());
        }

        private void focusCurrentView() {
            final MapView currentMapView = (MapView) Controller.getCurrentController().getMapViewManager().getMapViewComponent();
            if (currentMapView != null) {
                viewController.focusTo(currentMapView);
            }
        }
    });
}
Also used : Options(org.freeplane.main.application.CommandLineParser.Options) JFrame(javax.swing.JFrame) Frame(java.awt.Frame) JRibbonFrame(org.pushingpixels.flamingo.api.ribbon.JRibbonFrame) Container(java.awt.Container) MapView(org.freeplane.view.swing.map.MapView) FModeController(org.freeplane.features.mode.filemode.FModeController) BModeController(org.freeplane.features.mode.browsemode.BModeController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) FModeController(org.freeplane.features.mode.filemode.FModeController) TimeController(org.freeplane.features.time.TimeController) FilterController(org.freeplane.features.filter.FilterController) HelpController(org.freeplane.features.help.HelpController) MapController(org.freeplane.features.map.MapController) LogicalStyleFilterController(org.freeplane.features.styles.LogicalStyleFilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) TextController(org.freeplane.features.text.TextController) ModelessAttributeController(org.freeplane.features.attribute.ModelessAttributeController) PrintController(org.freeplane.features.print.PrintController) BModeController(org.freeplane.features.mode.browsemode.BModeController) FormatController(org.freeplane.features.format.FormatController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) FrameController(org.freeplane.features.ui.FrameController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController)

Example 99 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class MFileManager method createActions.

private void createActions() {
    final Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    controller.addAction(new OpenAction());
    controller.addAction(new OpenURLMapAction());
    controller.addAction(new NewMapAction());
    final File userTemplates = defaultUserTemplateDir();
    userTemplates.mkdir();
    modeController.addAction(new NewMapFromTemplateAction("new_map_from_user_templates", userTemplates));
    modeController.addAction(new SaveAction());
    modeController.addAction(new SaveAsAction());
    modeController.addAction(new ExportBranchAction());
    modeController.addAction(new ImportBranchAction());
    modeController.addAction(new ImportLinkedBranchAction());
    modeController.addAction(new ImportLinkedBranchWithoutRootAction());
    modeController.addAction(new ImportExplorerFavoritesAction());
    modeController.addAction(new ImportFolderStructureAction());
    modeController.addAction(new RevertAction());
    modeController.addAction(new OpenUserDirAction());
}
Also used : ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) File(java.io.File)

Example 100 with Controller

use of org.freeplane.features.mode.Controller in project freeplane by freeplane.

the class MFileManager method newMapFromTemplate.

/**
 *@deprecated -- use MMapIO
 */
@Deprecated
public MapModel newMapFromTemplate(final File startFile) {
    final File file;
    if (startFile == null) {
        file = getLastCurrentDir();
    } else if (startFile.isDirectory()) {
        final JFileChooser chooser = getFileChooser(true);
        chooser.setCurrentDirectory(startFile);
        final int returnVal = chooser.showOpenDialog(Controller.getCurrentController().getMapViewManager().getMapViewComponent());
        if (returnVal != JFileChooser.APPROVE_OPTION) {
            return null;
        }
        file = chooser.getSelectedFile();
    } else {
        file = startFile;
    }
    try {
        final MMapController mapController = (MMapController) Controller.getCurrentModeController().getMapController();
        mapController.newUntitledMap(Compat.fileToUrl(file));
        final Controller controller = Controller.getCurrentController();
        final MapModel map = controller.getMap();
        final Object rootText = map.getRootNode().getUserObject();
        if (rootText instanceof NamedObject) {
            map.getRootNode().setText(rootText.toString());
        }
        controller.getModeController().getMapController().setSaved(map, true);
        return map;
    } catch (Exception e) {
        handleLoadingException(e);
    }
    return null;
}
Also used : JFileChooser(javax.swing.JFileChooser) MMapController(org.freeplane.features.map.mindmapmode.MMapController) NamedObject(org.freeplane.core.resources.NamedObject) NamedObject(org.freeplane.core.resources.NamedObject) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) File(java.io.File) XMLException(org.freeplane.n3.nanoxml.XMLException) URISyntaxException(java.net.URISyntaxException) FileNotFoundException(java.io.FileNotFoundException) XMLParseException(org.freeplane.n3.nanoxml.XMLParseException) MapConversionException(org.freeplane.features.url.MapConversionException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException)

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