com.itmill.toolkit.terminal.gwt.client.ui
Class IMenuBar

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.PopupListener, Paintable

public class IMenuBar
extends com.google.gwt.user.client.ui.Widget
implements Paintable, com.google.gwt.user.client.ui.PopupListener


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
static String CLASSNAME
          Set the CSS class name to allow styling.
protected  ApplicationConnection client
           
protected  boolean collapseItems
           
protected  com.google.gwt.user.client.Element containerElement
           
protected static com.google.gwt.user.client.Command emptyCommand
           
protected  IMenuBar hostReference
           
protected  ArrayList<com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem> items
           
protected  com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem moreItem
           
protected  IMenuBar parentMenu
           
protected  IToolkitOverlay popup
           
protected  com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem selected
           
protected  boolean subMenu
          Widget fields
protected  String submenuIcon
           
protected  String uidlId
          For server connections
protected  IMenuBar visibleChildMenu
           
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
IMenuBar()
           
IMenuBar(boolean subMenu)
           
 
Method Summary
 void addItem(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          Add a new item to this menu
 com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem addItem(String html, com.google.gwt.user.client.Command cmd)
          Add a new item to this menu
 void clearItems()
          Remove all the items in this menu
 com.google.gwt.user.client.Element getContainingElement()
          Returns the containing element of the menu
 List<com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem> getItems()
          Returns a list of items in this menu
 com.google.gwt.user.client.Element getNewChildElement()
          Returns a new child element to add an item to
 IMenuBar getParentMenu()
          Returns the parent menu of this menu, or null if this is the top-level menu
 com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem getSelected()
          Returns the currently selected item of this menu, or null if nothing is selected
 void hideChildMenu(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          Hides the submenu of an item
 void hideChildren()
          Recursively hide all child menus
 void hideParents()
          Recursively hide all parent menus
 void itemClick(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          When an item is clicked
 void itemOut(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          When the mouse is moved away from an item
 void itemOver(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          When the user hovers the mouse over the item
 void onBrowserEvent(com.google.gwt.user.client.Event e)
           
 void onMenuClick(int clickedItemId)
          This is called by the items in the menu and it communicates the information to the server
 void onPopupClosed(com.google.gwt.user.client.ui.PopupPanel sender, boolean autoClosed)
          Listener method, fired when this menu is closed
 void onShow()
          When the menu is shown.
 void removeItem(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          Remove the given item from this menu
 void setParentMenu(IMenuBar parent)
          Set the parent menu of this menu
 void setSelected(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          Set the currently selected item of this menu
 void showChildMenu(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
          Shows the child menu of an item.
 void updateFromUIDL(UIDL uidl, ApplicationConnection client)
          This method must be implemented to update the client-side component from UIDL data received from server.
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onDetach, onLoad, onUnload, removeFromParent
 
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, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setWidth, setVisible, setVisible, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASSNAME

public static final String CLASSNAME
Set the CSS class name to allow styling.

See Also:
Constant Field Values

uidlId

protected String uidlId
For server connections


client

protected ApplicationConnection client

hostReference

protected final IMenuBar hostReference

submenuIcon

protected String submenuIcon

collapseItems

protected boolean collapseItems

moreItem

protected com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem moreItem

emptyCommand

protected static final com.google.gwt.user.client.Command emptyCommand

subMenu

protected boolean subMenu
Widget fields


items

protected ArrayList<com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem> items

containerElement

protected com.google.gwt.user.client.Element containerElement

popup

protected IToolkitOverlay popup

visibleChildMenu

protected IMenuBar visibleChildMenu

parentMenu

protected IMenuBar parentMenu

selected

protected com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem selected
Constructor Detail

IMenuBar

public IMenuBar()

IMenuBar

public IMenuBar(boolean subMenu)
Method Detail

updateFromUIDL

public void updateFromUIDL(UIDL uidl,
                           ApplicationConnection client)
This method must be implemented to update the client-side component from UIDL data received from server. This method is called when the page is loaded for the first time, and every time UI changes in the component are received from the server.

Specified by:
updateFromUIDL in interface Paintable

onMenuClick

public void onMenuClick(int clickedItemId)
This is called by the items in the menu and it communicates the information to the server

Parameters:
clickedItemId - id of the item that was clicked

getItems

public List<com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem> getItems()
Returns a list of items in this menu


clearItems

public void clearItems()
Remove all the items in this menu


getContainingElement

public com.google.gwt.user.client.Element getContainingElement()
Returns the containing element of the menu

Returns:

getNewChildElement

public com.google.gwt.user.client.Element getNewChildElement()
Returns a new child element to add an item to

Returns:

addItem

public com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem addItem(String html,
                                                                                 com.google.gwt.user.client.Command cmd)
Add a new item to this menu

Parameters:
html - items text
cmd - items command
Returns:
the item created

addItem

public void addItem(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
Add a new item to this menu

Parameters:
item -

removeItem

public void removeItem(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
Remove the given item from this menu

Parameters:
item -

onBrowserEvent

public void onBrowserEvent(com.google.gwt.user.client.Event e)
Specified by:
onBrowserEvent in interface com.google.gwt.user.client.EventListener
Overrides:
onBrowserEvent in class com.google.gwt.user.client.ui.Widget

itemClick

public void itemClick(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
When an item is clicked

Parameters:
item -

itemOver

public void itemOver(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
When the user hovers the mouse over the item

Parameters:
item -

itemOut

public void itemOut(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
When the mouse is moved away from an item

Parameters:
item -

showChildMenu

public void showChildMenu(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
Shows the child menu of an item. The caller must ensure that the item has a submenu.

Parameters:
item -

hideChildMenu

public void hideChildMenu(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
Hides the submenu of an item

Parameters:
item -

onShow

public void onShow()
When the menu is shown.


hideChildren

public void hideChildren()
Recursively hide all child menus


hideParents

public void hideParents()
Recursively hide all parent menus


getParentMenu

public IMenuBar getParentMenu()
Returns the parent menu of this menu, or null if this is the top-level menu

Returns:

setParentMenu

public void setParentMenu(IMenuBar parent)
Set the parent menu of this menu

Parameters:
parent -

getSelected

public com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem getSelected()
Returns the currently selected item of this menu, or null if nothing is selected

Returns:

setSelected

public void setSelected(com.itmill.toolkit.terminal.gwt.client.ui.IMenuBar.CustomMenuItem item)
Set the currently selected item of this menu

Parameters:
item -

onPopupClosed

public void onPopupClosed(com.google.gwt.user.client.ui.PopupPanel sender,
                          boolean autoClosed)
Listener method, fired when this menu is closed

Specified by:
onPopupClosed in interface com.google.gwt.user.client.ui.PopupListener


Copyright © 2000-2009 IT Mill Ltd. All Rights Reserved.