org.browsecode.helpers.menus
Class MenuJMenu

java.lang.Object
  extended by org.browsecode.helpers.menus.MenuItemStub
      extended by org.browsecode.helpers.menus.MenuStub
          extended by org.browsecode.helpers.menus.MenuJMenu
All Implemented Interfaces:
Menu, MenuItem

public class MenuJMenu
extends MenuStub


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.browsecode.helpers.menus.MenuItem
MenuItem.MenuItemSelectedListener
 
Field Summary
 
Fields inherited from class org.browsecode.helpers.menus.MenuStub
menuItems, order
 
Constructor Summary
MenuJMenu(MenuBarHelper menuBarHelper, java.lang.String title)
           
 
Method Summary
 void addSeparator()
          Since it's unclear whether or not an item has actually been added and where, this method should check to see whether the last item was a separator, and only add one if there was not one already.
 java.lang.String getVisibleTitle()
          Get the visible title of the menu item.
protected  void insertItem(javax.swing.JMenuItem menuItem, int insertIndex)
           
protected  CheckboxMenuItem makeNewCheckboxMenuItem(java.lang.String title, javax.swing.Icon icon, javax.swing.KeyStroke keyStroke)
           
protected  Menu makeNewMenu(java.lang.String title)
           
protected  MenuItem makeNewMenuItem(java.lang.String title, javax.swing.Icon icon, javax.swing.KeyStroke keyStroke)
           
 boolean setEnabledDisabled()
          If you have enabled or disabled this menu item, call this.
 boolean setToolTipText(java.lang.String helpText)
          Set help text.
protected  void setVisibleTitleAfterTranslation(java.lang.String title)
          Implement this to set the visible title.
 
Methods inherited from class org.browsecode.helpers.menus.MenuStub
getCheckboxMenuItem, getCheckboxMenuItem, getInsertIndex, getMenu, getMenuItem, getMenuItem, getMenuItem, getMenuItem, getOrder, hasCheckboxMenuItem, hasMenuItem, setItemsOrder
 
Methods inherited from class org.browsecode.helpers.menus.MenuItemStub
addActionListener, canAListenerHandleAction, fireAction, getFont, getMenuBarHelper, getTitle, removeActionListener, setBackgroundColor, setFont, setForegroundColor, setTitle, setVisibleTitle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.browsecode.helpers.menus.Menu
getTitle
 
Methods inherited from interface org.browsecode.helpers.menus.MenuItem
addActionListener, getFont, removeActionListener, setBackgroundColor, setFont, setForegroundColor, setVisibleTitle
 

Constructor Detail

MenuJMenu

public MenuJMenu(MenuBarHelper menuBarHelper,
                 java.lang.String title)
Method Detail

makeNewMenuItem

protected MenuItem makeNewMenuItem(java.lang.String title,
                                   javax.swing.Icon icon,
                                   javax.swing.KeyStroke keyStroke)
Specified by:
makeNewMenuItem in class MenuStub

makeNewCheckboxMenuItem

protected CheckboxMenuItem makeNewCheckboxMenuItem(java.lang.String title,
                                                   javax.swing.Icon icon,
                                                   javax.swing.KeyStroke keyStroke)
Specified by:
makeNewCheckboxMenuItem in class MenuStub

makeNewMenu

protected Menu makeNewMenu(java.lang.String title)
Specified by:
makeNewMenu in class MenuStub

insertItem

protected void insertItem(javax.swing.JMenuItem menuItem,
                          int insertIndex)

addSeparator

public void addSeparator()
Description copied from interface: Menu
Since it's unclear whether or not an item has actually been added and where, this method should check to see whether the last item was a separator, and only add one if there was not one already.


setVisibleTitleAfterTranslation

protected void setVisibleTitleAfterTranslation(java.lang.String title)
Description copied from class: MenuItemStub
Implement this to set the visible title. Don't override setVisibleTitle, override this one -- so that you will be setting the translated text for the menu.

Specified by:
setVisibleTitleAfterTranslation in class MenuItemStub

getVisibleTitle

public java.lang.String getVisibleTitle()
Description copied from interface: MenuItem
Get the visible title of the menu item. This is the current title and is language dependent. For example, if you want the "Undo" menu item to change from "Undo" to "Undo text insert", set it here. This will make the MenuItem's title stay as "Undo" for reference, but visibly it will show "Undo text insert"

Returns:

setToolTipText

public boolean setToolTipText(java.lang.String helpText)
Description copied from interface: MenuItem
Set help text. Might not work.

Specified by:
setToolTipText in interface MenuItem
Overrides:
setToolTipText in class MenuItemStub
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

setEnabledDisabled

public boolean setEnabledDisabled()
Description copied from interface: MenuItem
If you have enabled or disabled this menu item, call this. Note that you do not need to pass the state in, because it will check in MenuItemSelectedListener.canHandleActionNow() -- make sure you have added one and that it's returning the correct thing.

Returns:
whether or not it can be disabled and re-enabled. In general, this returns true. For some items that can't be disabled, it returns false.