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

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


        MenuBar rootMenuBar = new MenuBar( true );
        rootMenuBar.setAutoOpen( true );
        rootMenuBar.setAnimationEnabled( true );

        rootMenuBar.addItem( new MenuItem( constants.CreateNew(), createNewMenu ) );

        return rootMenuBar;
    }
View Full Code Here


    }

    // 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);
View Full Code Here

        this.left = left;
        this.top = top;
        menu.clearItems();
        for (int i = 0; i < actions.length; i++) {
            final Action a = actions[i];
            menu.addItem(new MenuItem(a.getHTML(), true, a));
        }

        // Attach onload listeners to all images
        Util.sinkOnloadForImages(menu.getElement());
View Full Code Here

    @Override
    public com.google.gwt.user.client.Element getSubPartElement(String subPart) {
        int index = Integer.parseInt(subPart.substring(6));
        // ApplicationConnection.getConsole().log(
        // "Searching element for selection index " + index);
        MenuItem item = menu.getItem(index);
        // ApplicationConnection.getConsole().log("Item: " + item);
        // Item refers to the td, which is the parent of the clickable element
        return item.getElement().getFirstChildElement().cast();
    }
View Full Code Here

    protected void handleChildMenu(AbstractClient rootHandler, MenuBar bar, Object childCom, DomNode childElement)
    {
        if (childCom instanceof MenuItem)
        {
            MenuItem m = (MenuItem) childCom;
            bar.addItem(m);
        } else if (childCom instanceof MenuBar)
        {
            MenuBar mb = (MenuBar) childCom;
            bar.addItem(mb.getTitle(), mb);
View Full Code Here

        {
            DomNode childNode = (DomNode) nodes.get(i);
            Object childCom = rootHandler.handle(menu, childNode);
            if (childCom instanceof MenuItem)
            {
                MenuItem item = (MenuItem) childCom;
                menu.addItem(item);
            } else if (childCom instanceof MenuBar)
            {
                MenuBar mb = (MenuBar) childCom;
                menu.addItem(mb.getTitle(), mb);
View Full Code Here

            public void execute()
            {
                handleEvent(getItem(), null);
            }
        };
        MenuItem item = new MenuItem("", m);
        m.setItem(item);
        return item;
    }
View Full Code Here

    public Object updateUI(Object com, DomNode element)
    {
        if (com instanceof MenuItem)
        {
            MenuItem item = (MenuItem) com;
            String label = element.getAttribute("label");
            item.setText(label);
        }
        return super.updateUI(com, element);
    }
View Full Code Here

      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

    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.MenuItem

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.