Class RibbonApplicationMenuEntryPrimary
- java.lang.Object
-
- org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary
-
public class RibbonApplicationMenuEntryPrimary extends Object
Metadata description for the primary menu entries of theRibbonApplicationMenu. 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
ActionListenerpassed 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. TheQuitmenu item is an example of such a primary menu entry. - Associated
RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallbackset 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). TheOpenmenu item is an example of such a primary menu entry, showing a list of recently opened files. - Associated list of
RibbonApplicationMenuEntrySecondarys 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 Asmenu item is an example of such a primary menu item, showing a list of default save formats.
- Associated
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceRibbonApplicationMenuEntryPrimary.PrimaryRolloverCallbackCallback that allows application code to provide custom content on the secondary panel of theRibbonApplicationMenu.
-
Field Summary
Fields Modifier and Type Field Description protected StringactionKeyTipOptional key tip for the action area of the command button that represents this menu entry.protected RichTooltipactionRichTooltipOptional tooltip for the action area of the command button that represents this menu entry.protected ResizableIcondisabledIconThe menu icon for disabled state.protected JCommandButton.CommandButtonKindentryKindThe kind of the command button that represents this menu entry.protected List<List<RibbonApplicationMenuEntrySecondary>>groupEntriesList of all menu groups.protected List<String>groupTitlesList of titles for all menu groups.protected ResizableIconiconThe menu icon.protected booleanisEnabledEnabled state of this menu.protected ActionListenermainActionListenerThe main action listener for this menu entry.protected StringpopupKeyTipOptional key tip for the popup area of the command button that represents this menu entry.protected RichTooltippopupRichTooltipOptional tooltip for the popup area of the command button that represents this menu entry.protected RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallbackrolloverCallbackAn optional rollover callback.protected StringtextThe menu text.
-
Constructor Summary
Constructors Constructor Description RibbonApplicationMenuEntryPrimary(ResizableIcon icon, String text, ActionListener mainActionListener, JCommandButton.CommandButtonKind entryKind)Creates the metadata description of aRibbonApplicationMenuprimary menu entry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddSecondaryMenuGroup(String groupTitle, RibbonApplicationMenuEntrySecondary... entries)Adds a titled group of secondary menu entries.StringgetActionKeyTip()Returns the key tip for the action area of the command button that represents this menu entry.RichTooltipgetActionRichTooltip()Returns the rich tooltip for the action area of the command button that represents this menu entry.ResizableIcongetDisabledIcon()Returns the disabled icon for the command button that represents this menu entry.JCommandButton.CommandButtonKindgetEntryKind()Returns the kind of the command button that represents this menu entry.ResizableIcongetIcon()Returns the icon of this application menu entry.ActionListenergetMainActionListener()Returns the main action listener associated with this application menu entry.StringgetPopupKeyTip()Returns the key tip for the popup area of the command button that represents this menu entry.RichTooltipgetPopupRichTooltip()Returns the rich tooltip for the popup area of the command button that represents this menu entry.RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallbackgetRolloverCallback()Returns the current application callback that allows placing custom content in the secondary panel of theRibbonApplicationMenuwhen this primary menu entry is activated.intgetSecondaryGroupCount()Returns the number of secondary menu groups of this primary menu entry.List<RibbonApplicationMenuEntrySecondary>getSecondaryGroupEntries(int groupIndex)Returns an unmodifiable list of menu entries of the secondary menu group at the specified index.StringgetSecondaryGroupTitleAt(int groupIndex)Returns the title of the secondary menu group at the specified index.StringgetText()Returns the text of this application menu entry.booleanisEnabled()Returns the enabled state of the command button that represents this menu entry.voidsetActionKeyTip(String actionKeyTip)Sets the new value for the key tip for the action area of the command button that represents this menu entry.voidsetActionRichTooltip(RichTooltip actionRichTooltip)Sets the rich tooltip for the action area of the command button that represents this menu entry.voidsetDisabledIcon(ResizableIcon disabledIcon)Sets the disabled icon for the command button that represents this menu entry.voidsetEnabled(boolean isEnabled)Sets the enabled state of the command button that represents this menu entry.voidsetPopupKeyTip(String popupKeyTip)Sets the new value for the key tip for the popup area of the command button that represents this menu entry.voidsetPopupRichTooltip(RichTooltip popupRichTooltip)Sets the rich tooltip for the popup area of the command button that represents this menu entry.voidsetRolloverCallback(RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback)Sets the rollover callback that allows the application to place custom content in the secondary panel of theRibbonApplicationMenuwhen this primary menu entry is activated.voidsetSecondaryGroupTitle(int groupIndex, String newTitle)Changes the title of the specified group.voidsetText(String text)Sets the new text for this application menu entry.
-
-
-
Field Detail
-
rolloverCallback
protected RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback
An optional rollover callback. It allows the application to place custom content in the secondary panel of theRibbonApplicationMenuwhen this primary menu entry is activated.
-
groupEntries
protected List<List<RibbonApplicationMenuEntrySecondary>> groupEntries
List of all menu groups.
-
icon
protected ResizableIcon icon
The menu icon.
-
disabledIcon
protected ResizableIcon disabledIcon
The menu icon for disabled state. Optional, can benull.
-
text
protected String text
The menu text.
-
mainActionListener
protected ActionListener mainActionListener
The main action listener for this menu entry.
-
entryKind
protected JCommandButton.CommandButtonKind entryKind
The kind of the command button that represents this menu entry.
-
isEnabled
protected boolean isEnabled
Enabled state of this menu.
-
actionKeyTip
protected String actionKeyTip
Optional key tip for the action area of the command button that represents this menu entry.
-
popupKeyTip
protected String popupKeyTip
Optional key tip for the popup area of the command button that represents this menu entry.
-
actionRichTooltip
protected RichTooltip actionRichTooltip
Optional tooltip for the action area of the command button that represents this menu entry.
-
popupRichTooltip
protected RichTooltip popupRichTooltip
Optional tooltip for the popup area of the command button that represents this menu entry.
-
-
Constructor Detail
-
RibbonApplicationMenuEntryPrimary
public RibbonApplicationMenuEntryPrimary(ResizableIcon icon, String text, ActionListener mainActionListener, JCommandButton.CommandButtonKind entryKind)
Creates the metadata description of aRibbonApplicationMenuprimary 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 Detail
-
addSecondaryMenuGroup
public int addSecondaryMenuGroup(String groupTitle, RibbonApplicationMenuEntrySecondary... entries)
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(),getSecondaryGroupTitleAt(int),getSecondaryGroupEntries(int)
-
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:
addSecondaryMenuGroup(String, RibbonApplicationMenuEntrySecondary...),getSecondaryGroupTitleAt(int),getSecondaryGroupEntries(int)
-
getSecondaryGroupTitleAt
public String getSecondaryGroupTitleAt(int groupIndex)
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:
addSecondaryMenuGroup(String, RibbonApplicationMenuEntrySecondary...),getSecondaryGroupCount(),getSecondaryGroupEntries(int)
-
getSecondaryGroupEntries
public List<RibbonApplicationMenuEntrySecondary> getSecondaryGroupEntries(int groupIndex)
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:
addSecondaryMenuGroup(String, RibbonApplicationMenuEntrySecondary...),getSecondaryGroupCount(),getSecondaryGroupTitleAt(int)
-
setRolloverCallback
public void setRolloverCallback(RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback)
Sets the rollover callback that allows the application to place custom content in the secondary panel of theRibbonApplicationMenuwhen this primary menu entry is activated.- Parameters:
rolloverCallback- The new rollover callback for populating the secondary panel of theRibbonApplicationMenu.- See Also:
getRolloverCallback()
-
getRolloverCallback
public RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback getRolloverCallback()
Returns the current application callback that allows placing custom content in the secondary panel of theRibbonApplicationMenuwhen this primary menu entry is activated.- Returns:
- The current rollover callback for populating the secondary panel
of the
RibbonApplicationMenu. - See Also:
setRolloverCallback(PrimaryRolloverCallback)
-
setSecondaryGroupTitle
public void setSecondaryGroupTitle(int groupIndex, String newTitle)Changes the title of the specified group.- Parameters:
groupIndex- Group index.newTitle- New title for the specified group.
-
getIcon
public ResizableIcon getIcon()
Returns the icon of this application menu entry.- Returns:
- The icon of this application menu entry.
-
getText
public String getText()
Returns the text of this application menu entry.- Returns:
- The text of this application menu entry.
- See Also:
setText(String)
-
setText
public void setText(String text)
Sets the new text for this application menu entry.- Parameters:
text- The new text for this application menu entry.- See Also:
getText()
-
getMainActionListener
public ActionListener getMainActionListener()
Returns the main action listener associated with this application menu entry.- Returns:
- The main action listener associated with this application menu entry.
-
getEntryKind
public JCommandButton.CommandButtonKind 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
-
isEnabled
public boolean isEnabled()
Returns the enabled state of the command button that represents this menu entry.- Returns:
trueif the command button that represents this menu entry is enabled,falseotherwise.
-
getActionKeyTip
public String 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(String),getPopupKeyTip()
-
setActionKeyTip
public 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.- Parameters:
actionKeyTip- The new value for the key tip for the action area of the command button that represents this menu entry.- See Also:
getActionKeyTip(),setPopupKeyTip(String)
-
getPopupKeyTip
public String 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(String),getActionKeyTip()
-
setPopupKeyTip
public 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.- Parameters:
popupKeyTip- The new value for the key tip for the popup area of the command button that represents this menu entry.- See Also:
getPopupKeyTip(),setActionKeyTip(String)
-
getActionRichTooltip
public RichTooltip 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:
#setPopupTooltip(RichTooltip),getActionRichTooltip()
-
setActionRichTooltip
public void setActionRichTooltip(RichTooltip actionRichTooltip)
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:
getActionRichTooltip(),#setActionTooltip(RichTooltip)
-
getPopupRichTooltip
public RichTooltip 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:
#setPopupTooltip(RichTooltip),getActionRichTooltip()
-
setPopupRichTooltip
public void setPopupRichTooltip(RichTooltip popupRichTooltip)
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:
getPopupRichTooltip(),#setActionTooltip(RichTooltip)
-
getDisabledIcon
public ResizableIcon 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(ResizableIcon)
-
setDisabledIcon
public void setDisabledIcon(ResizableIcon disabledIcon)
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:
getDisabledIcon()
-
-