Search in sources :

Example 61 with ModeController

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

the class FreeplaneGUIStarter method loadMaps.

private void loadMaps(final String[] args) {
    final Controller controller = Controller.getCurrentController();
    final boolean alwaysLoadLastMaps = ResourceController.getResourceController().getBooleanProperty("always_load_last_maps");
    if (alwaysLoadLastMaps && !dontLoadLastMaps) {
        loadLastMaps();
    }
    loadMaps(controller, args);
    if (controller.getMap() != null) {
        return;
    }
    if (!alwaysLoadLastMaps && !dontLoadLastMaps) {
        final AddOnsController addonsController = AddOnsController.getController();
        addonsController.setAutoInstallEnabled(false);
        loadLastMaps();
        addonsController.setAutoInstallEnabled(true);
    }
    if (firstRun && !dontLoadLastMaps) {
        final File baseDir = new File(FreeplaneGUIStarter.getResourceBaseDir()).getAbsoluteFile().getParentFile();
        final String map = ResourceController.getResourceController().getProperty("first_start_map");
        final File absolutFile = ConfigurationUtils.getLocalizedFile(new File[] { baseDir }, map, Locale.getDefault().getLanguage());
        if (absolutFile != null)
            loadMaps(controller, new String[] { absolutFile.getAbsolutePath() });
    }
    if (null != controller.getMap()) {
        return;
    }
    controller.selectMode(MModeController.MODENAME);
    final MModeController modeController = (MModeController) controller.getModeController();
    MFileManager.getController(modeController).newMapFromDefaultTemplate();
}
Also used : 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) AddOnsController(org.freeplane.main.addons.AddOnsController) File(java.io.File) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 62 with ModeController

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

the class LastOpenedList method createOpenLastMapActionList.

public List<AFreeplaneAction> createOpenLastMapActionList() {
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    int i = 0;
    int maxEntries = getMaxMenuEntries();
    List<AFreeplaneAction> openMapActions = new ArrayList<AFreeplaneAction>(maxEntries);
    for (final String key : lastOpenedList) {
        if (i == 0 && (!modeController.getModeName().equals(MModeController.MODENAME) || controller.getMap() == null || controller.getMap().getURL() == null)) {
            i++;
            maxEntries++;
        }
        if (i == maxEntries) {
            break;
        }
        final AFreeplaneAction openMapAction = new OpenLastOpenedAction(i++, this, key);
        createOpenMapItemName(openMapAction, key);
        openMapActions.add(openMapAction);
    }
    return openMapActions;
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) ArrayList(java.util.ArrayList) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) 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)

Example 63 with ModeController

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

the class LastOpenedList method updateMenus.

private void updateMenus() {
    Controller controller = Controller.getCurrentController();
    final ModeController modeController = controller.getModeController();
    if (!modeController.getUserInputListenerFactory().useRibbonMenu()) {
        final MenuBuilder menuBuilder = modeController.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
        menuBuilder.removeChildElements(MENU_CATEGORY);
        List<AFreeplaneAction> openMapActions = createOpenLastMapActionList();
        for (AFreeplaneAction openMapAction : openMapActions) {
            final IFreeplaneAction acceleratableAction = menuBuilder.acceleratableAction(openMapAction);
            final JMenuItem item = new JFreeplaneMenuItem(acceleratableAction);
            item.setMnemonic(0);
            menuBuilder.addMenuItem(MENU_CATEGORY, item, MENU_CATEGORY + '/' + openMapAction.getKey(), UIBuilder.AS_CHILD);
        }
    }
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) IFreeplaneAction(org.freeplane.core.ui.IFreeplaneAction) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) 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) JMenuItem(javax.swing.JMenuItem) MenuBuilder(org.freeplane.core.ui.MenuBuilder) JFreeplaneMenuItem(org.freeplane.core.ui.components.JFreeplaneMenuItem)

Example 64 with ModeController

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

the class SaveAll method actionPerformed.

public void actionPerformed(final ActionEvent e) {
    final Controller controller = Controller.getCurrentController();
    final Component initialMapView = controller.getMapViewManager().getMapViewComponent();
    final Map<String, MapModel> mapViews = getMapViews();
    final Iterator<Entry<String, MapModel>> iterator = mapViews.entrySet().iterator();
    while (iterator.hasNext()) {
        final Entry<String, MapModel> entry = iterator.next();
        controller.getMapViewManager().changeToMapView(entry.getKey());
        final ModeController modeController = controller.getModeController();
        if (modeController instanceof MModeController) {
            ((MModeController) modeController).save();
        }
    }
    if (initialMapView != null) {
        controller.getMapViewManager().changeToMapView(initialMapView);
    }
}
Also used : Entry(java.util.Map.Entry) MapModel(org.freeplane.features.map.MapModel) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) Controller(org.freeplane.features.mode.Controller) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ModeController(org.freeplane.features.mode.ModeController) Component(java.awt.Component) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 65 with ModeController

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

the class UrlManager method load.

/**
 *@deprecated -- use {@link MapIO#load(URL url, MapModel map)}
 */
@Deprecated
public InputStreamReader load(final URL url, final MapModel map) throws IOException, XMLException {
    InputStreamReader urlStreamReader;
    setURL(map, url);
    InputStream inputStream = getLocation(url).openStream();
    urlStreamReader = new InputStreamReader(inputStream);
    final ModeController modeController = Controller.getCurrentModeController();
    modeController.getMapController().getMapReader().createNodeTreeFromXml(map, urlStreamReader, Mode.FILE);
    return urlStreamReader;
}
Also used : InputStreamReader(java.io.InputStreamReader) InputStream(java.io.InputStream) ModeController(org.freeplane.features.mode.ModeController)

Aggregations

ModeController (org.freeplane.features.mode.ModeController)222 NodeModel (org.freeplane.features.map.NodeModel)90 Controller (org.freeplane.features.mode.Controller)56 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)48 MapModel (org.freeplane.features.map.MapModel)37 IActor (org.freeplane.core.undo.IActor)31 MapController (org.freeplane.features.map.MapController)30 ResourceController (org.freeplane.core.resources.ResourceController)29 MMapController (org.freeplane.features.map.mindmapmode.MMapController)20 File (java.io.File)17 TextController (org.freeplane.features.text.TextController)17 Color (java.awt.Color)16 Point (java.awt.Point)16 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)15 MapView (org.freeplane.view.swing.map.MapView)13 NodeView (org.freeplane.view.swing.map.NodeView)13 Component (java.awt.Component)12 URL (java.net.URL)12 LinkController (org.freeplane.features.link.LinkController)12 MenuBuilder (org.freeplane.core.ui.MenuBuilder)11