|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.swing.visuals.MenuBar
public class MenuBar
MenuBar is a sub-class of javax.swing.JMenuBar
that sends out events
when any of the JMenuItems on it are triggered. ForwardedActionEvents
and ForwardedItemEvents are sent out. The individual JMenuItems
are also accessable from their ActionCommands using this MenuBar.
Notes:
updateJMenuItems()
, removeListeners()
,
or addListeners()
.
Field Summary | |
---|---|
protected ForwardedActionListenerList |
forwardedActionListenerList
Manages a list of listeners for ForwardedActionEvent |
protected ForwardedItemListenerList |
forwardedItemListenerList
Manages a list of listeners for ForwardedItemEvent |
protected java.awt.event.ItemListener |
itemListenerList
ItemListener that listens to Item events |
Constructor Summary | |
---|---|
MenuBar()
Constructor, empty and no initializing |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Handles ActionEvents from the JMenuItems on this MenuBar. |
javax.swing.JMenu |
add(javax.swing.JMenu m)
Adds the specified menu to the menu bar. |
void |
addForwardedActionListener(ForwardedActionListener listener)
Add an ForwardedActionListener to listen for ForwardedActionEvents on the MenuBar. |
void |
addForwardedItemListener(ForwardedItemListener listener)
Adds a ForwardedItemListener to listen for ForwardedItemEvents on the BaseButton The events are sent whenever an ItemSelectable JMenuItem component sends out an ForwardedItemEvent. |
void |
addItemListener(java.awt.event.ItemListener listener)
Adds an ItemListener to listen for ForwardedItemEvents on the MenuBar. |
void |
addListeners(javax.swing.JMenuItem menuItem,
boolean parseMenu)
Adds event listeners needed to the given JMenuItem. |
java.lang.reflect.Method |
getEventMethod(java.lang.reflect.Method lMethod)
Gets the event method. |
java.lang.String[] |
getEventValues(java.lang.reflect.Method lMethod)
Gets a string array of event values. |
static com.sas.beans.ExtendedBeanInfo |
getExtendedBeanInfo()
Returns information used by the com.sas.beans.Introspector to
augment the automatically introspected information about this MenuBar. |
javax.swing.JMenuItem[] |
getMenuItems(java.lang.String cmdStr)
Get the JMenuItems that have the specified actionCommand String. |
java.lang.Object[] |
getSelectedObjects()
Here for compatibility with the java.awt.ItemSelectable interface. |
void |
itemStateChanged(java.awt.event.ItemEvent evt)
Handles ActionEvents from the ItemSelectable JMenuItems on this MenuBar. |
protected java.util.Enumeration |
parseCommands(javax.swing.JMenu currentMenu)
Parses the JMenu to get and add action commands to an OrderedCollection, and returns enumeration of the action commands |
protected void |
parseMenu(javax.swing.JMenu currentMenu,
boolean addListeners)
Parses the JMenu to add or remove the MenuBar as a listener to any events sent out by JMenuItems on the given JMenu. |
protected java.util.Enumeration |
parseMenuCommands(javax.swing.JMenu currentMenu,
java.lang.String cmdStr)
Parses a JMenu to find any JMenuItems that use the specified actionCommand String. |
protected void |
processForwardedActionEvent(ForwardedActionEvent e)
Process ForwardedActionEvents sent from the MenuBar to its ForwardedActionListeners. |
protected void |
processForwardedItemEvent(ForwardedItemEvent e)
Process ForwardedItemEvents sent from the MenuBar to its ForwardedItemListeners. |
protected void |
processItemEvent(java.awt.event.ItemEvent e)
Process ItemEvents sent from the MenuBar to its ItemListeners. |
void |
removeForwardedActionListener(ForwardedActionListener listener)
Removes a ForwardedActionListener from the list of listeners to be notified of ForwardedActionEvents. |
void |
removeForwardedItemListener(ForwardedItemListener listener)
Removes a ForwardedItemListener from the list of listeners to be notified of an ForwardedItemEvent. |
void |
removeItemListener(java.awt.event.ItemListener listener)
Removes an ItemListener from the list of listeners to be notified of ForwardedItemEvents. |
void |
removeListeners(javax.swing.JMenuItem menuItem,
boolean parseMenu)
Removes event listeners from the given JMenuItem. |
void |
setMenuItemsEnabled(java.lang.String cmd,
boolean enabled)
Sets the JMenuItems with the specified actionCommand to the given enabled state. |
boolean |
supportsListenerInterface(java.lang.Class listenerInterface)
Indicates whether the listenerInterface class passed in is a ForwardedActionListener . |
void |
updateJMenuItems()
Parses all of the current JMenuItems and add the MenuBar as a listener to any events that they send out. |
Field Detail |
---|
protected transient java.awt.event.ItemListener itemListenerList
protected transient ForwardedActionListenerList forwardedActionListenerList
protected transient ForwardedItemListenerList forwardedItemListenerList
Constructor Detail |
---|
public MenuBar()
Method Detail |
---|
public static com.sas.beans.ExtendedBeanInfo getExtendedBeanInfo()
com.sas.beans.Introspector
to
augment the automatically introspected information about this MenuBar.
public javax.swing.JMenu add(javax.swing.JMenu m)
add
in class javax.swing.JMenuBar
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- the ActionEvent that occurredpublic void itemStateChanged(java.awt.event.ItemEvent evt)
itemStateChanged
in interface java.awt.event.ItemListener
evt
- the ItemEvent that changedpublic java.lang.Object[] getSelectedObjects()
getSelectedObjects
in interface java.awt.ItemSelectable
public void addForwardedActionListener(ForwardedActionListener listener)
addForwardedActionListener
in interface ForwardedActionSource
listener
- the ForwardedActionListener to send the ForwardedActionEvents to.ForwardedActionEvent
,
ForwardedActionListener
,
removeForwardedActionListener(com.sas.visuals.ForwardedActionListener)
public void removeForwardedActionListener(ForwardedActionListener listener)
removeForwardedActionListener
in interface ForwardedActionSource
listener
- the ForwardedActionListener to stop sending the ForwardedActionEvents to.ForwardedActionEvent
,
ForwardedActionListener
,
addForwardedActionListener(com.sas.visuals.ForwardedActionListener)
public void addItemListener(java.awt.event.ItemListener listener)
addItemListener
in interface java.awt.ItemSelectable
listener
- the ItemListener to send the ItemEvents to.ItemEvent
,
ItemListener
,
removeItemListener(java.awt.event.ItemListener)
public void removeItemListener(java.awt.event.ItemListener listener)
removeItemListener
in interface java.awt.ItemSelectable
listener
- the ItemListener to stop sending the ItemEvents to.ItemEvent
,
ItemListener
,
addItemListener(java.awt.event.ItemListener)
public void addForwardedItemListener(ForwardedItemListener listener)
addForwardedItemListener
in interface ForwardedItemSource
listener
- the ForwardedItemListener to send the ItemEvents to.ForwardedItemEvent
,
ForwardedItemListener
,
removeForwardedItemListener(com.sas.visuals.ForwardedItemListener)
public void removeForwardedItemListener(ForwardedItemListener listener)
removeForwardedItemListener
in interface ForwardedItemSource
listener
- the ForwardedItemListener to stop sending the ForwardedItemEvents to.ForwardedItemEvent
,
ForwardedItemListener
,
addForwardedItemListener(com.sas.visuals.ForwardedItemListener)
protected void processForwardedActionEvent(ForwardedActionEvent e)
e
- the ForwardedActionEvent that needs to be processedprotected void processItemEvent(java.awt.event.ItemEvent e)
e
- the ItemEvent that needs to be processedprotected void processForwardedItemEvent(ForwardedItemEvent e)
e
- the ForwardedItemEvent that needs to be processedpublic javax.swing.JMenuItem[] getMenuItems(java.lang.String cmdStr)
cmdStr
- the actionCommand String of the JMenuItems to return.
public void setMenuItemsEnabled(java.lang.String cmd, boolean enabled)
cmd
- the actionCommand of the JMenuItems to findenabled
- the new enabled state of the JMenuItems foundprotected java.util.Enumeration parseMenuCommands(javax.swing.JMenu currentMenu, java.lang.String cmdStr)
currentMenu
- the JMenu to parse for JMenuItems with cmdStr for their actionCommand String.cmdStr
- the actionCommand String of the JMenuItems to return or null to return all JMenuItems.
public void updateJMenuItems()
protected void parseMenu(javax.swing.JMenu currentMenu, boolean addListeners)
currentMenu
- the JMenu to add or remove the MenuBar as a listener
to all of its JMenuItems.addListeners
- if true, add the MenuBar as a listener to the JMenuItems on this JMenu,
when false, remove the MenuBar as a listener to the JMenuItems on this JMenu.public void removeListeners(javax.swing.JMenuItem menuItem, boolean parseMenu)
menuItem
- the JMenuItem to remove the MenuBar as a listener.parseMenu
- if true and the menuItem is a JMenu instance, remove the MenuBar
as a listener from all sub-JMenuItemspublic void addListeners(javax.swing.JMenuItem menuItem, boolean parseMenu)
menuItem
- the JMenuItem to add the MenuBar as a listener.parseMenu
- if true and the menuItem is a JMenu instance, add the MenuBar
as a listener to all sub-JMenuItemspublic boolean supportsListenerInterface(java.lang.Class listenerInterface)
supportsListenerInterface
in interface MultipleValueEventSourceInterface
listenerInterface
- the class to be tested
true
if listenerInterface is a ForwardedActionListener.public java.lang.reflect.Method getEventMethod(java.lang.reflect.Method lMethod)
getEventMethod
in interface MultipleValueEventSourceInterface
IMethod
- Method
object to get the event method from
public java.lang.String[] getEventValues(java.lang.reflect.Method lMethod)
getEventValues
in interface MultipleValueEventSourceInterface
IMethod
- Method
object to get the event values from
protected java.util.Enumeration parseCommands(javax.swing.JMenu currentMenu)
currentMenu
- the JMenu to get and add action commands to the ordered collection
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |