Search in sources :

Example 1 with MModeController

use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.

the class AttributeManagerDialog method applyChanges.

private void applyChanges() {
    model.applyChanges();
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    modeController.delayedCommit();
    final MapController mapController = modeController.getMapController();
    final MapModel map = Controller.getCurrentController().getMap();
    assert (AttributeRegistry.getRegistry(map) == model);
    mapController.setSaved(map, false);
}
Also used : MapModel(org.freeplane.features.map.MapModel) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MapController(org.freeplane.features.map.MapController)

Example 2 with MModeController

use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.

the class RevisionPlugin method nodeChanged.

public void nodeChanged(final NodeChangeEvent event) {
    final NodeModel node = event.getNode();
    if (!isActive(node)) {
        return;
    }
    if (event.getProperty().equals(NodeModel.NODE_TEXT) && !((MModeController) Controller.getCurrentModeController()).isUndoAction()) {
        final MNodeStyleController nodeStyleController = (MNodeStyleController) NodeStyleController.getController();
        final String colorProperty = ResourceController.getResourceController().getProperty("revision_color");
        final Color color = ColorUtils.stringToColor(colorProperty);
        nodeStyleController.setBackgroundColor(event.getNode(), color);
    }
}
Also used : NodeModel(org.freeplane.features.map.NodeModel) Color(java.awt.Color) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 3 with MModeController

use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.

the class MTextController method edit.

public void edit(final NodeModel nodeModel, final NodeModel prevSelectedModel, final boolean isNewNode, final boolean parentFolded, final boolean editLong) {
    if (nodeModel == null || mCurrentEditor != null) {
        return;
    }
    final Controller controller = Controller.getCurrentController();
    if (controller.getMap() != nodeModel.getMap()) {
        return;
    }
    final IMapViewManager viewController = controller.getMapViewManager();
    final Component map = viewController.getMapViewComponent();
    map.validate();
    map.invalidate();
    final Component node = viewController.getComponent(nodeModel);
    if (node == null) {
        return;
    }
    node.requestFocus();
    stopEditing();
    if (isNewNode && !eventQueue.isActive() && !ResourceController.getResourceController().getBooleanProperty("display_inline_editor_for_all_new_nodes")) {
        keyEventDispatcher = new EditEventDispatcher(Controller.getCurrentModeController(), nodeModel, prevSelectedModel, isNewNode, parentFolded, editLong);
        keyEventDispatcher.install();
        return;
    }
    ;
    final IEditControl editControl = new IEditControl() {

        @Override
        public void cancel() {
            if (isNewNode && nodeModel.getMap().equals(controller.getMap())) {
                if (nodeModel.getParentNode() != null) {
                    controller.getSelection().selectAsTheOnlyOneSelected(nodeModel);
                    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
                    modeController.undo();
                    modeController.resetRedo();
                }
                final MapController mapController = Controller.getCurrentModeController().getMapController();
                if (parentFolded) {
                    mapController.fold(prevSelectedModel);
                }
            }
            stop();
        }

        private void stop() {
            Controller.getCurrentModeController().setBlocked(false);
            viewController.obtainFocusForSelected();
            mCurrentEditor = null;
        }

        @Override
        public void ok(final String text) {
            String processedText = makePlainIfNoFormattingFound(text);
            keepNodePosition();
            setGuessedNodeObject(nodeModel, processedText);
            stop();
        }

        private void keepNodePosition() {
            Controller.getCurrentController().getSelection().keepNodePosition(nodeModel, 0, 0);
        }

        @Override
        public void split(final String text, final int position) {
            String processedText = HtmlUtils.isHtmlNode(text) ? removeHtmlHead(text) : text;
            splitNode(nodeModel, position, processedText);
            viewController.obtainFocusForSelected();
            stop();
        }

        @Override
        public boolean canSplit() {
            return true;
        }

        @Override
        public EditedComponent getEditType() {
            return EditedComponent.TEXT;
        }
    };
    mCurrentEditor = createEditor(nodeModel, editControl, nodeModel.getText(), isNewNode, editLong, true);
    final RootPaneContainer frame = (RootPaneContainer) UITools.getCurrentRootComponent();
    mCurrentEditor.show(frame);
}
Also used : IMapViewManager(org.freeplane.features.ui.IMapViewManager) RootPaneContainer(javax.swing.RootPaneContainer) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) TextController(org.freeplane.features.text.TextController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) FormatController(org.freeplane.features.format.FormatController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) LinkController(org.freeplane.features.link.LinkController) ModeController(org.freeplane.features.mode.ModeController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) ScannerController(org.freeplane.features.format.ScannerController) EditedComponent(org.freeplane.features.text.mindmapmode.EditNodeBase.EditedComponent) Component(java.awt.Component) IEditControl(org.freeplane.features.text.mindmapmode.EditNodeBase.IEditControl) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController)

Example 4 with MModeController

use of org.freeplane.features.mode.mindmapmode.MModeController 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 5 with MModeController

use of org.freeplane.features.mode.mindmapmode.MModeController in project freeplane by freeplane.

the class AddOnsController method registerInstalledAddOn.

public void registerInstalledAddOn(final AddOnProperties addOn) {
    installedAddOns.add(addOn);
    final ResourceController resourceController = ResourceController.getResourceController();
    if (addOn.getDefaultProperties() != null)
        resourceController.addDefaults(addOn.getDefaultProperties());
    if (addOn.getTranslations() != null)
        registerAddOnResources(addOn, resourceController);
    if (addOn.getPreferencesXml() != null) {
        final ModeController modeController = Controller.getCurrentModeController();
        if (modeController instanceof MModeController) {
            ((MModeController) modeController).getOptionPanelBuilder().load(new StringReader(addOn.getPreferencesXml()));
        }
    }
}
Also used : ResourceController(org.freeplane.core.resources.ResourceController) StringReader(java.io.StringReader) ModeController(org.freeplane.features.mode.ModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Aggregations

MModeController (org.freeplane.features.mode.mindmapmode.MModeController)23 Controller (org.freeplane.features.mode.Controller)8 ModeController (org.freeplane.features.mode.ModeController)8 MMapController (org.freeplane.features.map.mindmapmode.MMapController)6 LinkController (org.freeplane.features.link.LinkController)5 MLinkController (org.freeplane.features.link.mindmapmode.MLinkController)5 ResourceController (org.freeplane.core.resources.ResourceController)4 NodeModel (org.freeplane.features.map.NodeModel)4 Component (java.awt.Component)3 URL (java.net.URL)3 RootPaneContainer (javax.swing.RootPaneContainer)3 ClipboardController (org.freeplane.features.clipboard.ClipboardController)3 IconController (org.freeplane.features.icon.IconController)3 MIconController (org.freeplane.features.icon.mindmapmode.MIconController)3 MapController (org.freeplane.features.map.MapController)3 MapModel (org.freeplane.features.map.MapModel)3 NodeStyleController (org.freeplane.features.nodestyle.NodeStyleController)3 MNodeStyleController (org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController)3 LogicalStyleController (org.freeplane.features.styles.LogicalStyleController)3 TextController (org.freeplane.features.text.TextController)3