Search in sources :

Example 1 with SetAcceleratorOnNextClickAction

use of org.freeplane.core.ui.SetAcceleratorOnNextClickAction in project freeplane by freeplane.

the class MModeControllerFactory method createStandardControllers.

private void createStandardControllers() {
    final Controller controller = Controller.getCurrentController();
    modeController = new MModeController(controller);
    final UserInputListenerFactory userInputListenerFactory = new UserInputListenerFactory(modeController, UITools.useRibbonsMenu());
    final IMouseListener nodeMouseMotionListener = new MNodeMotionListener();
    userInputListenerFactory.setNodeMouseMotionListener(nodeMouseMotionListener);
    final JPopupMenu popupmenu = new JPopupMenu();
    userInputListenerFactory.setNodePopupMenu(popupmenu);
    modeController.setUserInputListenerFactory(userInputListenerFactory);
    controller.addModeController(modeController);
    controller.selectModeForBuild(modeController);
    new MMapController(modeController);
    if (userInputListenerFactory.useRibbonMenu()) {
        RibbonBuilder builder = userInputListenerFactory.getMenuBuilder(RibbonBuilder.class);
        final RibbonMapChangeAdapter mapChangeAdapter = builder.getMapChangeAdapter();
        modeController.getMapController().addNodeSelectionListener(mapChangeAdapter);
        modeController.getMapController().addNodeChangeListener(mapChangeAdapter);
        modeController.getMapController().addMapChangeListener(mapChangeAdapter);
        controller.getMapViewManager().addMapSelectionListener(mapChangeAdapter);
    }
    final MFileManager fileManager = new MFileManager();
    UrlManager.install(fileManager);
    MMapIO.install(modeController);
    controller.getMapViewManager().addMapViewChangeListener(fileManager);
    IconController.install(new MIconController(modeController));
    new ProgressFactory().installActions(modeController);
    final MapController mapController = modeController.getMapController();
    EdgeController.install(new MEdgeController(modeController));
    CloudController.install(new MCloudController(modeController));
    NoteController.install(new MNoteController(modeController));
    userInputListenerFactory.setMapMouseListener(new MMapMouseListener());
    final MTextController textController = new MTextController(modeController);
    TextController.install(textController);
    LinkController.install(new MLinkController());
    NodeStyleController.install(new MNodeStyleController(modeController));
    ClipboardController.install(new MClipboardController());
    userInputListenerFactory.setNodeDragListener(new MNodeDragListener());
    userInputListenerFactory.setNodeDropTargetListener(new MNodeDropListener());
    LocationController.install(new MLocationController());
    final MLogicalStyleController logicalStyleController = new MLogicalStyleController(modeController);
    LogicalStyleController.install(logicalStyleController);
    logicalStyleController.initM();
    AttributeController.install(new MAttributeController(modeController));
    userInputListenerFactory.setNodeKeyListener(new DefaultNodeKeyListener(new IEditHandler() {

        public void edit(final KeyEvent e, final FirstAction action, final boolean editLong) {
            ((MTextController) MTextController.getController(modeController)).getEventQueue().activate(e);
            textController.edit(action, editLong);
        }
    }));
    userInputListenerFactory.setNodeMotionListener(new MNodeMotionListener());
    modeController.addAction(new EditAttributesAction());
    SpellCheckerController.install(modeController);
    ExportController.install(new ExportController("/xml/ExportWithXSLT.xml"));
    MapStyle.install(true);
    final FreeplaneToolBar toolbar = new FreeplaneToolBar("main_toolbar", SwingConstants.HORIZONTAL);
    final FrameController frameController = (FrameController) controller.getViewController();
    UIComponentVisibilityDispatcher.install(frameController, toolbar, "toolbarVisible");
    if (!userInputListenerFactory.useRibbonMenu()) {
        userInputListenerFactory.addToolBar("/main_toolbar", ViewController.TOP, toolbar);
    }
    userInputListenerFactory.addToolBar("/filter_toolbar", ViewController.BOTTOM, FilterController.getController(controller).getFilterToolbar());
    userInputListenerFactory.addToolBar("/status", ViewController.BOTTOM, frameController.getStatusBar());
    final JTabbedPane formattingPanel = new JTabbedPane();
    Box resisableTabs = new CollapseableBoxBuilder(frameController).setPropertyNameBase("styleScrollPaneVisible").createBox(formattingPanel, Direction.RIGHT);
    modeController.getUserInputListenerFactory().addToolBar("/format", ViewController.RIGHT, resisableTabs);
    KeyBindingProcessor keyProcessor = new KeyBindingProcessor();
    modeController.addExtension(KeyBindingProcessor.class, keyProcessor);
    keyProcessor.addKeyStrokeProcessor(userInputListenerFactory.getAcceleratorManager());
    final FButtonBar fButtonToolBar = new FButtonBar(frameController.getRootPaneContainer().getRootPane(), keyProcessor);
    UIComponentVisibilityDispatcher.install(frameController, fButtonToolBar, "fbarVisible");
    fButtonToolBar.setVisible(ResourceController.getResourceController().getBooleanProperty("fbarVisible"));
    userInputListenerFactory.addToolBar("/fbuttons", ViewController.TOP, fButtonToolBar);
    controller.addAction(new ToggleToolbarAction("ToggleFBarAction", "/fbuttons"));
    SModeControllerFactory.install();
    modeController.addAction(new SetAcceleratorOnNextClickAction());
    modeController.addAction(new ShowNotesInMapAction());
    // userInputListenerFactory.getMenuBuilder().setAcceleratorChangeListener(fButtonToolBar);
    userInputListenerFactory.getAcceleratorManager().addAcceleratorChangeListener(fButtonToolBar);
    userInputListenerFactory.addToolBar("/icon_toolbar", ViewController.LEFT, ((MIconController) IconController.getController()).getIconToolBarScrollPane());
    modeController.addAction(new ToggleToolbarAction("ToggleLeftToolbarAction", "/icon_toolbar"));
    new RevisionPlugin();
    FoldingController.install(new FoldingController());
    uiFactory = new MUIFactory();
    mapController.addNodeChangeListener(uiFactory);
    mapController.addNodeSelectionListener(uiFactory);
    mapController.addMapChangeListener(uiFactory);
    controller.getMapViewManager().addMapSelectionListener(uiFactory);
    final MToolbarContributor menuContributor = new MToolbarContributor(uiFactory);
    modeController.addExtension(MUIFactory.class, uiFactory);
    modeController.addMenuContributor(menuContributor);
    new CloneStateIconSupplier().registerStateIconProvider();
// IconController.getController(modeController).addStateIconProvider(new IStateIconProvider() {
// public UIIcon getStateIcon(NodeModel node) {
// final URI link = NodeLinks.getLink(node);
// return wrapIcon(LinkController.getLinkIcon(link, node));
// }
// 
// private UIIcon wrapIcon(final Icon linkIcon) {
// UIIcon icon = null;
// if(linkIcon != null) {
// if(linkIcon instanceof UIIcon) {
// icon = (UIIcon) linkIcon;
// }
// else {
// icon = new UIIcon("ownIcon", null) {
// public Icon getIcon() {
// return linkIcon;
// }
// };
// }
// }
// return icon;
// }
// });
}
Also used : MUIFactory(org.freeplane.features.styles.mindmapmode.MUIFactory) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) ProgressFactory(org.freeplane.view.swing.features.progress.mindmapmode.ProgressFactory) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MMapMouseListener(org.freeplane.view.swing.ui.mindmapmode.MMapMouseListener) JTabbedPane(javax.swing.JTabbedPane) MFileManager(org.freeplane.features.url.mindmapmode.MFileManager) IEditHandler(org.freeplane.core.ui.IEditHandler) KeyEvent(java.awt.event.KeyEvent) FoldingController(org.freeplane.features.map.FoldingController) MNodeMotionListener(org.freeplane.view.swing.ui.mindmapmode.MNodeMotionListener) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) KeyBindingProcessor(org.freeplane.core.ui.KeyBindingProcessor) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) FrameController(org.freeplane.features.ui.FrameController) CloneStateIconSupplier(org.freeplane.features.map.CloneStateIconSupplier) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction) RibbonMapChangeAdapter(org.freeplane.core.ui.ribbon.RibbonMapChangeAdapter) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) UserInputListenerFactory(org.freeplane.view.swing.ui.UserInputListenerFactory) EditAttributesAction(org.freeplane.view.swing.map.attribute.EditAttributesAction) Box(javax.swing.Box) ViewerController(org.freeplane.view.swing.features.filepreview.ViewerController) MTextController(org.freeplane.features.text.mindmapmode.MTextController) MEncryptionController(org.freeplane.features.encrypt.mindmapmode.MEncryptionController) ChangeNodeLevelController(org.freeplane.features.map.mindmapmode.ChangeNodeLevelController) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MAttributeController(org.freeplane.features.attribute.mindmapmode.MAttributeController) FilterController(org.freeplane.features.filter.FilterController) IconController(org.freeplane.features.icon.IconController) Controller(org.freeplane.features.mode.Controller) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) MEdgeController(org.freeplane.features.edge.mindmapmode.MEdgeController) ResourceController(org.freeplane.core.resources.ResourceController) ViewController(org.freeplane.features.ui.ViewController) CloudController(org.freeplane.features.cloud.CloudController) MCloudController(org.freeplane.features.cloud.mindmapmode.MCloudController) FrameController(org.freeplane.features.ui.FrameController) AutomaticLayoutController(org.freeplane.features.styles.AutomaticLayoutController) AttributeController(org.freeplane.features.attribute.AttributeController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) MLogicalStyleController(org.freeplane.features.styles.mindmapmode.MLogicalStyleController) EdgeController(org.freeplane.features.edge.EdgeController) MapController(org.freeplane.features.map.MapController) MIconController(org.freeplane.features.icon.mindmapmode.MIconController) FoldingController(org.freeplane.features.map.FoldingController) TextController(org.freeplane.features.text.TextController) NodeStyleController(org.freeplane.features.nodestyle.NodeStyleController) SpellCheckerController(org.freeplane.features.spellchecker.mindmapmode.SpellCheckerController) ClipboardController(org.freeplane.features.clipboard.ClipboardController) NoteController(org.freeplane.features.note.NoteController) ExportController(org.freeplane.features.export.mindmapmode.ExportController) LogicalStyleController(org.freeplane.features.styles.LogicalStyleController) LinkController(org.freeplane.features.link.LinkController) LocationController(org.freeplane.features.nodelocation.LocationController) MLocationController(org.freeplane.features.nodelocation.mindmapmode.MLocationController) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MClipboardController(org.freeplane.features.clipboard.mindmapmode.MClipboardController) MModeController(org.freeplane.features.mode.mindmapmode.MModeController) MNodeDragListener(org.freeplane.view.swing.ui.mindmapmode.MNodeDragListener) FButtonBar(org.freeplane.core.ui.components.FButtonBar) RibbonBuilder(org.freeplane.core.ui.ribbon.RibbonBuilder) JPopupMenu(javax.swing.JPopupMenu) MMapController(org.freeplane.features.map.mindmapmode.MMapController) MapController(org.freeplane.features.map.MapController) MNoteController(org.freeplane.features.note.mindmapmode.MNoteController) ToggleToolbarAction(org.freeplane.features.ui.ToggleToolbarAction) MNodeStyleController(org.freeplane.features.nodestyle.mindmapmode.MNodeStyleController) MLinkController(org.freeplane.features.link.mindmapmode.MLinkController) IMouseListener(org.freeplane.core.ui.IMouseListener) FreeplaneToolBar(org.freeplane.core.ui.components.FreeplaneToolBar) RevisionPlugin(org.freeplane.features.nodestyle.mindmapmode.RevisionPlugin) MNodeDropListener(org.freeplane.view.swing.ui.mindmapmode.MNodeDropListener) DefaultNodeKeyListener(org.freeplane.view.swing.ui.DefaultNodeKeyListener) MTextController(org.freeplane.features.text.mindmapmode.MTextController) CollapseableBoxBuilder(org.freeplane.features.ui.CollapseableBoxBuilder) ShowNotesInMapAction(org.freeplane.view.swing.map.ShowNotesInMapAction) MModeController(org.freeplane.features.mode.mindmapmode.MModeController)

Example 2 with SetAcceleratorOnNextClickAction

use of org.freeplane.core.ui.SetAcceleratorOnNextClickAction in project freeplane by freeplane.

the class FButtonBar method processFKey.

private boolean processFKey(final KeyEvent e) {
    if (e.getID() != KeyEvent.KEY_PRESSED)
        return false;
    final Window windowAncestor = SwingUtilities.getWindowAncestor(e.getComponent());
    if (windowAncestor != ownWindowAncestor) /*|| !ownWindowAncestor.getJMenuBar().isEnabled()*/
    {
        resetModifiers();
        return false;
    }
    int keyCode = e.getKeyCode();
    if (keyCode >= KeyEvent.VK_F1 && keyCode <= KeyEvent.VK_F12) {
        final JButton btn = createButtons(nextModifiers)[keyCode - KeyEvent.VK_F1];
        if (btn.getAction() instanceof SetAcceleratorOnNextClickAction && e.getComponent() instanceof JTextComponent)
            return false;
        if (timer.isRunning()) {
            timer.stop();
            onModifierChangeImpl();
        }
        btn.doClick();
        return true;
    }
    return false;
}
Also used : Window(java.awt.Window) SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction) JButton(javax.swing.JButton) JTextComponent(javax.swing.text.JTextComponent)

Example 3 with SetAcceleratorOnNextClickAction

use of org.freeplane.core.ui.SetAcceleratorOnNextClickAction in project freeplane by freeplane.

the class FButtonBar method setAcceleratorAction.

private void setAcceleratorAction(final JButton button, final KeyStroke ks) {
    final SetAcceleratorOnNextClickAction setAcceleratorAction = new SetAcceleratorOnNextClickAction(ks);
    button.setAction(setAcceleratorAction);
    final String text = TextUtils.getText("f_button_unassigned");
    button.setText(text);
    button.setToolTipText(setAcceleratorAction.getValue(Action.NAME).toString());
}
Also used : SetAcceleratorOnNextClickAction(org.freeplane.core.ui.SetAcceleratorOnNextClickAction)

Aggregations

SetAcceleratorOnNextClickAction (org.freeplane.core.ui.SetAcceleratorOnNextClickAction)3 Window (java.awt.Window)1 KeyEvent (java.awt.event.KeyEvent)1 Box (javax.swing.Box)1 JButton (javax.swing.JButton)1 JPopupMenu (javax.swing.JPopupMenu)1 JTabbedPane (javax.swing.JTabbedPane)1 JTextComponent (javax.swing.text.JTextComponent)1 ResourceController (org.freeplane.core.resources.ResourceController)1 IEditHandler (org.freeplane.core.ui.IEditHandler)1 IMouseListener (org.freeplane.core.ui.IMouseListener)1 KeyBindingProcessor (org.freeplane.core.ui.KeyBindingProcessor)1 FButtonBar (org.freeplane.core.ui.components.FButtonBar)1 FreeplaneToolBar (org.freeplane.core.ui.components.FreeplaneToolBar)1 RibbonBuilder (org.freeplane.core.ui.ribbon.RibbonBuilder)1 RibbonMapChangeAdapter (org.freeplane.core.ui.ribbon.RibbonMapChangeAdapter)1 AttributeController (org.freeplane.features.attribute.AttributeController)1 MAttributeController (org.freeplane.features.attribute.mindmapmode.MAttributeController)1 ClipboardController (org.freeplane.features.clipboard.ClipboardController)1 MClipboardController (org.freeplane.features.clipboard.mindmapmode.MClipboardController)1