FileDocCategorySizeDatePackage
MenuItem.javaAPI DocAzureus 3.0.3.46516Thu Sep 13 09:25:16 BST 2007org.gudy.azureus2.plugins.ui.menus

MenuItem

public interface MenuItem
Menu item access for the UI.
author
parg (Original ContextMenuItem code)
author
TuxPaper (Generic-izing, commenting)

Fields Summary
public static final int
STYLE_PUSH
normal selection menu, no Data value required
public static final int
STYLE_CHECK
check box style menu item - data must be of type Boolean
public static final int
STYLE_RADIO
radio style - data must be Boolean
public static final int
STYLE_SEPARATOR
separator line
public static final int
STYLE_MENU
menu containing submenu items
Constructors Summary
Methods Summary
public voidaddFillListener(MenuItemFillListener listener)
Adds a listener to be notified when the menu item is about to be displayed. The "context" object provided is always going to be either be null (if there is no context) or an array of objects (such as an array of TableRows or an array of Download objects).

param
listener

public voidaddListener(MenuItemListener l)
Adds a selection listener for this menu item.

param
l listener to be notified when user has selected the menu item.

public voidaddMultiListener(MenuItemListener l)
Adds a selection listener for this menu item. This differs from {@link #addListener(MenuItemListener)}, in that the target object which will be passed to the listener will be an array of objects, rather than just a single object.

param
l listener to be notified when user has selected the menu item.
since
3.0.2

public java.lang.ObjectgetData()
Get the current data value associated with the menu: Boolean for CHECK style

return

public org.gudy.azureus2.plugins.ui.GraphicgetGraphic()
get the menu's graphic

return

public org.gudy.azureus2.plugins.ui.menus.MenuItemgetItem(java.lang.String key_id)
Get the child item with the given resource key.

return
The child MenuItem object which has the resource key specified, or null otherwise.

public org.gudy.azureus2.plugins.ui.menus.MenuItem[]getItems()
Get all child items currently associated with this MenuItem.

return
An array of items (if this object has the menu style associated) or null otherwise.

public java.lang.StringgetMenuID()
Retrieve the menu ID that the menu item belongs to

return
{@link MenuManager}.MENU_ constant.
since
3.0.0.7

public org.gudy.azureus2.plugins.ui.menus.MenuItemgetParent()
Retrieve the parent MenuItem.

return
parent menu object, or null if no parent

public java.lang.StringgetResourceKey()
Retrieve the resource key ("name") of this menu item

return
resource key for this menu

public intgetStyle()
Get the type of the menu item

public java.lang.StringgetText()
Gets the text to display for this menu item.

public booleanisEnabled()
Whether or not this item is enabled or not

return

public booleanisSelected()
Returns whether the menu item is selected or not. This method should only be called if the menu is of type STYLE_RADIO or type STYLE_CHECK and if the menu item has already had a selected or deselected state assigned to it.

since
3.0.2.4

public booleanisVisible()
Returns whether the menu item is visible or not.

since
3.0.2.0

public voidremove()
Removes the menu item. Calling this will remove the item from the menus, as well as removing all listeners and removing all child menu items (if any exist). The behaviour of this object is undefined after this method has been called. If you need to interact with this object when you are about to destroy it, you should do it before you call the remove method.

since
3.0.0.7

public voidremoveAllChildItems()
Removes all child menu items from this menu (if any exist).

since
3.0.0.7

public voidremoveFillListener(MenuItemFillListener listener)

public voidremoveListener(MenuItemListener l)
Removes a selection listener from this menu item.

param
l listener to remove

public voidremoveMultiListener(MenuItemListener l)
Removes a selection listener from this menu item. You only use this method to remove a listener added via {@link #addMultiListener(MenuItemListener)}.

param
l listener to remove
since
3.0.2

public voidsetData(java.lang.Object data)
Set the current data value associated with the menu: Boolean for CHECK style

param
data

public voidsetEnabled(boolean enabled)
Set the enabled status of the menu item

param
enabled

public voidsetGraphic(org.gudy.azureus2.plugins.ui.Graphic graphic)
set the menu item's icon

param
graphic

public voidsetStyle(int style)
Set the style of the menu item (see STYLE_ constants)

param
style

public voidsetText(java.lang.String text)
Sets the text to display for this menu item. You can also pass null to revert back to the default behaviour.

public voidsetVisible(boolean visible)
Sets whether the menu item is visible or not.

since
3.0.2.0