org.vaadin.peter.contextmenu
Class ContextMenu.ContextMenuItem

java.lang.Object
  extended by org.vaadin.peter.contextmenu.ContextMenu.ContextMenuItem
Enclosing class:
ContextMenu

public class ContextMenu.ContextMenuItem
extends Object

ContextMenuItem represents one clickable item in the context menu. Item may have sub items.

Author:
Peter Lehto / Vaadin Ltd

Constructor Summary
protected ContextMenu.ContextMenuItem(ContextMenuState.ContextMenuItemState itemState)
           
 
Method Summary
 ContextMenu.ContextMenuItem addItem(com.vaadin.server.Resource icon)
          Adds new item as this item's sub item with given icon
 ContextMenu.ContextMenuItem addItem(String caption)
          Adds new item as this item's sub item with given caption
 ContextMenu.ContextMenuItem addItem(String caption, com.vaadin.server.Resource icon)
          Adds new item as this item's sub item with given caption and icon
 void addItemClickListener(ContextMenu.ContextMenuItemClickListener clickListener)
          Adds context menu item click listener only to this item.
 boolean equals(Object other)
           
 Object getData()
           
 com.vaadin.server.Resource getIcon()
           
 int hashCode()
           
 boolean hasSeparator()
           
 boolean hasSubMenu()
           
 boolean isEnabled()
           
protected  void notifyClickListeners()
           
 void removeItemClickListener(ContextMenu.ContextMenuItemClickListener clickListener)
          Removes given click listener from this item.
 void setData(Object data)
          Associates given object with this menu item.
 void setEnabled(boolean enabled)
          Enables or disables this menu item
 void setIcon(com.vaadin.server.Resource icon)
          Sets given resource as icon of this menu item.
 void setSeparatorVisible(boolean separatorVisible)
          Sets or disables separator line under this item
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextMenu.ContextMenuItem

protected ContextMenu.ContextMenuItem(ContextMenuState.ContextMenuItemState itemState)
Method Detail

notifyClickListeners

protected void notifyClickListeners()

setData

public void setData(Object data)
Associates given object with this menu item. Given object can be whatever application specific if necessary.

Parameters:
data -

getData

public Object getData()
Returns:
Object associated with ContextMenuItem.

addItem

public ContextMenu.ContextMenuItem addItem(String caption)
Adds new item as this item's sub item with given caption

Parameters:
caption -
Returns:
reference to newly created item.

addItem

public ContextMenu.ContextMenuItem addItem(com.vaadin.server.Resource icon)
Adds new item as this item's sub item with given icon

Parameters:
icon -
Returns:
reference to newly added item

addItem

public ContextMenu.ContextMenuItem addItem(String caption,
                                           com.vaadin.server.Resource icon)
Adds new item as this item's sub item with given caption and icon

Parameters:
caption -
icon -
Returns:
reference to newly added item

setIcon

public void setIcon(com.vaadin.server.Resource icon)
Sets given resource as icon of this menu item.

Parameters:
icon -

getIcon

public com.vaadin.server.Resource getIcon()
Returns:
current icon

setSeparatorVisible

public void setSeparatorVisible(boolean separatorVisible)
Sets or disables separator line under this item

Parameters:
visible -

hasSeparator

public boolean hasSeparator()
Returns:
true if separator line is visible after this item, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Enables or disables this menu item

Parameters:
enabled -

isEnabled

public boolean isEnabled()
Returns:
true if menu item is enabled, false otherwise

hasSubMenu

public boolean hasSubMenu()
Returns:
true if this menu item has a sub menu

addItemClickListener

public void addItemClickListener(ContextMenu.ContextMenuItemClickListener clickListener)
Adds context menu item click listener only to this item. This listener will be invoked only when this item is clicked.

Parameters:
clickListener -

removeItemClickListener

public void removeItemClickListener(ContextMenu.ContextMenuItemClickListener clickListener)
Removes given click listener from this item. Removing listener affects only this context menu item.

Parameters:
clickListener -

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2014 Magnolia International Ltd.. All Rights Reserved.