Class RibbonApplicationMenuEntryPrimary
java.lang.Object
org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary
Metadata description for the primary menu entries of the
RibbonApplicationMenu
. The primary menu entries at runtime are
represented by command menu buttons placed in the left panel of the
application menu.
There are three different types of primary entries:
- Associated
ActionListener
passed to theRibbonApplicationMenuEntryPrimary(org.pushingpixels.flamingo.api.common.icon.ResizableIcon, String, java.awt.event.ActionListener, org.pushingpixels.flamingo.api.common.JCommandButton.CommandButtonKind)
. When this entry is armed (with mouse rollover or via keyboard navigation), the contents of the secondary area are cleared. TheQuit
menu item is an example of such a primary menu entry. - Associated
RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback
set by thesetRolloverCallback(PrimaryRolloverCallback)
. When this entry is armed (with mouse rollover or via keyboard navigation), the contents of the secondary area are populated by the application callback implementation ofRibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback.menuEntryActivated(javax.swing.JPanel)
. TheOpen
menu item is an example of such a primary menu entry, showing a list of recently opened files. - Associated list of
RibbonApplicationMenuEntrySecondary
s added with theaddSecondaryMenuGroup(String, RibbonApplicationMenuEntrySecondary...)
API. When this entry is armed (with mouse rollover or via keyboard navigation), the secondary area shows menu buttons for the registered secondary menu entries. TheSave As
menu item is an example of such a primary menu item, showing a list of default save formats.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Callback that allows application code to provide custom content on the secondary panel of theRibbonApplicationMenu
. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected String
Optional key tip for the action area of the command button that represents this menu entry.protected RichTooltip
Optional tooltip for the action area of the command button that represents this menu entry.protected ResizableIcon
The menu icon for disabled state.protected JCommandButton.CommandButtonKind
The kind of the command button that represents this menu entry.protected List
<List<RibbonApplicationMenuEntrySecondary>> List of all menu groups.List of titles for all menu groups.protected ResizableIcon
The menu icon.protected boolean
Enabled state of this menu.protected ActionListener
The main action listener for this menu entry.protected String
Optional key tip for the popup area of the command button that represents this menu entry.protected RichTooltip
Optional tooltip for the popup area of the command button that represents this menu entry.An optional rollover callback.protected String
The menu text. -
Constructor Summary
ConstructorsConstructorDescriptionRibbonApplicationMenuEntryPrimary
(ResizableIcon icon, String text, ActionListener mainActionListener, JCommandButton.CommandButtonKind entryKind) Creates the metadata description of aRibbonApplicationMenu
primary menu entry. -
Method Summary
Modifier and TypeMethodDescriptionint
addSecondaryMenuGroup
(String groupTitle, RibbonApplicationMenuEntrySecondary... entries) Adds a titled group of secondary menu entries.Returns the key tip for the action area of the command button that represents this menu entry.Returns the rich tooltip for the action area of the command button that represents this menu entry.Returns the disabled icon for the command button that represents this menu entry.Returns the kind of the command button that represents this menu entry.getIcon()
Returns the icon of this application menu entry.Returns the main action listener associated with this application menu entry.Returns the key tip for the popup area of the command button that represents this menu entry.Returns the rich tooltip for the popup area of the command button that represents this menu entry.Returns the current application callback that allows placing custom content in the secondary panel of theRibbonApplicationMenu
when this primary menu entry is activated.int
Returns the number of secondary menu groups of this primary menu entry.getSecondaryGroupEntries
(int groupIndex) Returns an unmodifiable list of menu entries of the secondary menu group at the specified index.getSecondaryGroupTitleAt
(int groupIndex) Returns the title of the secondary menu group at the specified index.getText()
Returns the text of this application menu entry.boolean
Returns the enabled state of the command button that represents this menu entry.void
setActionKeyTip
(String actionKeyTip) Sets the new value for the key tip for the action area of the command button that represents this menu entry.void
setActionRichTooltip
(RichTooltip actionRichTooltip) Sets the rich tooltip for the action area of the command button that represents this menu entry.void
setDisabledIcon
(ResizableIcon disabledIcon) Sets the disabled icon for the command button that represents this menu entry.void
setEnabled
(boolean isEnabled) Sets the enabled state of the command button that represents this menu entry.void
setPopupKeyTip
(String popupKeyTip) Sets the new value for the key tip for the popup area of the command button that represents this menu entry.void
setPopupRichTooltip
(RichTooltip popupRichTooltip) Sets the rich tooltip for the popup area of the command button that represents this menu entry.void
setRolloverCallback
(RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback) Sets the rollover callback that allows the application to place custom content in the secondary panel of theRibbonApplicationMenu
when this primary menu entry is activated.void
setSecondaryGroupTitle
(int groupIndex, String newTitle) Changes the title of the specified group.void
Sets the new text for this application menu entry.
-
Field Details
-
rolloverCallback
An optional rollover callback. It allows the application to place custom content in the secondary panel of theRibbonApplicationMenu
when this primary menu entry is activated.- See Also:
-
groupTitles
List of titles for all menu groups. -
groupEntries
List of all menu groups. -
icon
The menu icon. -
disabledIcon
The menu icon for disabled state. Optional, can benull
. -
text
The menu text. -
mainActionListener
The main action listener for this menu entry. -
entryKind
The kind of the command button that represents this menu entry. -
isEnabled
protected boolean isEnabledEnabled state of this menu. -
actionKeyTip
Optional key tip for the action area of the command button that represents this menu entry. -
popupKeyTip
Optional key tip for the popup area of the command button that represents this menu entry. -
actionRichTooltip
Optional tooltip for the action area of the command button that represents this menu entry. -
popupRichTooltip
Optional tooltip for the popup area of the command button that represents this menu entry.
-
-
Constructor Details
-
RibbonApplicationMenuEntryPrimary
public RibbonApplicationMenuEntryPrimary(ResizableIcon icon, String text, ActionListener mainActionListener, JCommandButton.CommandButtonKind entryKind) Creates the metadata description of aRibbonApplicationMenu
primary menu entry.- Parameters:
icon
- The icon of this menu entry. Must be non-null
.text
- The text of this menu entry. Must be non-null
.mainActionListener
- The main action listener for this menu entry. If the entry kind isJCommandButton.CommandButtonKind.POPUP_ONLY
, this listener will be ignored.entryKind
- The kind of the command button that will represent this menu entry. Must be non-null
.
-
-
Method Details
-
addSecondaryMenuGroup
Adds a titled group of secondary menu entries.- Parameters:
groupTitle
- The title of the group.entries
- The secondary menu entries belonging to this group.- Returns:
- The index of the newly added menu group.
- See Also:
-
getSecondaryGroupCount
public int getSecondaryGroupCount()Returns the number of secondary menu groups of this primary menu entry.- Returns:
- The number of secondary menu groups of this primary menu entry.
- See Also:
-
getSecondaryGroupTitleAt
Returns the title of the secondary menu group at the specified index.- Parameters:
groupIndex
- The index of a secondary menu group.- Returns:
- The title of the secondary menu group at the specified index.
- See Also:
-
getSecondaryGroupEntries
Returns an unmodifiable list of menu entries of the secondary menu group at the specified index.- Parameters:
groupIndex
- The index of a secondary menu group.- Returns:
- An unmodifiable list of menu entries of the secondary menu group at the specified index.
- See Also:
-
setRolloverCallback
public void setRolloverCallback(RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback) Sets the rollover callback that allows the application to place custom content in the secondary panel of theRibbonApplicationMenu
when this primary menu entry is activated.- Parameters:
rolloverCallback
- The new rollover callback for populating the secondary panel of theRibbonApplicationMenu
.- See Also:
-
getRolloverCallback
Returns the current application callback that allows placing custom content in the secondary panel of theRibbonApplicationMenu
when this primary menu entry is activated.- Returns:
- The current rollover callback for populating the secondary panel
of the
RibbonApplicationMenu
. - See Also:
-
setSecondaryGroupTitle
Changes the title of the specified group.- Parameters:
groupIndex
- Group index.newTitle
- New title for the specified group.
-
getIcon
Returns the icon of this application menu entry.- Returns:
- The icon of this application menu entry.
-
getText
Returns the text of this application menu entry.- Returns:
- The text of this application menu entry.
- See Also:
-
setText
Sets the new text for this application menu entry.- Parameters:
text
- The new text for this application menu entry.- See Also:
-
getMainActionListener
Returns the main action listener associated with this application menu entry.- Returns:
- The main action listener associated with this application menu entry.
-
getEntryKind
Returns the kind of the command button that represents this menu entry.- Returns:
- The kind of the command button that represents this menu entry.
-
setEnabled
public void setEnabled(boolean isEnabled) Sets the enabled state of the command button that represents this menu entry.- Parameters:
isEnabled
- Iftrue
, the command button that represents this menu entry will be enabled, iffalse
, the command button will be disabled.- See Also:
-
isEnabled
public boolean isEnabled()Returns the enabled state of the command button that represents this menu entry.- Returns:
true
if the command button that represents this menu entry is enabled,false
otherwise.
-
getActionKeyTip
Returns the key tip for the action area of the command button that represents this menu entry.- Returns:
- The key tip for the action area of the command button that represents this menu entry.
- See Also:
-
setActionKeyTip
Sets the new value for the key tip for the action area of the command button that represents this menu entry.- Parameters:
actionKeyTip
- The new value for the key tip for the action area of the command button that represents this menu entry.- See Also:
-
getPopupKeyTip
Returns the key tip for the popup area of the command button that represents this menu entry.- Returns:
- The key tip for the popup area of the command button that represents this menu entry.
- See Also:
-
setPopupKeyTip
Sets the new value for the key tip for the popup area of the command button that represents this menu entry.- Parameters:
popupKeyTip
- The new value for the key tip for the popup area of the command button that represents this menu entry.- See Also:
-
getActionRichTooltip
Returns the rich tooltip for the action area of the command button that represents this menu entry.- Returns:
- The rich tooltip for the action area of the command button that represents this menu entry.
- See Also:
-
setActionRichTooltip
Sets the rich tooltip for the action area of the command button that represents this menu entry.- Parameters:
actionRichTooltip
- The rich tooltip for the action area of the command button that represents this menu entry.- See Also:
-
getPopupRichTooltip
Returns the rich tooltip for the popup area of the command button that represents this menu entry.- Returns:
- The rich tooltip for the popup area of the command button that represents this menu entry.
- See Also:
-
setPopupRichTooltip
Sets the rich tooltip for the popup area of the command button that represents this menu entry.- Parameters:
popupRichTooltip
- The rich tooltip for the popup area of the command button that represents this menu entry.- See Also:
-
getDisabledIcon
Returns the disabled icon for the command button that represents this menu entry.- Returns:
- The disabled icon for the command button that represents this menu entry.
- See Also:
-
setDisabledIcon
Sets the disabled icon for the command button that represents this menu entry.- Parameters:
disabledIcon
- The disabled icon for the command button that represents this menu entry.- See Also:
-