Package com.biglybt.pif.ui.menus
Interface MenuItem
-
- All Known Subinterfaces:
TableContextMenuItem
- All Known Implementing Classes:
MenuItemImpl
,TableContextMenuItemImpl
public interface MenuItem
Menu item access for the UI.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HEADER_CONTENT
static java.lang.String
HEADER_CONTROL
static java.lang.String
HEADER_ORGANIZE
static java.lang.String
HEADER_OTHER
static java.lang.String
HEADER_SOCIAL
static int
STYLE_CHECK
check box style menu item - data must be of type Booleanstatic int
STYLE_MENU
menu containing submenu itemsstatic int
STYLE_PUSH
normal selection menu, no Data value requiredstatic int
STYLE_RADIO
radio style - data must be Booleanstatic int
STYLE_SEPARATOR
separator line
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addFillListener(MenuItemFillListener listener)
Adds a listener to be notified when the menu item is about to be displayed.void
addListener(MenuItemListener l)
Adds a selection listener for this menu item.void
addMultiListener(MenuItemListener l)
Adds a selection listener for this menu item.java.lang.Object
getData()
Get the current data value associated with the menu: Boolean for CHECK stylejava.lang.String
getDisposeWithUIDetach()
Graphic
getGraphic()
get the menu's graphicjava.lang.String
getHeaderCategory()
The header that a top menu item will be placed under for the fancy menuMenuItem
getItem(java.lang.String key_id)
Get the child item with the given resource key.MenuItem[]
getItems()
Get all child items currently associated with this MenuItem.java.lang.String
getMenuID()
Retrieve the menu ID that the menu item belongs toint
getMinUserMode()
MenuItem
getParent()
Retrieve the parent MenuItem.java.lang.String
getResourceKey()
Retrieve the resource key ("name") of this menu itemint
getStyle()
Get the type of the menu itemjava.lang.String
getText()
Gets the text to display for this menu item.boolean
isEnabled()
Whether or not this item is enabled or notboolean
isSelected()
Returns whether the menu item is selected or not.boolean
isVisible()
Returns whether the menu item is visible or not.void
remove()
Removes the menu item.void
removeAllChildItems()
Removes all child menu items from this menu (if any exist).void
removeFillListener(MenuItemFillListener listener)
void
removeListener(MenuItemListener l)
Removes a selection listener from this menu item.void
removeMultiListener(MenuItemListener l)
Removes a selection listener from this menu item.void
setData(java.lang.Object data)
Set the current data value associated with the menu: Boolean for CHECK stylevoid
setDisposeWithUIDetach(java.lang.String uiType)
Auto-dispose of MenuItem when a specific UI is detached (See {@link com.biglybt.pif.ui.UIInstance#UIT_*} for typesvoid
setEnabled(boolean enabled)
Set the enabled status of the menu itemvoid
setGraphic(Graphic graphic)
set the menu item's iconvoid
setHeaderCategory(java.lang.String header)
Sets which header to place the menu item under for top level fancy menuvoid
setMinUserMode(int minUserMode)
void
setStyle(int style)
Set the style of the menu item (see STYLE_ constants)void
setSubmenuBuilder(MenuBuilder builder)
ForSTYLE_MENU
, builder is called when user wants to see the submenu items.void
setText(java.lang.String text)
Sets the text to display for this menu item.void
setVisible(boolean visible)
Sets whether the menu item is visible or not.
-
-
-
Field Detail
-
STYLE_PUSH
static final int STYLE_PUSH
normal selection menu, no Data value required- See Also:
- Constant Field Values
-
STYLE_CHECK
static final int STYLE_CHECK
check box style menu item - data must be of type Boolean- See Also:
- Constant Field Values
-
STYLE_RADIO
static final int STYLE_RADIO
radio style - data must be Boolean- See Also:
- Constant Field Values
-
STYLE_SEPARATOR
static final int STYLE_SEPARATOR
separator line- See Also:
- Constant Field Values
-
STYLE_MENU
static final int STYLE_MENU
menu containing submenu items- See Also:
- Constant Field Values
-
HEADER_CONTROL
static final java.lang.String HEADER_CONTROL
- See Also:
- Constant Field Values
-
HEADER_SOCIAL
static final java.lang.String HEADER_SOCIAL
- See Also:
- Constant Field Values
-
HEADER_ORGANIZE
static final java.lang.String HEADER_ORGANIZE
- See Also:
- Constant Field Values
-
HEADER_OTHER
static final java.lang.String HEADER_OTHER
- See Also:
- Constant Field Values
-
HEADER_CONTENT
static final java.lang.String HEADER_CONTENT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getResourceKey
java.lang.String getResourceKey()
Retrieve the resource key ("name") of this menu item- Returns:
- resource key for this menu
-
getStyle
int getStyle()
Get the type of the menu item
-
setStyle
void setStyle(int style)
Set the style of the menu item (see STYLE_ constants)- Parameters:
style
-
-
getData
java.lang.Object getData()
Get the current data value associated with the menu: Boolean for CHECK style- Returns:
-
setData
void setData(java.lang.Object data)
Set the current data value associated with the menu: Boolean for CHECK style- Parameters:
data
-
-
isEnabled
boolean isEnabled()
Whether or not this item is enabled or not- Returns:
-
setEnabled
void setEnabled(boolean enabled)
Set the enabled status of the menu item- Parameters:
enabled
-
-
setGraphic
void setGraphic(Graphic graphic)
set the menu item's icon- Parameters:
graphic
-
-
getGraphic
Graphic getGraphic()
get the menu's graphic- Returns:
-
addFillListener
void addFillListener(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).- Parameters:
listener
-
-
removeFillListener
void removeFillListener(MenuItemFillListener listener)
-
setSubmenuBuilder
void setSubmenuBuilder(MenuBuilder builder)
ForSTYLE_MENU
, builder is called when user wants to see the submenu items. Setting a builder will force clear all submenu items.- Since:
- 5.5.0.1
-
addMultiListener
void addMultiListener(MenuItemListener l)
Adds a selection listener for this menu item. This differs fromaddListener(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.- Parameters:
l
- listener to be notified when user has selected the menu item.- Since:
- 3.0.2
-
removeMultiListener
void removeMultiListener(MenuItemListener l)
Removes a selection listener from this menu item. You only use this method to remove a listener added viaaddMultiListener(MenuItemListener)
.- Parameters:
l
- listener to remove- Since:
- 3.0.2
-
addListener
void addListener(MenuItemListener l)
Adds a selection listener for this menu item.- Parameters:
l
- listener to be notified when user has selected the menu item.
-
removeListener
void removeListener(MenuItemListener l)
Removes a selection listener from this menu item.- Parameters:
l
- listener to remove
-
getParent
MenuItem getParent()
Retrieve the parent MenuItem.- Returns:
- parent menu object, or null if no parent
-
getItems
MenuItem[] getItems()
Get all child items currently associated with this MenuItem.- Returns:
- An array of items (if this object has the menu style associated) or null otherwise.
-
getItem
MenuItem getItem(java.lang.String key_id)
Get the child item with the given resource key.- Returns:
- The child MenuItem object which has the resource key specified, or null otherwise.
-
getText
java.lang.String getText()
Gets the text to display for this menu item.
-
setText
void setText(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.
-
getMenuID
java.lang.String getMenuID()
Retrieve the menu ID that the menu item belongs to- Returns:
MenuManager
.MENU_ constant.- Since:
- 3.0.0.7
-
remove
void remove()
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
-
removeAllChildItems
void removeAllChildItems()
Removes all child menu items from this menu (if any exist).- Since:
- 3.0.0.7
-
setVisible
void setVisible(boolean visible)
Sets whether the menu item is visible or not.- Since:
- 3.0.2.0
-
isVisible
boolean isVisible()
Returns whether the menu item is visible or not.- Since:
- 3.0.2.0
-
isSelected
boolean isSelected()
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
-
setHeaderCategory
void setHeaderCategory(java.lang.String header)
Sets which header to place the menu item under for top level fancy menu
-
getHeaderCategory
java.lang.String getHeaderCategory()
The header that a top menu item will be placed under for the fancy menu
-
getMinUserMode
int getMinUserMode()
-
setMinUserMode
void setMinUserMode(int minUserMode)
-
setDisposeWithUIDetach
void setDisposeWithUIDetach(java.lang.String uiType)
Auto-dispose of MenuItem when a specific UI is detached (See {@link com.biglybt.pif.ui.UIInstance#UIT_*} for types- Parameters:
uiType
-
-
getDisposeWithUIDetach
java.lang.String getDisposeWithUIDetach()
-
-