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

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


   * @param filePickList
   *          The files to list in natural order
   */
  private void refreshPickListMenu( XulMenubar pickMenu,
      final AbstractFilePickList<? extends IFilePickItem> filePickList, PickListType type ) {
    final MenuBar menuBar = (MenuBar) pickMenu.getManagedObject();
    menuBar.clearItems();

    final String menuClearMessage = Messages.getString( type.getMenuItemKey() );
    final String clearMessage = Messages.getString( type.getMessageKey() );

    if ( filePickList.size() > 0 ) {
      for ( IFilePickItem filePickItem : filePickList.getFilePickList() ) {
        final String text = filePickItem.getFullPath();
        menuBar.addItem( filePickItem.getTitle(), new Command() {
          public void execute() {
            SolutionBrowserPanel.getInstance().openFile( text, COMMAND.RUN );
          }
        } );
      }
      menuBar.addSeparator();
      menuBar.addItem( menuClearMessage, new Command() {
        public void execute() {
          // confirm the clear
          GwtConfirmBox warning = new GwtConfirmBox();
          warning.setHeight( 117 );
          warning.setMessage( clearMessage );
          warning.setTitle( menuClearMessage );
          warning.setAcceptLabel( Messages.getString( "clearRecentAcceptButtonLabel" ) );
          warning.setCancelLabel( Messages.getString( "clearRecentCancelButtonLabel" ) );
          warning.addDialogCallback( new XulDialogCallback<String>() {
            public void onClose( XulComponent sender, Status returnCode, String retVal ) {
              if ( returnCode == Status.ACCEPT ) {
                filePickList.clear();
              }
            }

            public void onError( XulComponent sender, Throwable t ) {
            }
          } );
          warning.show();
        }
      } );
    } else {
      menuBar.addItem( Messages.getString( "empty" ), new Command() { //$NON-NLS-1$
          public void execute() {
            // Do nothing
          }
        } );
    }
View Full Code Here


        Window.alert("You selected a menu item!");
      }
    };

    // Make some sub-menus that we will cascade from the top menu.
    MenuBar fooMenu = new MenuBar(true);
    fooMenu.addItem("the", cmd);
    fooMenu.addItem("foo", cmd);
    fooMenu.addItem("menu", cmd);

    MenuBar barMenu = new MenuBar(true);
    barMenu.addItem("the", cmd);
    barMenu.addItem("bar", cmd);
    barMenu.addItem("menu", cmd);

    MenuBar bazMenu = new MenuBar(true);
    bazMenu.addItem("the", cmd);
    bazMenu.addItem("baz", cmd);
    bazMenu.addItem("menu", cmd);

    // Make a new menu bar, adding a few cascading menus to it.
    MenuBar menu = new MenuBar();
    menu.addItem("foo", fooMenu);
    menu.addItem("bar", barMenu);
    menu.addItem("baz", bazMenu);

    // Add it to the root panel.
    RootPanel.get().add(menu);
  }
View Full Code Here

  };

  @Override
  public Widget createIssue() {
    // Create the main menu bar
    MenuBar menuBar = new MenuBar();
    menuBar.setAutoOpen(true);

    // Change the primary style name
    menuBar.setStylePrimaryName("myMenuBar");

    // Add the original style names so the default styles apply
    menuBar.addStyleName("gwt-MenuBar gwt-MenuBar-horizontal");

    // Add some sub menus, each with a unique style name
    for (int i = 0; i < 3; i++) {
      MenuBar subMenu = new MenuBar(true);
      subMenu.addItem("Item 1", emptyCommand);
      subMenu.addItem("Item 2", emptyCommand);
      subMenu.addItem("Item 3", emptyCommand);
      menuBar.addItem("Option " + i, subMenu);
    }

    return menuBar;
  }
View Full Code Here

      public void execute() {
      }
    };

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

    // Create a sub menu of recent documents
    MenuBar recentDocsMenu = new MenuBar(true);
    recentDocsMenu.addItem("Document 0", emptyCommand);
    recentDocsMenu.addItem("Document 1", emptyCommand);
    recentDocsMenu.addItem("Document 2", emptyCommand);

    // Create the file menu
    MenuBar fileMenu = new MenuBar(true);
    menu.addItem(new MenuItem("File", fileMenu));
    fileMenu.addItem("New", emptyCommand);
    fileMenu.addItem("Print", emptyCommand);
    fileMenu.addItem("Recent Docs", recentDocsMenu);

    // Create the edit menu
    MenuBar editMenu = new MenuBar(true);
    menu.addItem(new MenuItem("Edit", editMenu));
    editMenu.addItem("Cut", emptyCommand);
    editMenu.addItem("Copy", emptyCommand);
    editMenu.addItem("Paste", emptyCommand);

    // Create the help menu
    MenuBar helpMenu = new MenuBar(true);
    menu.addItem(new MenuItem("Help", helpMenu));
    helpMenu.addItem("Settings", emptyCommand);
    helpMenu.addItem("About", emptyCommand);

    return menu;
  }
View Full Code Here

        reporter.report("menu item selected");
      }

    };

    MenuBar main = new MenuBar();
    main.setTitle("Main");
    p.add(main);
    MenuBar barA = new MenuBar();
    barA.setTitle("A");
    CloseHandler<PopupPanel> handler = new CloseHandler<PopupPanel>() {

      public void onClose(CloseEvent<PopupPanel> event) {
        reporter.report("closed popup belonging to Main");
      }

    };
    main.addCloseHandler(handler);
    barA.addItem("a1", command);
    barA.addItem("a2", command);

    handler = new CloseHandler<PopupPanel>() {

      public void onClose(CloseEvent<PopupPanel> event) {
        reporter.report("closed popup belonging to A");
      }

    };
    barA.addCloseHandler(handler);
    MenuBar barB = new MenuBar();
    barB.setTitle("B");
    barB.addItem("b1", command);
    barB.addItem("b2", command);

    handler = new CloseHandler<PopupPanel>() {

      public void onClose(CloseEvent<PopupPanel> event) {
        reporter.report("closed popup belonging to B");
      }

    };
    barB.addCloseHandler(handler);
    MenuBar barC = new MenuBar();
    barC.addItem("c1", command);
    barC.addItem("c2", command);

    handler = new CloseHandler<PopupPanel>() {

      public void onClose(CloseEvent<PopupPanel> event) {
        reporter.report("closed popup belonging to c");
      }

    };
    barC.addCloseHandler(handler);
    barC.setTitle("C");

    handler = new CloseHandler<PopupPanel>() {

      public void onClose(CloseEvent<PopupPanel> event) {
        reporter.report("closed popup belonging to B");
View Full Code Here

            ((AppMenuItem)child).onShow();
         else
         {
            // if this is a submenu that consists entirely of hidden commands,
            // hide the submenu and its flyout icon
            MenuBar submenu = child.getSubMenu();
            if (submenu != null &&
                submenu instanceof AppMenuBar)
            {
               boolean visible = child.isVisible();
               boolean newVisible = !((AppMenuBar)submenu).allInvisibleCmds();
View Full Code Here

    private ConstantsCore constants = GWT.create(ConstantsCore.class);


    public MenuBar createMenuBar(final MultiViewEditor editor, EventBus eventBus) {
       
        MenuBar toolbar = new MenuBar();

        toolbar.addItem(constants.SaveAllChanges(),
                new Command() {

                    public void execute() {
                        editor.checkin(false);
                    }
                });
        toolbar.addItem(constants.SaveAndCloseAll(),
                new Command() {

                    public void execute() {
                        editor.checkin(true);
                    }
View Full Code Here

public class PTMenuBar extends PTWidget<MenuBar> {

    @Override
    public void create(final PTInstruction create, final UIService uiService) {
        init(create, uiService, new MenuBar(create.getBoolean(PROPERTY.MENU_BAR_IS_VERTICAL)));
    }
View Full Code Here

    @Override
    public void add(final PTInstruction add, final UIService uiService) {

        final PTObject child = uiService.getPTObject(add.getObjectID());
        final MenuBar menuBar = cast();

        if (child instanceof PTMenuItem) {
            final PTMenuItem menuItem = (PTMenuItem) child;
            if (add.containsKey(PROPERTY.BEFORE_INDEX)) {
                menuBar.insertItem(menuItem.cast(), add.getInt(PROPERTY.BEFORE_INDEX));
            } else {
                menuBar.addItem(menuItem.cast());
            }
        } else {
            final PTMenuItemSeparator menuItem = (PTMenuItemSeparator) child;
            menuBar.addSeparator(menuItem.cast());
        }
    }
View Full Code Here

  public HeaderWidget(UserDetails userDetails) {
    this.userDetails = userDetails;
    service = (MentorServiceAsync) GWT.create(MentorService.class);
   
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    menuBar = new MenuBar(false);
    horizontalPanel.add(menuBar);
    service = (MentorServiceAsync) GWT.create(MentorService.class);
    me = this;
    if (mainPage == null) {
      // defer loading of mainPagewidget until session is created.
View Full Code Here

TOP

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

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.