Java Code Examples for com.google.gwt.user.client.ui.MenuItem#setStylePrimaryName()

The following examples show how to use com.google.gwt.user.client.ui.MenuItem#setStylePrimaryName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContextMenu.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a menu item to the context menu.
 *
 * @param text  caption of menu item
 * @param command   command to execute when menu item is chosen
 * @return  menu item
 */
public MenuItem addItem(String text, final Command command) {
  MenuItem menuItem = new MenuItem(text, new Command() {
    @Override
    public void execute() {
      hide();
      command.execute();
    }
  });
  menuItem.setStylePrimaryName("ode-ContextMenuItem");
  menuBar.addItem(menuItem);
  return menuItem;
}
 
Example 2
Source File: ContextMenu.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
/**
 * Adds a menu item to the context menu.
 *
 * @param text  caption of menu item
 * @param asHtml whether to treat text as html
 * @param command   command to execute when menu item is chosen
 * @return  menu item
 */
public MenuItem addItem(String text, boolean asHtml, final Command command) {
  MenuItem menuItem = new MenuItem(text, asHtml, new Command() {
    @Override
    public void execute() {
      hide();
      command.execute();
    }
  });
  menuItem.setStylePrimaryName("ode-ContextMenuItem");
  menuBar.addItem(menuItem);
  return menuItem;
}