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

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


      {
         String label = AppCommand.formatMenuLabel(icons[i],
                                                   names[i] + "\u00A0\u00A0\u00A0",
                                                   null);
         final int tabIndex = i;
         MenuItem item = addItem(label, true, new Command()
         {
            public void execute()
            {
               if (panel_ != null)
                  panel_.hide(false);
               events_.fireEvent(new SwitchToDocEvent(tabIndex));
            }
         });
         item.setTitle(paths[i]);

         names_.add(names[i]);
         menuItems_.add(item);
      }
   }
View Full Code Here


               boolean up = event.getNativeKeyCode() == KeyCodes.KEY_UP;

               int index = up ? items.size() + 1 : -1;

               MenuItem selectedItem = menu_.getSelectedItem();
               if (selectedItem != null && items.contains(selectedItem))
                  index = items.indexOf(selectedItem);

               index = (index + (up ? -1 : 1) + items.size()) % items.size();

               menu_.selectItem(items.get(index));
               break;
            case KeyCodes.KEY_ENTER:
               event.preventDefault();
               event.stopPropagation();

               MenuItem selected = menu_.getSelectedItem();
               if (selected != null && selected.isVisible())
                  selected.getScheduledCommand().execute();
               else
               {
                  ArrayList<MenuItem> visibleItems = menu_.getVisibleItems();
                  if (visibleItems.size() == 1)
                     visibleItems.get(0).getScheduledCommand().execute();
View Full Code Here

   @Override
   protected void onBeforePopulateMenu(ToolbarPopupMenu rootMenu)
   {
      String label = "(all branches)";
      rootMenu.addItem(
            new MenuItem(label, new SwitchBranchCommand(label, "--all")));
   }
View Full Code Here

      for (int i = 0; i < branches.length(); i++)
      {
         String branch = branches.get(i);
         final String branchLabel = branch.replaceFirst("^remotes/", "");
         final String branchValue = branch.replaceFirst(" ->.*", "");
         rootMenu.addItem(new MenuItem(branchLabel,
                                       new SwitchBranchCommand(branchLabel,
                                                               branchValue)));
      }
   }
View Full Code Here

                final PropertyDescriptor pd = (PropertyDescriptor)propertyDescriptorsMap.get(rgs[i]);
                final TableHeaderCell thc = tr.newTableHeaderCell();

                final MenuBar colMenu = new MenuBar(true);
                if (pd instanceof SortablePropertyDescriptor) {
                    final MenuItem sortItem = createSortMenu((SortablePropertyDescriptor)pd);
                    colMenu.addItem(sortItem);
                }
                if (pd instanceof FilterablePropertyDescriptor) {
                    // TODO: filter menu items
                }
View Full Code Here

                    //Window.alert("Sort Down not implemented.");
                    ptel.setComparator(comparator);
                }
            });

            return new MenuItem("<span style=\"float:right;\">&#187</span>Sort", true, sortMenu);
        }
View Full Code Here

        menu0.addItem("<i>Italicized</i>", true, new MyCommand());
        menu0.addItem("More &#187;", true, subMenu);


        final MenuBar menu = new MenuBar(true);
        menu.addItem(new MenuItem("Style", menu0));

        return menu;
    }
View Full Code Here

            {
                th = tr.newTableHeaderCell();
                final MenuBar nameMenu = new MenuBar();

                final MenuBar nameSubMenu = new MenuBar(true);
                final MenuItem nameSortUp = new MenuItem("Sort Up", new Command() {
                    Comparator c = new Comparator() {
                        public int compare(final Object o1, final Object o2) {
                            final Person p1 = (Person)o1;
                            final Person p2 = (Person)o2;
                            return p1.getName().compareTo(p2.getName());
                        }
                    };
                    public void execute() {
                        if (sel != null) {
                            sel.setComparator(c);
                        }
                    }
                });
                final MenuItem nameSortDown = new MenuItem("Sort Down", new Command() {
                    Comparator c = new Comparator() {
                        public int compare(final Object o1, final Object o2) {
                            final Person p1 = (Person)o1;
                            final Person p2 = (Person)o2;
                            return p2.getName().compareTo(p1.getName());
                        }
                    };
                    public void execute() {
                        if (sel != null) {
                            sel.setComparator(c);
                        }
                    }
                });
                nameSubMenu.addItem(nameSortUp);
                nameSubMenu.addItem(nameSortDown);

                final MenuItem nameMenuItem = new MenuItem("Name", nameSubMenu);
                nameMenu.addItem(nameMenuItem);
                th.add(nameMenu);
                tr.add(th);
            }

            {
                th = tr.newTableHeaderCell();
                final MenuBar ageMenu = new MenuBar();

                final MenuBar ageSubMenu = new MenuBar(true);
                final MenuItem ageSortUp = new MenuItem("Sort Up", new Command() {
                    Comparator c = new Comparator() {
                        public int compare(final Object o1, final Object o2) {
                            final Person p1 = (Person)o1;
                            final Person p2 = (Person)o2;
                            return p1.getAge() - p2.getAge();
                        }
                    };
                    public void execute() {
                        if (sel != null) {
                            sel.setComparator(c);
                        }
                    }
                });
                final MenuItem ageSortDown = new MenuItem("Sort Down", new Command() {
                    Comparator c = new Comparator() {
                        public int compare(final Object o1, final Object o2) {
                            final Person p1 = (Person)o1;
                            final Person p2 = (Person)o2;
                            return p2.getAge() - p1.getAge();
                        }
                    };
                    public void execute() {
                        if (sel != null) {
                            sel.setComparator(c);
                        }
                    }
                });
                ageSubMenu.addItem(ageSortUp);
                ageSubMenu.addItem(ageSortDown);

                final MenuItem ageMenuItem = new MenuItem("Age", ageSubMenu);
                ageMenu.addItem(ageMenuItem);
                th.add(ageMenu);
                tr.add(th);
            }
            th = tr.newTableHeaderCell();
View Full Code Here

     
      //添加个人空间菜单.
      MenuBar recentDocsMenu = new MenuBar(true);
      recentDocsMenu.setTitle("abc");
      for(int i = 0; i < 3; i ++){
        MenuItem item = new MenuItem("abc"+i, new Command() {
        @Override
        public void execute() {
          // TODO Auto-generated method stub
        }
      });
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

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.