Search in sources :

Example 11 with AFreeplaneAction

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

the class WorkspaceController method replaceAction.

public static void replaceAction(final AFreeplaneAction action) {
    AFreeplaneAction previousAction = getAction(action.getKey());
    if (previousAction != null) {
        removeAction(action.getKey());
    }
    addAction(action);
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction)

Example 12 with AFreeplaneAction

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

the class WorkspacePopupMenuBuilder method insertAction.

public static void insertAction(final WorkspacePopupMenu popupMenu, String actionKey, int index) {
    assert actionKey != null;
    assert popupMenu != null;
    if (actionKey.equals(SEPARATOR)) {
        popupMenu.add(new JPopupMenu.Separator(), index);
    } else {
        AFreeplaneAction action = Controller.getCurrentController().getAction(actionKey);
        if (action == null) {
            return;
        }
        final JMenuItem item;
        if (action.getClass().getAnnotation(SelectableAction.class) != null) {
            item = new JAutoCheckBoxMenuItem(action);
        } else {
            item = new JFreeplaneMenuItem(action);
        }
        popupMenu.add(item, index);
        addListeners(popupMenu, action);
    }
    return;
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) JAutoCheckBoxMenuItem(org.freeplane.core.ui.components.JAutoCheckBoxMenuItem) JMenuItem(javax.swing.JMenuItem) SelectableAction(org.freeplane.core.ui.SelectableAction) JPopupMenu(javax.swing.JPopupMenu) JFreeplaneMenuItem(org.freeplane.core.ui.components.JFreeplaneMenuItem)

Example 13 with AFreeplaneAction

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

the class AActionNode method handleAction.

public void handleAction(WorkspaceActionEvent event) {
    if (event.getType() == WorkspaceActionEvent.WSNODE_OPEN_DOCUMENT) {
        AFreeplaneAction action = Controller.getCurrentController().getAction(getType());
        if (action == null) {
            LogUtils.severe("No action '" + getType() + "' found");
            return;
        }
        action.actionPerformed(new ActionEvent(this, 0, "execute"));
    } else if (event.getType() == WorkspaceActionEvent.MOUSE_RIGHT_CLICK) {
        showPopup((Component) event.getBaggage(), event.getX(), event.getY());
    }
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) ActionEvent(java.awt.event.ActionEvent) WorkspaceActionEvent(org.freeplane.plugin.workspace.event.WorkspaceActionEvent) Component(java.awt.Component)

Example 14 with AFreeplaneAction

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

the class PresentationEditorController method createActionPanel.

private JComponent createActionPanel(ModeController modeController) {
    AFreeplaneAction exportPresentationAction = modeController.getAction("ExportPresentationAction");
    AFreeplaneAction exportAllPresentationsAction = modeController.getAction("ExportAllPresentationsAction");
    JPanel controlButtons = new JPanel(new GridLayout(3, 1));
    JButton btnExportPresentation = new JButton(exportPresentationAction);
    btnExportPresentation.setAlignmentX(JButton.CENTER_ALIGNMENT);
    controlButtons.add(btnExportPresentation);
    JButton btnExportAllPresentations = new JButton(exportAllPresentationsAction);
    btnExportAllPresentations.setAlignmentX(JButton.CENTER_ALIGNMENT);
    controlButtons.add(btnExportAllPresentations);
    AFreeplaneAction configureAction = modeController.getAction("ShowPreferencesAction");
    JButton btnConfigure = new JButton(configureAction);
    btnConfigure.setActionCommand(OptionPanel.OPTION_PANEL_RESOURCE_PREFIX + "Presentation");
    btnConfigure.setAlignmentX(JButton.CENTER_ALIGNMENT);
    controlButtons.add(btnConfigure);
    final Dimension maximumSize = new Dimension(controlButtons.getPreferredSize());
    maximumSize.width = Integer.MAX_VALUE;
    controlButtons.setMaximumSize(maximumSize);
    return controlButtons;
}
Also used : JPanel(javax.swing.JPanel) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) GridLayout(java.awt.GridLayout) JButton(javax.swing.JButton) Dimension(java.awt.Dimension)

Example 15 with AFreeplaneAction

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

the class EntryAccessorTest method setsAction.

@Test
public void setsAction() throws Exception {
    final AFreeplaneAction action = mock(AFreeplaneAction.class);
    entryAccessor.setAction(entry, action);
    final AFreeplaneAction entryAction = entryAccessor.getAction(entry);
    Assert.assertThat(entryAction, equalTo(action));
}
Also used : AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) Test(org.junit.Test)

Aggregations

AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)66 EntryAccessor (org.freeplane.core.ui.menubuilders.generic.EntryAccessor)23 Entry (org.freeplane.core.ui.menubuilders.generic.Entry)20 Test (org.junit.Test)20 Component (java.awt.Component)9 ArrayList (java.util.ArrayList)9 KeyStroke (javax.swing.KeyStroke)8 JCommandButton (org.pushingpixels.flamingo.api.common.JCommandButton)8 Container (java.awt.Container)6 ARibbonContributor (org.freeplane.core.ui.ribbon.ARibbonContributor)6 RibbonBuildContext (org.freeplane.core.ui.ribbon.RibbonBuildContext)6 Controller (org.freeplane.features.mode.Controller)6 ModeController (org.freeplane.features.mode.ModeController)6 ActionEvent (java.awt.event.ActionEvent)5 JMenuItem (javax.swing.JMenuItem)5 ResourceController (org.freeplane.core.resources.ResourceController)5 JComponent (javax.swing.JComponent)4 MModeController (org.freeplane.features.mode.mindmapmode.MModeController)4 RichTooltip (org.pushingpixels.flamingo.api.common.RichTooltip)4 PopupPanelCallback (org.pushingpixels.flamingo.api.common.popup.PopupPanelCallback)4