org.pushingpixels.flamingo.api.ribbon
Class RibbonApplicationMenuEntryPrimary

java.lang.Object
  extended by org.pushingpixels.flamingo.api.ribbon.RibbonApplicationMenuEntryPrimary

public class RibbonApplicationMenuEntryPrimary
extends java.lang.Object

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:


Nested Class Summary
static interface RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback
          Callback that allows application code to provide custom content on the secondary panel of the RibbonApplicationMenu.
 
Field Summary
protected  java.lang.String actionKeyTip
          Optional key tip for the action area of the command button that represents this menu entry.
protected  ResizableIcon disabledIcon
          The menu icon for disabled state.
protected  JCommandButton.CommandButtonKind entryKind
          The kind of the command button that represents this menu entry.
protected  java.util.List<java.util.List<RibbonApplicationMenuEntrySecondary>> groupEntries
          List of all menu groups.
protected  java.util.List<java.lang.String> groupTitles
          List of titles for all menu groups.
protected  ResizableIcon icon
          The menu icon.
protected  boolean isEnabled
          Enabled state of this menu.
protected  java.awt.event.ActionListener mainActionListener
          The main action listener for this menu entry.
protected  java.lang.String popupKeyTip
          Optional key tip for the popup area of the command button that represents this menu entry.
protected  RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback
          An optional rollover callback.
protected  java.lang.String text
          The menu text.
 
Constructor Summary
RibbonApplicationMenuEntryPrimary(ResizableIcon icon, java.lang.String text, java.awt.event.ActionListener mainActionListener, JCommandButton.CommandButtonKind entryKind)
          Creates the metadata description of a RibbonApplicationMenu primary menu entry.
 
Method Summary
 int addSecondaryMenuGroup(java.lang.String groupTitle, RibbonApplicationMenuEntrySecondary... entries)
          Adds a titled group of secondary menu entries.
 java.lang.String getActionKeyTip()
          Returns the key tip for the action area of the command button that represents this menu entry.
 ResizableIcon getDisabledIcon()
          Returns the disabled icon for the command button that represents this menu entry.
 JCommandButton.CommandButtonKind getEntryKind()
          Returns the kind of the command button that represents this menu entry.
 ResizableIcon getIcon()
          Returns the icon of this application menu entry.
 java.awt.event.ActionListener getMainActionListener()
          Returns the main action listener associated with this application menu entry.
 java.lang.String getPopupKeyTip()
          Returns the key tip for the popup area of the command button that represents this menu entry.
 RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback getRolloverCallback()
          Returns the current application callback that allows placing custom content in the secondary panel of the RibbonApplicationMenu when this primary menu entry is activated.
 int getSecondaryGroupCount()
          Returns the number of secondary menu groups of this primary menu entry.
 java.util.List<RibbonApplicationMenuEntrySecondary> getSecondaryGroupEntries(int groupIndex)
          Returns an unmodifiable list of menu entries of the secondary menu group at the specified index.
 java.lang.String getSecondaryGroupTitleAt(int groupIndex)
          Returns the title of the secondary menu group at the specified index.
 java.lang.String getText()
          Returns the text of this application menu entry.
 boolean isEnabled()
          Returns the enabled state of the command button that represents this menu entry.
 void setActionKeyTip(java.lang.String actionKeyTip)
          Sets the new value for the key tip 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(java.lang.String popupKeyTip)
          Sets the new value for the key tip 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 the RibbonApplicationMenu when this primary menu entry is activated.
 void setSecondaryGroupTitle(int groupIndex, java.lang.String newTitle)
          Changes the title of the specified group.
 void setText(java.lang.String text)
          Sets the new text for this application menu entry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rolloverCallback

protected RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback rolloverCallback
An optional rollover callback. It allows the application to place custom content in the secondary panel of the RibbonApplicationMenu when this primary menu entry is activated.

See Also:
setRolloverCallback(PrimaryRolloverCallback), getRolloverCallback()

groupTitles

protected java.util.List<java.lang.String> groupTitles
List of titles for all menu groups.


groupEntries

protected java.util.List<java.util.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 be null.


text

protected java.lang.String text
The menu text.


mainActionListener

protected java.awt.event.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 java.lang.String actionKeyTip
Optional key tip for the action area of the command button that represents this menu entry.


popupKeyTip

protected java.lang.String popupKeyTip
Optional key tip for the popup area of the command button that represents this menu entry.

Constructor Detail

RibbonApplicationMenuEntryPrimary

public RibbonApplicationMenuEntryPrimary(ResizableIcon icon,
                                         java.lang.String text,
                                         java.awt.event.ActionListener mainActionListener,
                                         JCommandButton.CommandButtonKind entryKind)
Creates the metadata description of a RibbonApplicationMenu 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 is JCommandButton.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(java.lang.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 java.lang.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 java.util.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 the RibbonApplicationMenu when this primary menu entry is activated.

Parameters:
rolloverCallback - The new rollover callback for populating the secondary panel of the RibbonApplicationMenu.
See Also:
getRolloverCallback()

getRolloverCallback

public RibbonApplicationMenuEntryPrimary.PrimaryRolloverCallback getRolloverCallback()
Returns the current application callback that allows placing custom content in the secondary panel of the RibbonApplicationMenu when 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,
                                   java.lang.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 java.lang.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(java.lang.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 java.awt.event.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 - If true, the command button that represents this menu entry will be enabled, if false, 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:
true if the command button that represents this menu entry is enabled, false otherwise.

getActionKeyTip

public java.lang.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(java.lang.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 java.lang.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(java.lang.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)

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()