Search in sources :

Example 1 with SurveyRunner

use of org.freeplane.main.application.survey.SurveyRunner in project freeplane by freeplane.

the class FreeplaneGUIStarter method createController.

@SuppressWarnings("serial")
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"));
        final boolean supportHidpi = Boolean.valueOf(System.getProperty("lookandfeel.scaleuifonts", applicationResourceController.getProperty("lookandfeel.scaleuifonts")));
        FrameController.setLookAndFeel(lookandfeel, supportHidpi);
        final JFrame frame;
        frame = new JFrame("Freeplane");
        frame.setContentPane(new JPanel() {

            @Override
            protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
                return super.processKeyBinding(ks, e, condition, pressed) || MenuKeyProcessor.INSTANCE.processKeyBinding(ks, e, condition, pressed);
            }
        });
        frame.setName(UITools.MAIN_FREEPLANE_FRAME);
        final MMapViewController mapViewController = new MMapViewController(controller);
        viewController = new ApplicationViewController(controller, mapViewController, frame);
        splash = new FreeplaneSplashModern(frame);
        if (!System.getProperty("org.freeplane.nosplash", "false").equals("true")) {
            SwingUtilities.invokeAndWait(new Runnable() {

                @Override
                public void run() {
                    splash.setVisible(true);
                }
            });
        }
        mapViewController.addMapViewChangeListener(applicationResourceController.getLastOpenedList());
        controller.addExtension(HighlightController.class, new HighlightController());
        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.installConditionControllers();
        HelpController.install();
        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(NextPresentationItemAction.createFoldingAction());
        controller.addAction(NextPresentationItemAction.createNotFoldingAction());
        controller.addAction(new ShowSelectionAsRectangleAction());
        controller.addAction(new ViewLayoutTypeAction(MapViewLayout.OUTLINE));
        FilterController.getCurrentFilterController().getConditionFactory().addConditionController(70, new LogicalStyleFilterController());
        MapController.install();
        NodeHistory.install(controller);
        final FreeplaneSurveyProperties freeplaneSurveyProperties = new FreeplaneSurveyProperties();
        if (freeplaneSurveyProperties.mayAskUserToFillSurveys()) {
            controller.addApplicationLifecycleListener(new SurveyStarter(freeplaneSurveyProperties, new SurveyRunner(freeplaneSurveyProperties), Math.random()));
        }
        return controller;
    } catch (final Exception e) {
        LogUtils.severe(e);
        throw new RuntimeException(e);
    }
}
Also used : JPanel(javax.swing.JPanel) QuitAction(org.freeplane.features.mode.QuitAction) LogicalStyleFilterController(org.freeplane.features.styles.LogicalStyleFilterController) FormatController(org.freeplane.features.format.FormatController) KeyEvent(java.awt.event.KeyEvent) SurveyRunner(org.freeplane.main.application.survey.SurveyRunner) JFrame(javax.swing.JFrame) SurveyStarter(org.freeplane.main.application.survey.SurveyStarter) NextNodeAction(org.freeplane.features.filter.NextNodeAction) MMapViewController(org.freeplane.view.swing.map.mindmapmode.MMapViewController) FreeplaneSurveyProperties(org.freeplane.main.application.survey.FreeplaneSurveyProperties) HighlightController(org.freeplane.features.highlight.HighlightController) FModeController(org.freeplane.features.mode.filemode.FModeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) 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) FormatController(org.freeplane.features.format.FormatController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) LinkController(org.freeplane.features.link.LinkController) HighlightController(org.freeplane.features.highlight.HighlightController) 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) InvocationTargetException(java.lang.reflect.InvocationTargetException) IOException(java.io.IOException) ViewLayoutTypeAction(org.freeplane.view.swing.map.ViewLayoutTypeAction) KeyStroke(javax.swing.KeyStroke) ShowSelectionAsRectangleAction(org.freeplane.core.ui.ShowSelectionAsRectangleAction)

Aggregations

KeyEvent (java.awt.event.KeyEvent)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1 KeyStroke (javax.swing.KeyStroke)1 ResourceController (org.freeplane.core.resources.ResourceController)1 ShowSelectionAsRectangleAction (org.freeplane.core.ui.ShowSelectionAsRectangleAction)1 ModelessAttributeController (org.freeplane.features.attribute.ModelessAttributeController)1 FilterController (org.freeplane.features.filter.FilterController)1 NextNodeAction (org.freeplane.features.filter.NextNodeAction)1 FormatController (org.freeplane.features.format.FormatController)1 ScannerController (org.freeplane.features.format.ScannerController)1 HelpController (org.freeplane.features.help.HelpController)1 HighlightController (org.freeplane.features.highlight.HighlightController)1 IconController (org.freeplane.features.icon.IconController)1 LinkController (org.freeplane.features.link.LinkController)1 MapController (org.freeplane.features.map.MapController)1 MMapController (org.freeplane.features.map.mindmapmode.MMapController)1 Controller (org.freeplane.features.mode.Controller)1