Search in sources :

Example 66 with Controller

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

the class HeadlessMModeControllerFactory method createStandardControllers.

private void createStandardControllers() {
    final Controller controller = Controller.getCurrentController();
    modeController = new MModeController(controller);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    IconController.install(new MIconController(modeController));
    new ProgressFactory().installActions(modeController);
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    final MTextController textController = new MTextController(modeController);
    TextController.install(textController);
    LinkController.install(new MLinkController());
    NodeStyleController.install(new MNodeStyleController(modeController));
    ClipboardController.install(new MClipboardController());
    LocationController.install(new MLocationController());
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    LogicalStyleController.install(logicalStyleController);
    logicalStyleController.initM();
    AttributeController.install(new MAttributeController(modeController));
    modeController.addAction(new EditAttributesAction());
    SpellCheckerController.install(modeController);
    ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
    MapStyle.install(true);
    new RevisionPlugin();
    FoldingController.install(new FoldingController());
}
Also used : MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) CloudController(org.freeplane.features.cloud.CloudController) LinkController(org.freeplane.features.link.LinkController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) LocationController(org.freeplane.features.nodelocation.LocationController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) FoldingController(org.freeplane.features.map.FoldingController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) FoldingController(org.freeplane.features.map.FoldingController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ExportController(org.freeplane.features.export.mindmapmode.ExportController)

Example 67 with Controller

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

the class UpdateCheckAction method addUpdateButton.

private void addUpdateButton(final FreeplaneVersion lastVersion) {
    Controller controller = Controller.getCurrentController();
    final Set<String> modes = controller.getModes();
    for (final String mode : modes) {
        ModeController modeController = controller.getModeController(mode);
        if (!modeController.getUserInputListenerFactory().useRibbonMenu()) {
            final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
            if (lastVersion == null || lastVersion.compareTo(FreeplaneVersion.getVersion()) <= 0) {
                ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, "");
                if (menuBuilder.get(UPDATE_BUTTON_PATH) != null) {
                    menuBuilder.removeElement(UPDATE_BUTTON_PATH);
                }
                continue;
            }
            ResourceController.getResourceController().setProperty(LAST_UPDATE_VERSION, lastVersion.toString());
            final String updateAvailable = TextUtils.format("new_version_available", lastVersion.toString());
            controller.getViewController().out(updateAvailable);
            putValue(SHORT_DESCRIPTION, updateAvailable);
            putValue(LONG_DESCRIPTION, updateAvailable);
            if (menuBuilder.get(UPDATE_BUTTON_PATH) == null) {
                menuBuilder.addAction(UPDATE_BUTTON_LOCATION, UPDATE_BUTTON_PATH, UpdateCheckAction.this, MenuBuilder.AS_CHILD);
            }
        }
    }
}
Also used : ModeController(org.freeplane.features.mode.ModeController) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MenuBuilder(org.freeplane.core.ui.MenuBuilder)

Example 68 with Controller

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

the class ManualBugReporter method openBugTracker.

private void openBugTracker(final String log, final String hash) {
    final String option = showBugReportDialog(log, hash);
    if (!BugReportDialogManager.ALLOWED.equals(option)) {
        return;
    }
    try {
        final ResourceController resourceController = ResourceController.getResourceController();
        final String location = resourceController.getProperty("bugTrackerLocation");
        final Controller controller = Controller.getCurrentController();
        controller.getViewController().openDocument(new URL(location));
    } catch (final MalformedURLException ex) {
        UITools.errorMessage(TextUtils.getText("url_error") + "\n" + ex);
        LogUtils.warn(ex);
    } catch (final Exception ex) {
        UITools.errorMessage(ex);
        LogUtils.warn(ex);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ResourceController(org.freeplane.core.resources.ResourceController) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) URL(java.net.URL) MalformedURLException(java.net.MalformedURLException)

Example 69 with Controller

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

the class NodeIdHighLighter method deHighlight.

public void deHighlight() {
    if (originallySelectedNode == null)
        return;
    final Controller controller = Controller.getCurrentController();
    if (controller == null)
        return;
    final MapController mapController = controller.getModeController().getMapController();
    mapController.displayNode(originallySelectedNode);
    mapController.select(originallySelectedNode);
    foldOriginallyFolded(mapController);
    originallySelectedNode = null;
    pane.setToolTipText(null);
}
Also used : MapController(org.freeplane.features.map.MapController) Controller(org.freeplane.features.mode.Controller) MapController(org.freeplane.features.map.MapController)

Example 70 with Controller

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

the class AddOnInstallerPanel method createInstallActionListener.

private ActionListener createInstallActionListener() {
    return new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            final Controller controller = Controller.getCurrentController();
            try {
                LogUtils.info("installing add-on from " + urlField.getText());
                controller.getViewController().setWaitingCursor(true);
                final URL url = toURL(urlField.getText());
                setStatusInfo(getText("status.installing"));
                final ModeController modeController = controller.getModeController(MModeController.MODENAME);
                final MFileManager fileManager = (MFileManager) MFileManager.getController(modeController);
                MapModel newMap = new MMapModel();
                if (!fileManager.loadCatchExceptions(url, newMap)) {
                    LogUtils.warn("can not load " + url);
                    return;
                }
                controller.getModeController().getMapController().fireMapCreated(newMap);
                AddOnProperties addOn = (AddOnProperties) ScriptingEngine.executeScript(newMap.getRootNode(), getInstallScriptSource(), ScriptingPermissions.getPermissiveScriptingPermissions());
                if (addOn != null) {
                    setStatusInfo(getText("status.success", addOn.getName()));
                    AddOnsController.getController().registerInstalledAddOn(addOn);
                    final ManageAddOnsPanel managementPanel = addOn.isTheme() ? manageThemesPanel : manageAddOnsPanel;
                    managementPanel.getTableModel().addAddOn(addOn);
                    urlField.setText("");
                    ((JTabbedPane) getParent()).setSelectedComponent(managementPanel);
                    selectLastAddOn(managementPanel);
                }
            } catch (Exception ex) {
                UITools.errorMessage(getText("error", ex.toString()));
            } finally {
                controller.getViewController().setWaitingCursor(false);
            }
        }

        private String getInstallScriptSource() throws IOException {
            final ResourceController resourceController = ResourceController.getResourceController();
            final File scriptDir = new File(resourceController.getInstallationBaseDir(), "scripts");
            final File installScript = new File(scriptDir, "installScriptAddOn.groovy");
            if (!installScript.exists())
                throw new RuntimeException("internal error: installer not found at " + installScript);
            return FileUtils.slurpFile(installScript);
        }

        private URL toURL(String urlText) throws MalformedURLException {
            try {
                return new URL(urlText);
            } catch (Exception e2) {
                return new File(urlText).toURI().toURL();
            }
        }
    };
}
Also used : ActionEvent(java.awt.event.ActionEvent) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) JTabbedPane(javax.swing.JTabbedPane) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MMapModel(org.freeplane.features.map.mindmapmode.MMapModel) MapModel(org.freeplane.features.map.MapModel) AddOnsController(org.freeplane.main.addons.AddOnsController) ResourceController(org.freeplane.core.resources.ResourceController) Controller(org.freeplane.features.mode.Controller) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) URL(java.net.URL) AddOnProperties(org.freeplane.main.addons.AddOnProperties) URISyntaxException(java.net.URISyntaxException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ActionListener(java.awt.event.ActionListener) ResourceController(org.freeplane.core.resources.ResourceController) File(java.io.File)

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