Package com.google.gwt.user.client.ui

Examples of com.google.gwt.user.client.ui.MenuBar


    boolean someItemAdded = false;
   
    IActionProvider[] actions = menu.getActionProviders();
    for(int i = 0; i < actions.length; i++) {
      if (actions[i] instanceof IMenu) {
        MenuBar subMenu = new MenuBar(true);
       
        if (this.buildMenu(subMenu, (IMenu)actions[i]))
        {
          parentMenu.addItem(actions[i].getActionCaption(), subMenu);
          someItemAdded = true;
View Full Code Here


        curPhrase = (curPhrase + 1) % phrases.length;
      }
    };

    // Create a menu bar
    MenuBar menu = new MenuBar();
    menu.setAutoOpen(false);
    menu.setWidth("500px");
    menu.setAnimationEnabled(true);

    // Create a sub menu of recent documents
    MenuBar recentDocsMenu = new MenuBar(true);
    String[] recentDocs = new String[]{"Fishing in the desert.txt",
        "How to tame a wild parrot", "Idiots Guide to Emu Farms"};
    for (int i = 0; i < recentDocs.length; i++) {
      recentDocsMenu.addItem(recentDocs[i], menuCommand);
    }

    // Create the file menu
    MenuBar fileMenu = new MenuBar(true);
    fileMenu.setAnimationEnabled(true);
    menu.addItem(new MenuItem("File", fileMenu));
    String[] fileOptions = new String[]{"New", "Open", "Close", "Recents",
        "Exit"};

    for (int i = 0; i < fileOptions.length; i++) {
      if (i == 3) {
        fileMenu.addSeparator();
        fileMenu.addItem(fileOptions[i], recentDocsMenu);
        fileMenu.addSeparator();
      } else {
        fileMenu.addItem(fileOptions[i], menuCommand);
      }
    }

    // Create the edit menu
    MenuBar editMenu = new MenuBar(true);
    menu.addItem(new MenuItem("Edit", editMenu));
    String[] editOptions = new String[]{"Undo", "Redo", "Copy", "Cut",
        "Paste"};

    for (int i = 0; i < editOptions.length; i++) {
      editMenu.addItem(editOptions[i], menuCommand);
    }

    // Create the GWT menu
    MenuBar gwtMenu = new MenuBar(true);
    menu.addItem(new MenuItem("GWT", true, gwtMenu));
    String[] gwtOptions = new String[]{"Download", "Examples", "Source code",
        "GWT wit' the program"};

    for (int i = 0; i < gwtOptions.length; i++) {
      gwtMenu.addItem(gwtOptions[i], menuCommand);
    }

    // Create the help menu
    MenuBar helpMenu = new MenuBar(true);
    menu.addSeparator();
    menu.addItem(new MenuItem("Help", helpMenu));
    String[] helpOptions = new String[]{"Contents", "Fortune cookies",
        "About GWT"};

    for (int i = 0; i < helpOptions.length; i++) {
      helpMenu.addItem(helpOptions[i], menuCommand);
    }

    // Return the menu
    menu.ensureDebugId("cwMenuBar");
    return menu;
View Full Code Here

   
    Widget ww = _getWidget(row, 0);
    int left = ww.getAbsoluteLeft();
    int top = ww.getAbsoluteTop();

      MenuBar menu = new MenuBar(true);
      final PopupPanel menuPopup = new PopupPanel(true);
     
      if ( row >= FIRST_REGULAR_ROW ) {
        menu.addItem(new MenuItem("Insert row above", new Command() {
          public void execute() {
            _insertRow(row, flexTable.getCellCount(row));
            menuPopup.hide();
          }
        }));
      }
      menu.addItem(new MenuItem("Insert row below", new Command() {
      public void execute() {
        _insertRow(row + 1, flexTable.getCellCount(row));
        menuPopup.hide();
      }
      }));
     
      if ( row >= FIRST_REGULAR_ROW ) {
        menu.addSeparator();
        menu.addItem(new MenuItem("Delete row", new Command() {
          public void execute() {
            _deleteRow(row);
            menuPopup.hide();
          }
        }));
View Full Code Here

    Widget ww = _getWidget(CONTROL_COL, col);
    int left = ww.getAbsoluteLeft();
    int top = ww.getAbsoluteTop();

      MenuBar menu = new MenuBar(true);
      final PopupPanel menuPopup = new PopupPanel(true);
     
      menu.addItem(new MenuItem("Insert column right", new Command() {
      public void execute() {
        _insertCol(col + 1);
        menuPopup.hide();
      }
      }));
      menu.addItem(new MenuItem("Insert column left", new Command() {
      public void execute() {
        _insertCol(col);
        menuPopup.hide();
      }
      }));
     
      // do not allow to remove the client column if it's the only one:
      if ( flexTable.getCellCount(0) > 2 ) {
        menu.addSeparator();
        menu.addItem(new MenuItem("Delete column", new Command() {
        public void execute() {
          _deleteCol(col);
          menuPopup.hide();
        }
        }));
View Full Code Here

//  }
// 
 
  public void dispatchTableMenu(int left, int top) {

      MenuBar menu = new MenuBar(true);
      final PopupPanel menuPopup = new PopupPanel(true);
     
      menu.addItem(new MenuItem("Import...", new Command() {
      public void execute() {
        menuPopup.hide();
        dispatchImportAction();
      }
      }));
      menu.addItem(new MenuItem("Export...", new Command() {
      public void execute() {
        menuPopup.hide();
        exportContents();
      }
      }));
View Full Code Here

 
 
  public MenuBar createOntologyMenuBar(RegisteredOntologyInfo oi, boolean includeEdit, boolean includeVersion,
      boolean includeVersionsMenu
  ) {
    MenuBar ont_mb = new MenuBar(true);
    ont_mb.setAutoOpen(true);
   
    if ( includeEdit && pctrl.checkCanEditOntology(oi) == null ) {
      ont_mb.addItem(_createMenuItemCreateNewVersion());
    }
   
    ont_mb.addItem("View as", _createMenuBarDownloadOntologyAs(oi, includeVersion));
   
    if ( oi == null && (pctrl.getOntologyInfo() instanceof RegisteredOntologyInfo) ) {
      oi = (RegisteredOntologyInfo) pctrl.getOntologyInfo();
    }
   
    if ( oi != null ) {
      if ( includeVersionsMenu && oi.getPriorVersions() != null && oi.getPriorVersions().size() > 0 ) {
        ont_mb.addSeparator();
        ont_mb.addItem(_createMenuItemVersions(oi));
      }

      ExternalViewersInfo xvi = pctrl.getExternalViewersInfo(oi, includeVersion);
      if ( xvi != null ) {
        ont_mb.addSeparator();
        MenuItem mi = new MenuItem(xvi.hrefHtml.getHTML(), true, nullCmd);
        mi.setTitle(xvi.tooltip);
        ont_mb.addItem(mi);
      }
    }
   
    return ont_mb;
  }
View Full Code Here

    }
  };
 
  private MenuBar _createMenuBarDownloadOntologyAs(RegisteredOntologyInfo oi, boolean includeVersion) {
    // use a nullCmd as i'm not sure addItem accepts a null command
    MenuBar mb = new MenuBar(true);
    for (PortalControl.DownloadOption dopc : PortalControl.DownloadOption.values() ) {
      String text = pctrl.getDownloadOptionHtml(dopc, oi, includeVersion);
      if ( text != null ) {
        mb.addItem(text, true, nullCmd);
      }
    }
    return mb;
  }
View Full Code Here

    titlePanel.add(title);
    titlePanel.add(info);
    HorizontalPanel actionsPanel = new HorizontalPanel();
    actionsPanel.setHeight("30px");
    actionsPanel.setStylePrimaryName("lab-Header-Actions");
    MenuBar menu = new MenuBar(false);
    saveMenuItem = addMenuItem(menu, null, "Save Now", new CurrentDocumentSaveCommand(false));
    menu.addSeparator();
    saveAndCloseMenuItem = addMenuItem(menu, null, "Save & Close", new CurrentDocumentSaveAndCloseCommand());
    saveAndCloseMenuItem.setStylePrimaryName("lab-HighlightedMenuItem");
    actionsPanel.add(menu);
    table.setWidget(0, 0, titlePanel);
    table.setWidget(0, 1, actionsPanel);
View Full Code Here

   
    Widget ww = _getWidget(row, 0);
    int left = ww.getAbsoluteLeft();
    int top = ww.getAbsoluteTop();

      MenuBar menu = new MenuBar(true);
      final PopupPanel menuPopup = new PopupPanel(true);
     
      if ( row >= FIRST_REGULAR_ROW ) {
        menu.addItem(new MenuItem("Insert row above", new Command() {
          public void execute() {
            _insertRow(row, flexTable.getCellCount(row));
            menuPopup.hide();
          }
        }));
      }
      menu.addItem(new MenuItem("Insert row below", new Command() {
      public void execute() {
        _insertRow(row + 1, flexTable.getCellCount(row));
        menuPopup.hide();
      }
      }));
     
      if ( row >= FIRST_REGULAR_ROW ) {
        menu.addSeparator();
        menu.addItem(new MenuItem("Delete row", new Command() {
          public void execute() {
            _deleteRow(row);
            menuPopup.hide();
          }
        }));
View Full Code Here

    Widget ww = _getWidget(CONTROL_COL, col);
    int left = ww.getAbsoluteLeft();
    int top = ww.getAbsoluteTop();

      MenuBar menu = new MenuBar(true);
      final PopupPanel menuPopup = new PopupPanel(true);
     
      menu.addItem(new MenuItem("Insert column right", new Command() {
      public void execute() {
        _insertCol(col + 1);
        menuPopup.hide();
      }
      }));
      menu.addItem(new MenuItem("Insert column left", new Command() {
      public void execute() {
        _insertCol(col);
        menuPopup.hide();
      }
      }));
     
      // do not allow to remove the client column if it's the only one:
      if ( flexTable.getCellCount(0) > 2 ) {
        menu.addSeparator();
        menu.addItem(new MenuItem("Delete column", new Command() {
        public void execute() {
          _deleteCol(col);
          menuPopup.hide();
        }
        }));
View Full Code Here

TOP

Related Classes of com.google.gwt.user.client.ui.MenuBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.