Java 类com.google.gwt.user.client.ui.MenuItem 实例源码

项目:EasyML    文件:ProgramUpdateMenu.java   
public static MenuItem create(final ProgramLeaf node, final ProgramTree tree) {

        Command command = new MenuItemCommand(node) {

            @Override
            public void execute() {
                UpdateProgramPanel panel = new UpdateProgramPanel(tree,node);
                panel.show(node.getModule());
                this.component.getContextMenu().hide();
            }

        };

        MenuItem item = new MenuItem("Update", command);
        return item;
    }
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create DeleteItem
 * @param com
 * @return delete item
 */
public static MenuItem createDeleteItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            BaseWidget widget = (BaseWidget) this.component;
            DiagramController controller = widget.getController();
            controller.deleteWidget(widget);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Delete", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create PremeterItem
 * @param com
 * @return PremeterItem
 */
public static MenuItem createPremeterItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            widget.getParameterPanel();
            widget.setETLPanel();
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Configure parameters", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create DownloadDataItem
 * @param com
 * @return DownloadDataItem
 */
public static MenuItem createDownloadData(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {

            DatasetWidget widget = (DatasetWidget) this.component;
            widget.getContextMenu().hide();
            OutNodeShape shape = widget.getOutNodeShapes().get(0);
            String filename = shape.getAbsolutePath() + "/" + shape.getFileId();
            String url = GWT.getModuleBaseURL().split("EMLStudio")[0]
                    + "EMLStudioMonitor/filedownload?filename=" + filename;
            Window.open(url, "_blank", "status=0,toolbar=0,menubar=0,location=0");

        }

    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create StderrItem
 * @param com
 * @return StderrItem
 */
public static MenuItem createStderrItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            MonitorController controller = (MonitorController) widget
                    .getController();
            String oozJobId = widget.getAction().getJobId();
            String actionid = widget.getId();
            controller.getStdErr(oozJobId, actionid);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Show Stderr", command);
    return item;
}
项目:EasyML    文件:BaseWidgetMenuItemFactory.java   
/**
 * Create StdoutItem
 * @param com
 * @return StdoutItem
 */
public static MenuItem createStdoutItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {

        @Override
        public void execute() {
            ProgramWidget widget = (ProgramWidget) this.component;
            MonitorController controller = (MonitorController) widget
                    .getController();
            String oozJobId = widget.getAction().getJobId();
            String actionid = widget.getId();
            controller.getStdOut(oozJobId, actionid);
            widget.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("Show Stdout", command);
    return item;
}
项目:EasyML    文件:BaseShapeMenuItemFactory.java   
/**
 * Create result preview popup menuitem
 * 
 * @param com
 * @return
 */
public static MenuItem createShowResultItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {
        @Override
        public void execute() {
            NodeShape nodeShape = (NodeShape) this.component;
            //If the shape node is output node shape
            if(nodeShape instanceof OutNodeShape) {
                OutNodeShape outShape  = (OutNodeShape) nodeShape;
                String fileId = outShape.getFileId();
                String path = outShape.getAbsolutePath();
                DBController.showPreviewPopup(path,fileId);
            }
            nodeShape.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Results preview", command);
    return item;
}
项目:EasyML    文件:BaseShapeMenuItemFactory.java   
/**
 * Create data visualization popup menuitem
 * 
 * @param com
 * @return
 */
public static MenuItem createVisuallizeItem(HasRightMouseUpMenu com) {
    Command command = new MenuItemCommand(com) {
        @Override
        public void execute() {
            NodeShape nodeShape = (NodeShape) this.component;
            // If the node shape is output node shape
            if(nodeShape instanceof OutNodeShape) {
                OutNodeShape outShape  = (OutNodeShape) nodeShape;
                String fileId = outShape.getFileId();
                String path = outShape.getAbsolutePath();
                String fPath = path +"/"+fileId;
                DBController.showDataVisualPopup(fPath,fileId);
            }
            nodeShape.getContextMenu().hide();
        }
    };
    MenuItem item = new MenuItem("Visualization", command);
    return item;
}
项目:appinventor-extensions    文件:DropDownButton.java   
public DropDownButton(String widgetName, String caption, List<DropDownItem> toolbarItems,
                      boolean rightAlign) {
  super(caption + " \u25BE ");  // drop down triangle

  this.menu = new ContextMenu();
  this.items = new ArrayList<MenuItem>();
  this.rightAlign = rightAlign;

  for (DropDownItem item : toolbarItems) {
    if (item != null) {
      this.items.add(menu.addItem(item.caption, true, item.command));
    } else {
      menu.addSeparator();
    }
  }

  addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement()));
    }
  });
}
项目:appinventor-extensions    文件:DropDownButton.java   
public DropDownButton(String widgetName, Image icon, List<DropDownItem> toolbarItems,
                      boolean rightAlign) {
  super(icon);  // icon for button

  this.menu = new ContextMenu();
  this.items = new ArrayList<MenuItem>();
  this.rightAlign = rightAlign;

  for (DropDownItem item : toolbarItems) {
    if (item != null) {
      addItem(item);
    } else {
      menu.addSeparator();
    }
  }

  addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      menu.setPopupPositionAndShow(new DropDownPositionCallback(getElement()));
    }
  });
}
项目:document-management-system    文件:TrashMenu.java   
public TrashMenu() {
    toolBarOption = new ToolBarOption();
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    dirMenu = new MenuBar(true);
    restore = new MenuItem(Util.menuHTML("img/icon/actions/restore.gif", Main.i18n("general.menu.file.restore")), true, restoreFolder);
    restore.addStyleName("okm-MenuItem");
    dirMenu.addItem(restore);
    purge = new MenuItem(Util.menuHTML("img/icon/actions/purge.gif", Main.i18n("general.menu.file.purge")), true, purgeFolder);
    purge.addStyleName("okm-MenuItem");
    dirMenu.addItem(purge);
    purgeTrash = new MenuItem(Util.menuHTML("img/icon/actions/purge_trash.gif", Main.i18n("general.menu.file.purge.trash")), true, purgeTrashFolder);
    purgeTrash.addStyleName("okm-MenuItem");
    dirMenu.addItem(purgeTrash);
    dirMenu.setStyleName("okm-MenuBar");
    initWidget(dirMenu);
}
项目:document-management-system    文件:MailMenu.java   
public MailMenu() {
    toolBarOption = new ToolBarOption();
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    dirMenu = new MenuBar(true);
    create = new MenuItem(Util.menuHTML("img/icon/actions/add_folder.gif", Main.i18n("tree.menu.directory.create")), true, addFolder);
    create.addStyleName("okm-MenuItem");
    dirMenu.addItem(create);
    remove = new MenuItem(Util.menuHTML("img/icon/actions/delete.gif", Main.i18n("tree.menu.directory.remove")), true, delFolder);
    remove.addStyleName("okm-MenuItem-strike");
    dirMenu.addItem(remove);
    rename = new MenuItem(Util.menuHTML("img/icon/actions/rename.gif", Main.i18n("tree.menu.directory.rename")), true, renFolder);
    rename.addStyleName("okm-MenuItem-strike");
    dirMenu.addItem(rename);
    move = new MenuItem(Util.menuHTML("img/icon/actions/move_folder.gif", Main.i18n("tree.menu.directory.move")), true, moveFolder);
    move.addStyleName("okm-MenuItem");
    dirMenu.addItem(move);
    copy = new MenuItem(Util.menuHTML("img/icon/actions/copy.gif", Main.i18n("tree.menu.directory.copy")), true, copyFolder);
    copy.addStyleName("okm-MenuItem");
    dirMenu.addItem(copy);
    dirMenu.setStyleName("okm-MenuBar");
    initWidget(dirMenu);
}
项目:document-management-system    文件:Menu.java   
/**
 * Browser menu
 */
public Menu() {
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    searchMenu = new MenuBar(true);
    download = new MenuItem(Util.menuHTML("img/icon/actions/download.gif", Main.i18n("search.result.menu.download")), true, downloadFile);
    download.addStyleName("okm-MenuItem");
    go = new MenuItem(Util.menuHTML("img/icon/actions/goto_folder.gif", Main.i18n("search.result.menu.go.folder")), true, goDirectory);
    go.addStyleName("okm-MenuItem");
    findSimilarDocument = new MenuItem(Util.menuHTML("img/icon/actions/similar_find.png", Main.i18n("general.menu.file.find.similar.document")), true, findSimilarOKM);
    findSimilarDocument.addStyleName("okm-MenuItem");

    searchMenu.addItem(download);
    searchMenu.addItem(go);
    searchMenu.addItem(findSimilarDocument);
    searchMenu.setStyleName("okm-MenuBar");

    initWidget(searchMenu);
}
项目:document-management-system    文件:Menu.java   
/**
 * Browser menu
 */
public Menu() {
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    mailMenu = new MenuBar(true);
    all = new MenuItem(Util.menuHTML("img/icon/actions/select_all.png", Main.i18n("mail.menu.show.all")), true, commandShowAll);
    all.addStyleName("okm-MenuItem");
    mailMenu.addItem(all);
    cc = new MenuItem(Util.menuHTML("img/white_page.png", Main.i18n("mail.menu.show.cc")), true, commandShowCC);
    cc.addStyleName("okm-MenuItem");
    mailMenu.addItem(cc);
    bcc = new MenuItem(Util.menuHTML("img/white_page.png", Main.i18n("mail.menu.show.bcc")), true, commandShowBCC);
    bcc.addStyleName("okm-MenuItem");
    mailMenu.addItem(bcc);
    reply = new MenuItem(Util.menuHTML("img/white_page.png", Main.i18n("mail.menu.show.reply")), true, commandShowReply);
    reply.addStyleName("okm-MenuItem");
    mailMenu.addItem(reply);
    extra = new MenuItem(Util.menuHTML("img/white_page.png", Main.i18n("mail.menu.show.extre")), true, commandShowExtra);
    extra.addStyleName("okm-MenuItem");
    mailMenu.addItem(extra);
    mailMenu.addStyleName("okm-MenuBar");
    initWidget(mailMenu);
}
项目:document-management-system    文件:FindToolBarMenu.java   
/**
 * ResizeToolBarMenu
 */
public FindToolBarMenu() {
    // Establishes auto-close when click outside
    super(true, true);
    toolBarOption = new ToolBarOption();

    dirMenu = new MenuBar(true);
    dirMenu.setStyleName("okm-SubMenuBar");
    findFolder = new MenuItem(Util.menuHTML("img/icon/actions/folder_find.gif", Main.i18n("general.menu.file.find.folder")), true, findFolderOKM);
    findDocument = new MenuItem(Util.menuHTML("img/icon/actions/document_find.png", Main.i18n("general.menu.file.find.document")), true, findDocumentOKM);
    findSimilarDocument = new MenuItem(Util.menuHTML("img/icon/actions/similar_find.png", Main.i18n("general.menu.file.find.similar.document")), true, findSimilarOKM);

    dirMenu.addItem(findFolder);
    dirMenu.addItem(findDocument);
    dirMenu.addItem(findSimilarDocument);

    setWidget(dirMenu);
}
项目:document-management-system    文件:Menu.java   
/**
 * Browser menu
 */
public Menu() {
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    searchSavedMenu = new MenuBar(true);
    run = new MenuItem(Util.menuHTML("img/icon/actions/run.gif", Main.i18n("search.saved.run")), true, runSearch);
    run.addStyleName("okm-MenuItem");
    searchSavedMenu.addItem(run);
    delete = new MenuItem(Util.menuHTML("img/icon/actions/delete.gif", Main.i18n("search.saved.delete")), true, deleteSearch);
    delete.addStyleName("okm-MenuItem");
    searchSavedMenu.addItem(delete);
    share = new MenuItem(Util.menuHTML("img/icon/actions/share_query.gif", GeneralComunicator.i18nExtension("messaging.share.query")), true, shareSearch);
    share.addStyleName("okm-MenuItem");
    searchSavedMenu.addStyleName("okm-MenuBar");
    initWidget(searchSavedMenu);
}
项目:document-management-system    文件:CategoriesMenu.java   
public CategoriesMenu() {
    toolBarOption = new ToolBarOption();
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    dirMenu = new MenuBar(true);
    create = new MenuItem(Util.menuHTML("img/icon/actions/add_folder.gif", Main.i18n("tree.menu.directory.create")), true, addFolder);
    create.addStyleName("okm-MenuItem");
    dirMenu.addItem(create);
    rename = new MenuItem(Util.menuHTML("img/icon/actions/rename.gif", Main.i18n("tree.menu.directory.rename")), true, renFolder);
    rename.addStyleName("okm-MenuItem-strike");
    dirMenu.addItem(rename);
    move = new MenuItem(Util.menuHTML("img/icon/actions/move_folder.gif", Main.i18n("tree.menu.directory.move")), true, moveFolder);
    move.addStyleName("okm-MenuItem");
    dirMenu.addItem(move);
    dirMenu.setStyleName("okm-MenuBar");
    export = new MenuItem(Util.menuHTML("img/icon/actions/export.gif", Main.i18n("tree.menu.export")), true, exportToFile);
    export.addStyleName("okm-MenuItem-strike");
    dirMenu.addItem(export);
    initWidget(dirMenu);
}
项目:document-management-system    文件:Menu.java   
/**
 * Browser menu
 */
public Menu() {
    // The item selected must be called on style.css : .okm-MenuBar .gwt-MenuItem-selected

    // First initialize language values
    searchSavedMenu = new MenuBar(true);
    run = new MenuItem(Util.menuHTML("img/icon/actions/run.gif", Main.i18n("search.saved.run")), true, runSearch);
    run.addStyleName("okm-MenuItem");
    searchSavedMenu.addItem(run);
    delete = new MenuItem(Util.menuHTML("img/icon/actions/delete.gif", Main.i18n("search.saved.delete")), true, deleteSearch);
    delete.addStyleName("okm-MenuItem");
    searchSavedMenu.addItem(delete);
    share = new MenuItem(Util.menuHTML("img/icon/actions/share_query.gif", GeneralComunicator.i18nExtension("messaging.share.query")), true, shareSearch);
    share.addStyleName("okm-MenuItem");
    searchSavedMenu.addStyleName("okm-MenuBar");
    initWidget(searchSavedMenu);
}
项目:ontobrowser    文件:OntoBrowser.java   
private void createOntologyMenu(List<Term> terms) {
    MenuBar menu = new MenuBar(true);
    menu.setAnimationEnabled(true);

    for(final Term term : terms) {
        Ontology ontology = term.getOntology();
        if(!ontology.isCodelist()) {
            menu.addItem(ontology.getName(), new Command() {
                public void execute() {
                    History.newItem(term.getReferenceId());
                }
            });
        }
    }

    menuBar.insertItem(new MenuItem("Ontology", menu), 0);
}
项目:hawkbit    文件:SuggestionsSelectList.java   
/**
 * Adds suggestions to the suggestion menu bar.
 * 
 * @param suggestions
 *            the suggestions to be added
 * @param textFieldWidget
 *            the text field which the suggestion is attached to to bring
 *            back the focus after selection
 * @param popupPanel
 *            pop-up panel where the menu bar is shown to hide it after
 *            selection
 * @param suggestionServerRpc
 *            server RPC to ask for new suggestion after a selection
 */
public void addItems(final List<SuggestTokenDto> suggestions, final VTextField textFieldWidget,
        final PopupPanel popupPanel, final TextFieldSuggestionBoxServerRpc suggestionServerRpc) {
    for (int index = 0; index < suggestions.size(); index++) {
        final SuggestTokenDto suggestToken = suggestions.get(index);
        final MenuItem mi = new MenuItem(suggestToken.getSuggestion(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                final String tmpSuggestion = suggestToken.getSuggestion();
                final TokenStartEnd tokenStartEnd = tokenMap.get(tmpSuggestion);
                final String text = textFieldWidget.getValue();
                final StringBuilder builder = new StringBuilder(text);
                builder.replace(tokenStartEnd.getStart(), tokenStartEnd.getEnd() + 1, tmpSuggestion);
                textFieldWidget.setValue(builder.toString(), true);
                popupPanel.hide();
                textFieldWidget.setFocus(true);
                suggestionServerRpc.suggest(builder.toString(), textFieldWidget.getCursorPos());
            }
        });
        tokenMap.put(suggestToken.getSuggestion(),
                new TokenStartEnd(suggestToken.getStart(), suggestToken.getEnd()));
        Roles.getListitemRole().set(mi.getElement());
        WidgetUtil.sinkOnloadForImages(mi.getElement());
        addItem(mi);
    }
}
项目:umlet    文件:MenuPopup.java   
public MenuPopup(List<MenuPopupItem> items) {
    super(false, Type.MENU);
    MenuBar popupMenuBar = new MenuBar(true);

    for (final MenuPopupItem item : items) {
        popupMenuBar.addItem(new MenuItem(item.getText(), true, new ScheduledCommand() {
            @Override
            public void execute() {
                item.execute();
                hide();
            }
        }));
    }
    popupMenuBar.setVisible(true);
    add(popupMenuBar);
}
项目:platypus-js    文件:PlatypusMenuBar.java   
public boolean add(UIObject aChild) {
    boolean added;
    if (aChild instanceof MenuItemImageText) {
        addItem((MenuItemImageText) aChild);
        allItems.add(aChild);
        added = true;
    } else if (aChild instanceof PlatypusMenuItemSeparator) {
        addSeparator((PlatypusMenuItemSeparator) aChild);
        allItems.add(aChild);
        added = true;
    } else if (aChild instanceof PlatypusMenu) {
        PlatypusMenu subMenu = (PlatypusMenu) aChild;
        MenuItem item = new MenuItem(subMenu.getText(), false, subMenu);
        item.setStyleName("menu-item");
        subMenu.setParentItem(item);
        addItem(item);
        allItems.add(aChild);
        added = true;
    } else
        added = false;
    if (added) {
        AddEvent.fire(this, aChild);
    }
    return added;
}
项目:platypus-js    文件:PlatypusMenuBar.java   
public boolean remove(UIObject aChild) {
    boolean removed = false;
    if (aChild instanceof MenuItem) {
        removeItem((MenuItem) aChild);
        allItems.remove(aChild);
        removed = true;
    } else if (aChild instanceof PlatypusMenuItemSeparator) {
        removeSeparator((PlatypusMenuItemSeparator) aChild);
        allItems.remove(aChild);
        removed = true;
    } else if (aChild instanceof PlatypusMenu) {
        removeItem(((PlatypusMenu) aChild).getParentItem());
        allItems.remove(aChild);
        removed = true;
    }
    if (removed) {
        RemoveEvent.fire(this, aChild);
    }
    return removed; 
}
项目:qafe-platform    文件:AbstractComponentRenderer.java   
private static void processMenu(MenuBar menu, MenuItemGVO[] subMenus, String name, String uuid, String parent) {
    MenuBar subMenu = new MenuBar(true);
    for (int j = 0; j < subMenus.length; j++) {
        if (subMenus[j].getSubMenus() != null && subMenus[j].getSubMenus().length > 0) {
            processMenu(subMenu, subMenus[j].getSubMenus(), subMenus[j].getDisplayname(), uuid, parent);
        } else {
            if (subMenus[j] instanceof MenuItemSeparatorGVO) {
                menu.addSeparator();
            } else {
                MenuItem menuItem = new MenuItem(subMenus[j].getDisplayname(), (Command) null);
                RendererHelper.fillIn(subMenus[j], menuItem, uuid, parent, subMenus[j].getContext());
                subMenu.addItem(menuItem);
            }
        }
    }
    if (tempString.equals(name)) {
        contextMenu.addItem(new MenuItem(name, subMenu));
    } else {
        menu.addItem(new MenuItem(name, subMenu));
    }
}
项目:qafe-platform    文件:RendererHelper.java   
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
    if (vo != null && ui != null) {
        if (vo.getMenu() != null) {
            MenuBar menu = new MenuBar();
            menu.setAutoOpen(true);
            menu.setWidth("100%");
            UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), uuid, parent, vo.getContext());
            if (renderedComponent instanceof MenuBar) {
                menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
            } else if (renderedComponent instanceof MenuItem) {
                menu.addItem((MenuItem) renderedComponent);
            }
            if (ui instanceof DockPanel) {
                ((DockPanel) ui).add(menu, DockPanel.NORTH);
            } else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
                ((Panel) ui).add(menu);
        }
    }

}
项目:qafe-platform    文件:WindowRenderer.java   
private void processMenu(MenuBar menu, MenuItemGVO subMenuGVO, String name, String uuid, String parent) {
    MenuBar subMenu = new MenuBar(true);
    MenuItemGVO[] subMenus = subMenuGVO.getSubMenus();
    for (int j = 0; j < subMenus.length; j++) {
        if (subMenus[j].getSubMenus() != null && subMenus[j].getSubMenus().length > 0) {
            processMenu(subMenu, subMenus[j], subMenus[j].getDisplayname(), uuid,parent);
        } else {
            if (subMenus[j] instanceof MenuItemSeparatorGVO){                   
                subMenu.addSeparator();
            } else {
                MenuItem menuItem = new MenuItem(subMenus[j].getDisplayname(),(Command) null);
                RendererHelper.fillIn(subMenus[j], menuItem, uuid,parent, subMenus[j].getContext());
                subMenu.addItem(menuItem);
            }
        }

    }
    MenuItem subMenuItem = new MenuItem(name, subMenu);
    RendererHelper.fillIn(subMenuGVO, subMenuItem, uuid,parent, subMenuGVO.getContext());
    menu.addItem(subMenuItem);
}
项目:qafe-platform    文件:RendererHelper.java   
public static void addMenu(ComponentGVO vo, UIObject ui, String uuid, String parent) {
    if (vo != null && ui != null) {
        if (vo.getMenu() != null) {
            MenuBar menu = new MenuBar();
            menu.setAutoOpen(true);
            menu.setWidth("100%");
            UIObject renderedComponent = new MenuItemRenderer().render(vo.getMenu(), null, uuid, parent, vo.getContext(), null);
            if (renderedComponent instanceof MenuBar) {
                menu.addItem(vo.getMenu().getDisplayname(), (MenuBar) renderedComponent);
            } else if (renderedComponent instanceof MenuItem) {
                menu.addItem((MenuItem) renderedComponent);
            }
            if (ui instanceof DockPanel) {
                ((DockPanel) ui).add(menu, DockPanel.NORTH);
            } else if (ui instanceof Grid || ui instanceof VerticalPanel || ui instanceof HorizontalPanel)
                ((Panel) ui).add(menu);
        }
    }

}
项目:rva    文件:PlaceholderContextMenuWidget.java   
public PlaceholderContextMenuWidget(Command bringToFrontCommand, Command bringForwardCommand, Command sendBackwardCommand,
                                        Command sendToBackCommand, Command propertiesCommand, Command deleteCommand) {
    super(true, false);
    MenuBar popupMenuBar = new MenuBar(true);

    MenuItem propertiesItem = new MenuItem("Properties", true, propertiesCommand);
    MenuItem deleteItem = new MenuItem("Delete", true, deleteCommand);
    MenuItem bringToFrontItem = new MenuItem("Bring to Front", true, bringToFrontCommand);
    MenuItem bringForwardItem = new MenuItem("Bring Forward", true, bringForwardCommand);
    MenuItem sendBackwardItem = new MenuItem("Send Backward", true, sendBackwardCommand);
    MenuItem sendToBackItem = new MenuItem("Send to Back", true, sendToBackCommand);

    popupMenuBar.addItem(propertiesItem);
    popupMenuBar.addItem(deleteItem);
    popupMenuBar.addSeparator();
    popupMenuBar.addItem(bringToFrontItem);
    popupMenuBar.addItem(bringForwardItem);
    popupMenuBar.addItem(sendBackwardItem);
    popupMenuBar.addItem(sendToBackItem);

    popupMenuBar.setVisible(true);
    add(popupMenuBar);

    sinkEvents(Event.ONCONTEXTMENU); 
}
项目:EasyML    文件:Connection.java   
protected void initMenu() {
    menu = new ContextMenu();
    menu.addItem(new MenuItem(deleteMenuText, true, new Command() {
        @Override
        public void execute() {
            controller.deleteConnection(Connection.this);
            startShape.removeConnection(Connection.this);
            endShape.removeConnection(Connection.this);
            menu.hide();
        }
    }));
}
项目:EasyML    文件:DatasetUpdateMenu.java   
public static MenuItem create(final DatasetLeaf node, final DatasetTree tree) {
    Command command = new MenuItemCommand(node) {
        @Override
        public void execute() {
            UpdateDatasetPanel panel = new UpdateDatasetPanel(tree, node);

            panel.show(node.getModule());

            this.component.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Update", command);
    return item;
}
项目:EasyML    文件:DatasetDeleteMenu.java   
public static MenuItem create(final DatasetLeaf node) {

        Command command = new MenuItemCommand(node) {

            @Override
            public void execute() {
                String id = node.getModule().getId();
                boolean y = Window.confirm("Ready to delete " + node.getText() + "?");
                if (y) {
                    DatasetServiceAsync svc = GWT.create(DatasetService.class);
                    svc.delete(id, new AsyncCallback<Void>() {

                        @Override
                        public void onFailure(Throwable caught) {
                            Window.alert(caught.getMessage());
                        }

                        @Override
                        public void onSuccess(Void result) {
                            node.delete();
                        }
                    });
                }

                this.component.getContextMenu().hide();
            }
        };

        MenuItem item = new MenuItem("Delete", command);
        return item;
    }
项目:EasyML    文件:ProgramDeleteMenu.java   
public static MenuItem create(final ProgramLeaf node) {

        Command command = new MenuItemCommand(node) {

            @Override
            public void execute() {
                String id = node.getModule().getId();
                boolean y = Window.confirm("Are you ready to delete " + node.getText() + "?");
                if (y) {
                    ProgramServiceAsync svc = GWT.create(ProgramService.class);
                    svc.delete(id, new AsyncCallback<Void>() {

                        @Override
                        public void onFailure(Throwable caught) {
                            Window.alert(caught.getMessage());
                        }

                        @Override
                        public void onSuccess(Void result) {
                            node.delete();
                        }

                    });
                }
                this.component.getContextMenu().hide();
            }
        };

        MenuItem item = new MenuItem("delete", command);
        return item;
    }
项目:EasyML    文件:JobAddExampleMenu.java   
public static MenuItem create(final JobLeaf node) {
    Command command = new MenuItemCommand(node) {

        @Override
        public void execute() {
            String id = node.getModule().getJobId();
            boolean y = Window.confirm("Are you sure you want to join the example task?");
            if (y) {
                JobServiceAsync srv = GWT.create(JobService.class);
                srv.setExampleJobs(id, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        node.delete();
                    }
                });
            }
            this.component.getContextMenu().hide();
        }
    };
    MenuItem item = new MenuItem("Join example task", command);
    return item;
}
项目:EasyML    文件:DatasetEditMenu.java   
public static MenuItem create(final DatasetLeaf node, final DatasetTree tree) {

        Command command = new MenuItemCommand(node) {
            @Override
            public void execute() {
                EditDatasetPanel panel = new EditDatasetPanel(AppController.email,tree,node);

                panel.show(node.getModule());

                this.component.getContextMenu().hide();
            }
        };
        MenuItem item = new MenuItem("Edit", command);
        return item;
    }
项目:EasyML    文件:ProgramDeprecateMenu.java   
public static MenuItem create(final ProgramLeaf node) {
    Command command = new MenuItemCommand(node) {
        @Override
        public void execute() {
            String id = node.getModule().getId();
            boolean y = Window.confirm("Are you ready to deprecate " + node.getModule().getName() + "?");
            if (y) {
                ProgramServiceAsync svc = GWT.create(ProgramService.class);
                svc.deprecate(id, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        node.delete();
                    }

                });
            }
            this.component.getContextMenu().hide();
        }

    };

    MenuItem item = new MenuItem("deprecate", command);
    return item;
}
项目:EasyML    文件:JobDeleteMenu.java   
public static MenuItem create(final JobLeaf node) {
    Command command = new MenuItemCommand(node) {

        @Override
        public void execute() {
            String id = node.getModule().getJobId();
            boolean y = Window.confirm("Are you sure you want to delete?");
            if (y) {
                JobServiceAsync srv = GWT.create(JobService.class);
                srv.deleteJob(id, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        node.delete();
                    }
                });
            }
            this.component.getContextMenu().hide();
        }
    };
    MenuItem item = new MenuItem("Delete", command);
    return item;
}
项目:EasyML    文件:DatasetDeprecateMenu.java   
public static MenuItem create(final DatasetLeaf node) {
    Command command = new MenuItemCommand(node) {
        @Override
        public void execute() {
            String id = node.getModule().getId();
            boolean y = Window.confirm("Ready to deprecate " + node.getModule().getName() + "?");
            if (y) {
                DatasetServiceAsync svc = GWT.create(DatasetService.class);
                svc.deprecate(id, new AsyncCallback<Void>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        Window.alert(caught.getMessage());
                    }

                    @Override
                    public void onSuccess(Void result) {
                        node.delete();
                    }

                });
            }
            this.component.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Deprecate", command);
    return item;
}
项目:EasyML    文件:ProgramEditMenu.java   
public static MenuItem create(final ProgramLeaf node, final ProgramTree tree) {

        Command command = new MenuItemCommand(node) {
            @Override
            public void execute() {
                EditProgramPanel panel = new EditProgramPanel(AppController.email,tree,node);

                panel.show(node.getModule());

                this.component.getContextMenu().hide();
            }
        };
        MenuItem item = new MenuItem("Edit", command);
        return item;
    }
项目:EasyML    文件:ProgramDownloadMenu.java   
public static MenuItem create(final ProgramLeaf node) {
    Command command = new MenuItemCommand(node) {

        @Override
        public void execute() {
            String id = node.getModule().getId();
            ProgramServiceAsync svc = GWT.create(ProgramService.class);
            svc.download(id, new AsyncCallback<String>() {

                @Override
                public void onFailure(Throwable caught) {
                    Window.alert(caught.getMessage());
                }

                @Override
                public void onSuccess(String result) {
                    String url = GWT.getModuleBaseURL().split("EML")[0]
                            + "EMLStudioMonitor/filedownload?filename=" + result;
                    Window.open(url, "_blank",
                            "status=0,toolbar=0,menubar=0,location=0");
                }

            });
            this.component.getContextMenu().hide();
        }
    };

    MenuItem item = new MenuItem("Download", command);
    return item;
}
项目:unitimes    文件:AriaSuggestBox.java   
public boolean selectItem(int index) {
    List<MenuItem> items = getItems();
    if (index > -1 && index < items.size()) {
        selectItem(items.get(index));
        iPopupScroll.ensureVisible(items.get(index));
        return true;
    }
    return false;
}