Example usage for com.google.gwt.user.client.ui MenuBar selectItem

List of usage examples for com.google.gwt.user.client.ui MenuBar selectItem

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui MenuBar selectItem.

Prototype

public void selectItem(MenuItem item) 

Source Link

Document

Select the given MenuItem, which must be a direct child of this MenuBar.

Usage

From source file:com.colinalworth.xmlview.client.XmlTreeViewModel.java

License:Apache License

/**
 * /* ww  w.  jav  a 2  s  .c om*/
 * @param validator
 */
public XmlTreeViewModel(XmlValidator validator) {
    final MenuBar subMenu = new MenuBar(true);

    subMenu.addItem(i18n.delete(), new DeleteElementCommand());
    subMenu.addSeparator();
    subMenu.addItem(i18n.addElement(), new NewElementCommand());
    subMenu.addItem(i18n.addAttr(), new NewAttrCommand());
    subMenu.addItem(i18n.addText(), new NewTextCommand());
    contextMenu = new XmlEditContextMenu();

    contextMenu.setWidget(subMenu);
    contextMenu.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {
            subMenu.selectItem(null);
        }
    });

    nodeCell = new ElementCell(validator, contextMenu);

    refreshAccess = new HashMap<Node, ValueUpdater<Node>>();
}