Search in sources :

Example 16 with MModeController

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

the class AutomaticLayoutController method toggle.

@Override
protected IExtension toggle(NodeModel node, IExtension extension) {
    extension = super.toggle(node, extension);
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    if (modeController.isUndoAction()) {
        return extension;
    }
    LogicalStyleController.getController().refreshMap(node.getMap());
    return extension;
}
Also used : MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 17 with MModeController

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

the class MTextController method editDetails.

public void editDetails(final NodeModel nodeModel, InputEvent e, final boolean editLong) {
    final Controller controller = Controller.getCurrentController();
    stopEditing();
    Controller.getCurrentModeController().setBlocked(true);
    String text = DetailTextModel.getDetailTextText(nodeModel);
    final boolean isNewNode = text == null;
    if (isNewNode) {
        final MTextController textController = MTextController.getController();
        textController.setDetails(nodeModel, "<html>");
        text = "";
    }
    final EditNodeBase.IEditControl editControl = new EditNodeBase.IEditControl() {

        @Override
        public void cancel() {
            if (isNewNode) {
                final String detailText = DetailTextModel.getDetailTextText(nodeModel);
                final MModeController modeController = (MModeController) Controller.getCurrentModeController();
                if (detailText != null)
                    modeController.undo();
                modeController.resetRedo();
            }
            stop();
        }

        @Override
        public void ok(final String newText) {
            if (HtmlUtils.isEmpty(newText))
                if (isNewNode) {
                    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
                    modeController.undo();
                    modeController.resetRedo();
                } else {
                    keepNodePosition();
                    setDetailsHtmlText(nodeModel, null);
                }
            else {
                keepNodePosition();
                setDetailsHtmlText(nodeModel, newText);
            }
            stop();
        }

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

        @Override
        public void split(final String newText, final int position) {
        }

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

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

        @Override
        public EditedComponent getEditType() {
            return EditedComponent.DETAIL;
        }
    };
    mCurrentEditor = createEditor(nodeModel, editControl, text, false, editLong, true);
    final RootPaneContainer frame = (RootPaneContainer) SwingUtilities.getWindowAncestor(controller.getMapViewManager().getMapViewComponent());
    mCurrentEditor.show(frame);
}
Also used : 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) IEditControl(org.freeplane.features.text.mindmapmode.EditNodeBase.IEditControl) IEditControl(org.freeplane.features.text.mindmapmode.EditNodeBase.IEditControl) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 18 with MModeController

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

the class AutomaticEdgeColorHook method toggle.

@Override
protected IExtension toggle(NodeModel node, IExtension extension) {
    extension = super.toggle(node, extension);
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    if (modeController.isUndoAction()) {
        return extension;
    }
    LogicalStyleController.getController().refreshMap(node.getMap());
    return extension;
}
Also used : MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 19 with MModeController

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

the class FButtonBar method dispatchKeyEvent.

public boolean dispatchKeyEvent(final KeyEvent e) {
    if (!(Controller.getCurrentModeController() instanceof MModeController))
        return false;
    if (ownWindowAncestor == null) {
        ownWindowAncestor = (JFrame) SwingUtilities.getWindowAncestor(this);
        if (ownWindowAncestor == null) {
            return false;
        }
        ownWindowAncestor.addWindowFocusListener(this);
    }
    final Window windowAncestor = SwingUtilities.getWindowAncestor(e.getComponent());
    if (windowAncestor == ownWindowAncestor && ownWindowAncestor.getJMenuBar() != null && ownWindowAncestor.getJMenuBar().isEnabled()) {
        processDispatchedKeyEvent(e);
    } else {
        resetModifiers();
    }
    if (e.getKeyCode() == KeyEvent.VK_ALT) {
        switch(e.getID()) {
            case KeyEvent.KEY_PRESSED:
                {
                    final Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
                    return altPressedEventHidden = !(focusOwner instanceof JRootPane || 0 == (e.getModifiersEx() & ~(KeyEvent.ALT_MASK | KeyEvent.ALT_DOWN_MASK)));
                }
            case KeyEvent.KEY_RELEASED:
                if (altPressedEventHidden) {
                    altPressedEventHidden = false;
                    return true;
                }
                break;
        }
    }
    return false;
}
Also used : Window(java.awt.Window) JRootPane(javax.swing.JRootPane) JComponent(javax.swing.JComponent) Component(java.awt.Component) JTextComponent(javax.swing.text.JTextComponent) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 20 with MModeController

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

the class MFileManager method createPreferences.

private void createPreferences() {
    final MModeController modeController = (MModeController) Controller.getCurrentModeController();
    final OptionPanelBuilder optionPanelBuilder = modeController.getOptionPanelBuilder();
    optionPanelBuilder.addCreator("Environment/load", new IPropertyControlCreator() {

        @Override
        public IPropertyControl createControl() {
            final Set<String> charsets = Charset.availableCharsets().keySet();
            final LinkedList<String> charsetList = new LinkedList<String>(charsets);
            charsetList.addFirst("JVMdefault");
            final LinkedList<String> charsetTranslationList = new LinkedList<String>(charsets);
            charsetTranslationList.addFirst(TextUtils.getText("OptionPanel.default"));
            return new ComboProperty("default_charset", charsetList, charsetTranslationList);
        }
    }, IndexedTree.AS_CHILD);
    optionPanelBuilder.addCreator("Environment/files/skip_template_selection", new IPropertyControlCreator() {

        @Override
        public IPropertyControl createControl() {
            final Collection<String> templates = collectAvailableMapTemplates();
            ComboProperty comboProperty = new ComboProperty(STANDARD_TEMPLATE, templates, templates);
            comboProperty.setEditable(true);
            return comboProperty;
        }
    }, IndexedTree.BEFORE);
}
Also used : ComboProperty(org.freeplane.core.resources.components.ComboProperty) IPropertyControlCreator(org.freeplane.core.resources.components.IPropertyControlCreator) Set(java.util.Set) TreeSet(java.util.TreeSet) OptionPanelBuilder(org.freeplane.core.resources.components.OptionPanelBuilder) Collection(java.util.Collection) IPropertyControl(org.freeplane.core.resources.components.IPropertyControl) LinkedList(java.util.LinkedList) 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