org.browsecode.helpers.menus
Class MenuItemStub

java.lang.Object
  extended by org.browsecode.helpers.menus.MenuItemStub
All Implemented Interfaces:
MenuItem
Direct Known Subclasses:
MenuItemAppleOSX, MenuItemJMenuItem, MenuItemJSeparator, MenuStub

public abstract class MenuItemStub
extends java.lang.Object
implements MenuItem


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.browsecode.helpers.menus.MenuItem
MenuItem.MenuItemSelectedListener
 
Constructor Summary
MenuItemStub(MenuBarHelper menuBarHelper)
           
 
Method Summary
 void addActionListener(MenuItem.MenuItemSelectedListener actionListener)
           
protected  boolean canAListenerHandleAction()
          For use in setEnabledDisabled(), to test whether listeners will react to this.
protected  boolean fireAction(java.awt.event.ActionEvent e)
           
 java.awt.Font getFont()
          Gets the font.
protected  MenuBarHelper getMenuBarHelper()
           
 java.lang.String getTitle()
          Get the title that is used to get and refer to this item.
 boolean removeActionListener(MenuItem.MenuItemSelectedListener actionListener)
           
 boolean setBackgroundColor(java.awt.Color color)
          Sets the background color.
 boolean setFont(java.awt.Font font)
          Sets the font.
 boolean setForegroundColor(java.awt.Color color)
          Sets the foreground color.
 void setTitle(java.lang.String title)
           
 boolean setToolTipText(java.lang.String helpText)
          Set help text.
 void setVisibleTitle(java.lang.String title)
          Set the visible title of the menu item.
protected abstract  void setVisibleTitleAfterTranslation(java.lang.String title)
          Implement this to set the visible title.
 
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.MenuItem
getVisibleTitle, setEnabledDisabled
 

Constructor Detail

MenuItemStub

public MenuItemStub(MenuBarHelper menuBarHelper)
Method Detail

addActionListener

public void addActionListener(MenuItem.MenuItemSelectedListener actionListener)
Specified by:
addActionListener in interface MenuItem

getMenuBarHelper

protected MenuBarHelper getMenuBarHelper()

removeActionListener

public boolean removeActionListener(MenuItem.MenuItemSelectedListener actionListener)
Specified by:
removeActionListener in interface MenuItem

fireAction

protected boolean fireAction(java.awt.event.ActionEvent e)

getTitle

public java.lang.String getTitle()
Description copied from interface: MenuItem
Get the title that is used to get and refer to this item. It is language/locale independent and may not actually be the visible title of the item. This should generally not be changed over the course of the menu item's life.

Specified by:
getTitle in interface MenuItem
Returns:
Returns the title.

setTitle

public void setTitle(java.lang.String title)
Parameters:
title - The title to set.

setVisibleTitle

public void setVisibleTitle(java.lang.String title)
Description copied from interface: MenuItem
Set 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"

Specified by:
setVisibleTitle in interface MenuItem
Parameters:
title - The title to set.

setVisibleTitleAfterTranslation

protected abstract void setVisibleTitleAfterTranslation(java.lang.String title)
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.

Parameters:
title -

setForegroundColor

public boolean setForegroundColor(java.awt.Color color)
Description copied from interface: MenuItem
Sets the foreground color. Might not work.

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

setBackgroundColor

public boolean setBackgroundColor(java.awt.Color color)
Description copied from interface: MenuItem
Sets the background color. Might not work.

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

getFont

public java.awt.Font getFont()
Description copied from interface: MenuItem
Gets the font. Might not work.

Specified by:
getFont in interface MenuItem
Returns:
null if it failed, and the Font if it worked.

setFont

public boolean setFont(java.awt.Font font)
Description copied from interface: MenuItem
Sets the font. Might not work.

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

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
Returns:
whether it suceeded or not (if it's not enabled for this type of MenuItem, it returns false)

canAListenerHandleAction

protected boolean canAListenerHandleAction()
For use in setEnabledDisabled(), to test whether listeners will react to this.

Returns: