org.exoplatform.gwtframework.ui.client.component
Class PopupMenuButton

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by org.exoplatform.gwtframework.ui.client.component.PopupMenuButton
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, CloseMenuHandler, ItemSelectedHandler
Direct Known Subclasses:
PopupMenuButtonControl

public class PopupMenuButton
extends com.google.gwt.user.client.ui.Composite
implements ItemSelectedHandler, CloseMenuHandler

Created by The eXo Platform SAS .

Version:
$
Author:
Vitaliy Gulyy

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
PopupMenuButton(java.lang.String icon, java.lang.String disabledIcon)
          Create Popup Menu Button with specified icons for enabled and disabled states.
 
Method Summary
 MenuItem addItem(java.lang.String title)
          Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.
 MenuItem addItem(java.lang.String title, com.google.gwt.user.client.Command command)
          Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.
 MenuItem addItem(java.lang.String icon, java.lang.String title)
          Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.
 MenuItem addItem(java.lang.String icon, java.lang.String title, com.google.gwt.user.client.Command command)
          Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.
protected  void closePopupMenu()
          Closes Popup Menu ( if opened ) and sets style of this Popup Menu Button to default.
 java.lang.String getDisabledIcon()
          Get icon which is used by this button for disabled state.
 java.lang.String getIcon()
          Get icon which is used by this button for enabled state.
 java.util.List<MenuItem> getMenuItems()
          Get list of Menu Items.
 boolean isEnabled()
          Get is this button enabled.
 void onCloseMenu()
          Close menu handler.
 void onMenuItemSelected(MenuItem menuItem)
          Menu Item selected handler.
 void openPopupMenu()
          Opens Popup Menu.
 void setDisabledIcon(java.lang.String disabledIcon)
          Set icon for disabled state.
 void setEnabled(boolean enabled)
          Set is enabled.
 void setIcon(java.lang.String icon)
          Set icon for enabled state.
 void setTitle(java.lang.String title)
          Sets the title associated with this button.
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, performDetachedInitialization, render, render, resolvePotentialElement, setWidget, wrapElement
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PopupMenuButton

public PopupMenuButton(java.lang.String icon,
                       java.lang.String disabledIcon)
Create Popup Menu Button with specified icons for enabled and disabled states.

Parameters:
icon - icon for enabled state
disabledIcon - icon for disabled state
Method Detail

addItem

public MenuItem addItem(java.lang.String title)
Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.

Parameters:
title - title of new item
Returns:
new instance of PopupMenuItem

addItem

public MenuItem addItem(java.lang.String title,
                        com.google.gwt.user.client.Command command)
Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.

Parameters:
title - title of new item
command - command which will be executed when Popup Menu Item was pressed.
Returns:
new instance of PopupMenuItem

addItem

public MenuItem addItem(java.lang.String icon,
                        java.lang.String title)
Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.

Parameters:
icon - icon
title - title of new item
Returns:
new instance of PopupMenuItem

addItem

public MenuItem addItem(java.lang.String icon,
                        java.lang.String title,
                        com.google.gwt.user.client.Command command)
Adds new item to the Popup Menu which will be displayed when this Popup Button was clicked.

Parameters:
icon - icon
title - title of new item
command - command which will be executed when Popup Menu Item was pressed.
Returns:
new instance of PopupMenuItem

closePopupMenu

protected void closePopupMenu()
Closes Popup Menu ( if opened ) and sets style of this Popup Menu Button to default.


getDisabledIcon

public java.lang.String getDisabledIcon()
Get icon which is used by this button for disabled state.

Returns:
icon for disabled state

getIcon

public java.lang.String getIcon()
Get icon which is used by this button for enabled state.

Returns:
icon for enabled state

getMenuItems

public java.util.List<MenuItem> getMenuItems()
Get list of Menu Items.

Returns:
list of menu items

isEnabled

public boolean isEnabled()
Get is this button enabled.

Returns:
is enabled

onCloseMenu

public void onCloseMenu()
Close menu handler.

Specified by:
onCloseMenu in interface CloseMenuHandler
See Also:
CloseMenuHandler.onCloseMenu()

onMenuItemSelected

public void onMenuItemSelected(MenuItem menuItem)
Menu Item selected handler.

Specified by:
onMenuItemSelected in interface ItemSelectedHandler
Parameters:
menuItem - selected MenuItem
See Also:
ItemSelectedHandler.onMenuItemSelected(org.exoplatform.gwtframework.ui.client.menu.MenuItem)

openPopupMenu

public void openPopupMenu()
Opens Popup Menu.


setDisabledIcon

public void setDisabledIcon(java.lang.String disabledIcon)
Set icon for disabled state.

Parameters:
disabledIcon - new icon for disabled state

setEnabled

public void setEnabled(boolean enabled)
Set is enabled.

Parameters:
enabled - is enabled

setIcon

public void setIcon(java.lang.String icon)
Set icon for enabled state.

Parameters:
icon - icon for enabled state.

setTitle

public void setTitle(java.lang.String title)
Sets the title associated with this button. The title is the 'tool-tip' displayed to users when they hover over the object.

Overrides:
setTitle in class com.google.gwt.user.client.ui.UIObject
Parameters:
title - the object's new title


Copyright © 2012 eXo Platform SAS. All Rights Reserved.