Class MenuItemImpl
java.lang.Object
com.biglybt.pifimpl.local.ui.menus.MenuItemImpl
- All Implemented Interfaces:
MenuItem
- Direct Known Subclasses:
TableContextMenuItemImpl
amc1: This class was largely derived from TableContextMenuImpl.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate MenuBuilder
private CopyOnWriteList
private Object
private String
private boolean
private CopyOnWriteList
private Graphic
private String
private CopyOnWriteList
<MenuItemListener> private CopyOnWriteList
private MenuContextImpl
private int
private MenuItemImpl
private PluginInterface
private String
private String
private int
private String
private boolean
Fields inherited from interface com.biglybt.pif.ui.menus.MenuItem
HEADER_CONTENT, HEADER_CONTROL, HEADER_ORGANIZE, HEADER_OTHER, HEADER_SOCIAL, STYLE_CHECK, STYLE_MENU, STYLE_PUSH, STYLE_RADIO, STYLE_SEPARATOR
-
Constructor Summary
ConstructorsConstructorDescriptionMenuItemImpl
(PluginInterface _pi, String menuID, String key) MenuItemImpl
(MenuItemImpl ti, String key) -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addChildMenuItem
(MenuItem child) void
addFillListener
(MenuItemFillListener listener) Adds a listener to be notified when the menu item is about to be displayed.void
Adds a selection listener for this menu item.void
Adds a selection listener for this menu item.getData()
Get the current data value associated with the menu: Boolean for CHECK styleget the menu's graphicThe header that a top menu item will be placed under for the fancy menuGet the child item with the given resource key.int
Returns the number of menu itemsMenuItem[]
getItems()
Get all child items currently associated with this MenuItem.Retrieve the menu ID that the menu item belongs toint
Retrieve the parent MenuItem.Retrieve the resource key ("name") of this menu itemint
getStyle()
Get the type of the menu itemgetText()
Gets the text to display for this menu item.void
invokeListenersMulti
(Object[] rows) protected void
invokeListenersOnList
(CopyOnWriteList<MenuItemListener> listeners_to_notify, Object target) private void
void
invokeMenuWillBeShownListeners
(Object target) boolean
Whether or not this item is enabled or notboolean
Returns whether the menu item is selected or not.boolean
Returns whether the menu item is visible or not.void
remove()
Removes the menu item.void
Removes all child menu items from this menu (if any exist).void
removeFillListener
(MenuItemFillListener listener) void
Removes a selection listener from this menu item.void
Removes a selection listener from this menu item.protected void
void
setContext
(MenuContextImpl context) void
Set the current data value associated with the menu: Boolean for CHECK stylevoid
setDisposeWithUIDetach
(String uiType) Auto-dispose of MenuItem when a specific UI is detached (Seeinvalid @link
{@link com.biglybt.pif.ui.UIInstance#UIT_*
void
setEnabled
(boolean _enabled) Set the enabled status of the menu itemvoid
setGraphic
(Graphic _graphic) set the menu item's iconvoid
setHeaderCategory
(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) ForMenuItem.STYLE_MENU
, builder is called when user wants to see the submenu items.void
Sets the text to display for this menu item.void
setVisible
(boolean visible) Sets whether the menu item is visible or not.
-
Field Details
-
pi
-
sMenuID
-
sName
-
style
private int style -
enabled
private boolean enabled -
data
-
graphic
-
listeners
-
m_listeners
-
fill_listeners
-
children
-
parent
-
display_text
-
visible
private boolean visible -
builder
-
headerCategory
-
minUserMode
private int minUserMode -
uiType
-
-
Constructor Details
-
MenuItemImpl
-
-
Method Details
-
getResourceKey
Description copied from interface:MenuItem
Retrieve the resource key ("name") of this menu item- Specified by:
getResourceKey
in interfaceMenuItem
- Returns:
- resource key for this menu
-
getMenuID
Description copied from interface:MenuItem
Retrieve the menu ID that the menu item belongs to- Specified by:
getMenuID
in interfaceMenuItem
- Returns:
MenuManager
.MENU_ constant.
-
getStyle
public int getStyle()Description copied from interface:MenuItem
Get the type of the menu item -
setStyle
public void setStyle(int _style) Description copied from interface:MenuItem
Set the style of the menu item (see STYLE_ constants) -
getData
Description copied from interface:MenuItem
Get the current data value associated with the menu: Boolean for CHECK style -
setData
Description copied from interface:MenuItem
Set the current data value associated with the menu: Boolean for CHECK style -
isEnabled
public boolean isEnabled()Description copied from interface:MenuItem
Whether or not this item is enabled or not -
setEnabled
public void setEnabled(boolean _enabled) Description copied from interface:MenuItem
Set the enabled status of the menu item- Specified by:
setEnabled
in interfaceMenuItem
- Parameters:
_enabled
-
-
setGraphic
Description copied from interface:MenuItem
set the menu item's icon- Specified by:
setGraphic
in interfaceMenuItem
- Parameters:
_graphic
-
-
getGraphic
Description copied from interface:MenuItem
get the menu's graphic- Specified by:
getGraphic
in interfaceMenuItem
- Returns:
-
invokeMenuWillBeShownListeners
-
invokeListenersMulti
-
invokeListenersSingle
-
getParent
Description copied from interface:MenuItem
Retrieve the parent MenuItem. -
getItems
Description copied from interface:MenuItem
Get all child items currently associated with this MenuItem. -
getItemCount
public int getItemCount()Description copied from interface:MenuItem
Returns the number of menu items- Specified by:
getItemCount
in interfaceMenuItem
-
getItem
Description copied from interface:MenuItem
Get the child item with the given resource key. -
getText
Description copied from interface:MenuItem
Gets the text to display for this menu item. -
setText
Description copied from interface:MenuItem
Sets the text to display for this menu item. You can also pass null to revert back to the default behaviour. -
invokeListenersOnList
protected void invokeListenersOnList(CopyOnWriteList<MenuItemListener> listeners_to_notify, Object target) -
remove
public void remove()Description copied from interface:MenuItem
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. -
removeSelf
protected void removeSelf() -
removeAllChildItems
public void removeAllChildItems()Description copied from interface:MenuItem
Removes all child menu items from this menu (if any exist).- Specified by:
removeAllChildItems
in interfaceMenuItem
-
isVisible
public boolean isVisible()Description copied from interface:MenuItem
Returns whether the menu item is visible or not. -
setVisible
public void setVisible(boolean visible) Description copied from interface:MenuItem
Sets whether the menu item is visible or not.- Specified by:
setVisible
in interfaceMenuItem
-
isSelected
public boolean isSelected()Description copied from interface:MenuItem
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.- Specified by:
isSelected
in interfaceMenuItem
-
setHeaderCategory
Description copied from interface:MenuItem
Sets which header to place the menu item under for top level fancy menu- Specified by:
setHeaderCategory
in interfaceMenuItem
-
getHeaderCategory
Description copied from interface:MenuItem
The header that a top menu item will be placed under for the fancy menu- Specified by:
getHeaderCategory
in interfaceMenuItem
-
setMinUserMode
public void setMinUserMode(int minUserMode) - Specified by:
setMinUserMode
in interfaceMenuItem
-
setDisposeWithUIDetach
Description copied from interface:MenuItem
Auto-dispose of MenuItem when a specific UI is detached (Seeinvalid @link
{@link com.biglybt.pif.ui.UIInstance#UIT_*
- Specified by:
setDisposeWithUIDetach
in interfaceMenuItem
- Parameters:
uiType
-
-
getDisposeWithUIDetach
- Specified by:
getDisposeWithUIDetach
in interfaceMenuItem
-
getMinUserMode
public int getMinUserMode()- Specified by:
getMinUserMode
in interfaceMenuItem
-