Search in sources :

Example 6 with ResizableIcon

use of org.pushingpixels.flamingo.api.common.icon.ResizableIcon in project freeplane by freeplane.

the class RibbonActionContributorFactory method createCommandToggleButton.

public static JCommandToggleButton createCommandToggleButton(final AFreeplaneAction action) {
    String title = ActionUtils.getActionTitle(action);
    ResizableIcon icon = ActionUtils.getActionIcon(action);
    final JCommandToggleButton button = new JCommandToggleButton(title, icon);
    updateRichTooltip(button, action, null);
    button.addActionListener(new RibbonActionListener(action));
    button.setFocusable(false);
    return button;
}
Also used : JCommandToggleButton(org.pushingpixels.flamingo.api.common.JCommandToggleButton) ImageWrapperResizableIcon(org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon) ResizableIcon(org.pushingpixels.flamingo.api.common.icon.ResizableIcon)

Example 7 with ResizableIcon

use of org.pushingpixels.flamingo.api.common.icon.ResizableIcon in project freeplane by freeplane.

the class RibbonActionContributorFactory method createCommandButton.

public static JCommandButton createCommandButton(final AFreeplaneAction action) {
    String title = ActionUtils.getActionTitle(action);
    ResizableIcon icon = ActionUtils.getActionIcon(action);
    final JCommandButton button = new JCommandButton(title, icon);
    updateRichTooltip(button, action, null);
    button.addActionListener(new RibbonActionListener(action));
    button.setFocusable(false);
    return button;
}
Also used : JCommandButton(org.pushingpixels.flamingo.api.common.JCommandButton) ImageWrapperResizableIcon(org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon) ResizableIcon(org.pushingpixels.flamingo.api.common.icon.ResizableIcon)

Example 8 with ResizableIcon

use of org.pushingpixels.flamingo.api.common.icon.ResizableIcon in project freeplane by freeplane.

the class ScriptingRibbonsContributor method createScriptButton.

private JCommandMenuButton createScriptButton(final String scriptName, final String scriptPath, ExecutionMode executionMode) {
    final ScriptMetaData metaData = configuration.getMenuTitleToMetaDataMap().get(scriptName);
    final String title = scriptNameToMenuItemTitle(scriptName);
    AFreeplaneAction action = new ExecuteScriptAction(scriptName, title, scriptPath, executionMode, metaData.cacheContent(), metaData.getPermissions());
    ResizableIcon icon = ActionUtils.getActionIcon(action);
    final JCommandMenuButton scriptEntry = new JCommandMenuButton(title, icon);
    scriptEntry.setActionRichTooltip(createRichTooltip(title, metaData));
    scriptEntry.addActionListener(action);
    scriptEntry.setFocusable(false);
    scriptEntry.setEnabled(metaData.getExecutionModes().contains(executionMode));
    return scriptEntry;
}
Also used : JCommandMenuButton(org.pushingpixels.flamingo.api.common.JCommandMenuButton) AFreeplaneAction(org.freeplane.core.ui.AFreeplaneAction) ScriptMetaData(org.freeplane.plugin.script.ScriptingConfiguration.ScriptMetaData) ImageWrapperResizableIcon(org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon) ResizableIcon(org.pushingpixels.flamingo.api.common.icon.ResizableIcon)

Example 9 with ResizableIcon

use of org.pushingpixels.flamingo.api.common.icon.ResizableIcon in project freeplane by freeplane.

the class RibbonMenuPrimaryContributorFactory method createMenuEntry.

/**
 *********************************************************************************
 * METHODS
 *********************************************************************************
 */
public static RibbonApplicationMenuEntryPrimary createMenuEntry(final AFreeplaneAction action, CommandButtonKind kind) {
    String title = ActionUtils.getActionTitle(action);
    ResizableIcon icon = ActionUtils.getActionIcon(action);
    RibbonApplicationMenuEntryPrimary entry = new RibbonApplicationMenuEntryPrimary(icon, title, new RibbonActionContributorFactory.RibbonActionListener(action), kind);
    return entry;
}
Also used : ResizableIcon(org.pushingpixels.flamingo.api.common.icon.ResizableIcon) RibbonApplicationMenuEntryPrimary(org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary)

Example 10 with ResizableIcon

use of org.pushingpixels.flamingo.api.common.icon.ResizableIcon in project freeplane by freeplane.

the class ActionUtils method getActionIcon.

public static ResizableIcon getActionIcon(final AFreeplaneAction action) {
    ResizableIcon icon = null;
    ImageIcon ico = (ImageIcon) action.getValue(Action.SMALL_ICON);
    if (ico != null) {
        icon = ImageWrapperResizableIcon.getIcon(ico.getImage(), new Dimension(ico.getIconWidth(), ico.getIconHeight()));
    } else {
        String resource = ResourceController.getResourceController().getProperty(action.getIconKey(), null);
        if (resource != null) {
            URL location = ResourceController.getResourceController().getResource(resource);
            icon = ImageWrapperResizableIcon.getIcon(location, new Dimension(16, 16));
        }
    }
    if (icon == null) {
        icon = RibbonActionContributorFactory.BLANK_ACTION_ICON;
    }
    return icon;
}
Also used : ImageIcon(javax.swing.ImageIcon) Dimension(java.awt.Dimension) ImageWrapperResizableIcon(org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon) ResizableIcon(org.pushingpixels.flamingo.api.common.icon.ResizableIcon) URL(java.net.URL)

Aggregations

ResizableIcon (org.pushingpixels.flamingo.api.common.icon.ResizableIcon)10 ImageWrapperResizableIcon (org.pushingpixels.flamingo.api.common.icon.ImageWrapperResizableIcon)8 Dimension (java.awt.Dimension)2 URL (java.net.URL)2 AFreeplaneAction (org.freeplane.core.ui.AFreeplaneAction)2 JCommandMenuButton (org.pushingpixels.flamingo.api.common.JCommandMenuButton)2 Component (java.awt.Component)1 ActionListener (java.awt.event.ActionListener)1 ImageIcon (javax.swing.ImageIcon)1 JButton (javax.swing.JButton)1 KeyStroke (javax.swing.KeyStroke)1 ScriptMetaData (org.freeplane.plugin.script.ScriptingConfiguration.ScriptMetaData)1 JCommandButton (org.pushingpixels.flamingo.api.common.JCommandButton)1 JCommandToggleButton (org.pushingpixels.flamingo.api.common.JCommandToggleButton)1 JCommandToggleMenuButton (org.pushingpixels.flamingo.api.common.JCommandToggleMenuButton)1 RichTooltip (org.pushingpixels.flamingo.api.common.RichTooltip)1 RibbonApplicationMenuEntryFooter (org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryFooter)1 RibbonApplicationMenuEntryPrimary (org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary)1 JRibbonApplicationMenuButton (org.pushingpixels.flamingo.internal.ui.ribbon.appmenu.JRibbonApplicationMenuButton)1