net.curre.prefcount.gui.menu
Class MenuItemsBean

java.lang.Object
  extended by net.curre.prefcount.gui.menu.MenuItemsBean

public class MenuItemsBean
extends java.lang.Object

Object of this class represents menu items bean to coordinate action events among menu bar menu items and option panel radio buttons.

Created date: Apr 9, 2008

Author:
Yevgeny Nyden

Constructor Summary
MenuItemsBean()
          Constructs a new menu items bean object.
 
Method Summary
 void addListener(java.lang.Object listener, WindowComponent... itemEnums)
          Adds listener to provided items.
 javax.swing.JButton createJButtonForChoosePlayerDialog(javax.swing.JPanel pane)
          Creates a JButton for the choose player dialog.
 javax.swing.JButton getJButton(WindowComponent itemEnum, javax.swing.JPanel pane)
          Fetches a JButton object for the given item enumeration.
 javax.swing.JMenuItem getJMenuItem(WindowComponent itemEnum)
          Fetches a JMenuItem menu item for the given item enumeration.
 javax.swing.JRadioButton getJRadioButton(WindowComponent itemEnum)
          Fetches a JRadioButton radio button for the given item enumeration.
 javax.swing.JRadioButtonMenuItem getJRadioButtonMenuItem(WindowComponent itemEnum)
          Fetches a JRadioButtonMenuItem menu item for the given item enumeration.
 java.awt.MenuItem getMenuItem(WindowComponent itemEnum)
          Fetches a MenuItem menu item for the given item enumeration.
 java.awt.CheckboxMenuItem getRadioButtonMenuItem(WindowComponent itemEnum)
          Fetches a CheckboxMenuItem menu item for the given item enumeration.
 void setActionListener(java.awt.event.ActionListener actionListener)
          Setter for the main items action listener.
 void setSelected(WindowComponent itemEnum, boolean isSelected)
          Sets given radio button item selected status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MenuItemsBean

public MenuItemsBean()
Constructs a new menu items bean object.

Method Detail

setActionListener

public void setActionListener(java.awt.event.ActionListener actionListener)
Setter for the main items action listener. Note that when this action triggers, the event's source will be set to the corresponding item's WindowComponent enum.

Parameters:
actionListener - action listener to set.

getJRadioButtonMenuItem

public javax.swing.JRadioButtonMenuItem getJRadioButtonMenuItem(WindowComponent itemEnum)
Fetches a JRadioButtonMenuItem menu item for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
Returns:
radio button menu item that corresponds to the item enum.

getRadioButtonMenuItem

public java.awt.CheckboxMenuItem getRadioButtonMenuItem(WindowComponent itemEnum)
Fetches a CheckboxMenuItem menu item for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
Returns:
awt check box button menu item that corresponds to the item enum.

getJRadioButton

public javax.swing.JRadioButton getJRadioButton(WindowComponent itemEnum)
Fetches a JRadioButton radio button for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
Returns:
radio button that corresponds to the item enum.

getJButton

public javax.swing.JButton getJButton(WindowComponent itemEnum,
                                      javax.swing.JPanel pane)
Fetches a JButton object for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
pane - pass this object to add a shortcut to it (of present on the item's enum).
Returns:
button that corresponds to the item enum.

createJButtonForChoosePlayerDialog

public javax.swing.JButton createJButtonForChoosePlayerDialog(javax.swing.JPanel pane)
Creates a JButton for the choose player dialog. This is a special case because the choose player window is created and disposed every time (we don't hide it).

Parameters:
pane - panel object to add a shortcut to it (required).
Returns:
created button object.

getJMenuItem

public javax.swing.JMenuItem getJMenuItem(WindowComponent itemEnum)
Fetches a JMenuItem menu item for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
Returns:
menu item that corresponds to the item enum.

getMenuItem

public java.awt.MenuItem getMenuItem(WindowComponent itemEnum)
Fetches a MenuItem menu item for the given item enumeration. The item will be created if it does not exist.

Parameters:
itemEnum - item enumeration that represents the required item.
Returns:
menu item that corresponds to the item enum.

addListener

public void addListener(java.lang.Object listener,
                        WindowComponent... itemEnums)
Adds listener to provided items.

Parameters:
listener - action listener to add to the provided items.
itemEnums - item enumeration array.

setSelected

public void setSelected(WindowComponent itemEnum,
                        boolean isSelected)
Sets given radio button item selected status.

Parameters:
itemEnum - item enumeration that represents the required radio item.
isSelected - true if the item should be selected; false otherwise.


Copyright © 2008. All Rights Reserved.