Java 类javafx.scene.control.SeparatorMenuItem 实例源码

项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void menuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem("Clear");
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void menuItemIconNoText() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");
        MenuItem clear = new MenuItem();
        clear.setGraphic(new ImageView(RFXTabPaneTest.imgURL.toString()));
        MenuItem exit = new MenuItem("Exit");
        menuFile.getItems().addAll(add, clear, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>middle", path.get(0));
}
项目:marathonv5    文件:RFXMenuItemTest.java   
@Test public void duplicateMenuPath() {
    List<String> path = new ArrayList<>();
    Platform.runLater(() -> {
        Menu menuFile = new Menu("File");
        MenuItem add = new MenuItem("Shuffle");

        MenuItem clear = new MenuItem("Clear");
        MenuItem clear1 = new MenuItem("Clear");
        MenuItem clear2 = new MenuItem("Clear");

        MenuItem exit = new MenuItem("Exit");

        menuFile.getItems().addAll(add, clear, clear1, clear2, new SeparatorMenuItem(), exit);
        RFXMenuItem rfxMenuItem = new RFXMenuItem(null, null);
        path.add(rfxMenuItem.getSelectedMenuPath(clear2));
    });
    new Wait("Waiting for menu selection path") {
        @Override public boolean until() {
            return path.size() > 0;
        }
    };
    AssertJUnit.assertEquals("File>>Clear(2)", path.get(0));
}
项目:ClassViewer    文件:FileTreeMenu.java   
public FileTreeMenu(FileTreeView view) {
    this.view = view;

    this.setOnShowing(event -> {
        Log.trace("Show Context Menu");
        FileTreeNode node = view.getSelected();
        if (node == null) {
            this.getItems().clear();
        } else {
            try {
                node.updateMenu(view.getViewer(), this);
            } catch (Exception e) {
                Log.error(e);
                ViewerAlert.exceptionAlert(e);
                this.getItems().clear();
            }
        }
    });

    this.getItems().add(new SeparatorMenuItem());
}
项目:MineIDE    文件:MenuManagement.java   
public void addMenu(final String name, final MenuCategory... menuCats)
{
    final Menu newItem = new MenuTranslate(name);

    // add menus
    for (final MenuCategory mc : menuCats)
        // check if category is not empty
        if (mc.getItems().size() > 0)
        {
            // add a separator
            if (newItem.getItems().size() != 0)
                newItem.getItems().add(new SeparatorMenuItem());
            // add all menu items
            newItem.getItems().addAll(mc.getItems());
        }

    this.listMenu.add(newItem);
    this.menu.getMenus().add(newItem);
}
项目:atbash-octopus    文件:ApplicationMenu.java   
public void initialize() {
    MenuBar menuBar = new MenuBar();
    // Make same width as the stage
    menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
    rootPane.setTop(menuBar);

    // File menu - new, save, exit
    Menu fileMenu = new Menu("File");
    MenuItem newMenuItem = createMenuItem("New", actionEvent -> this.onNewFile());

    MenuItem openMenuItem = createMenuItem("Open", actionEvent -> this.onOpenFile());

    MenuItem saveMenuItem = createMenuItem("Save", actionEvent -> this.onSaveFile());
    saveMenuItem.disableProperty().bind(jwkSetData.changedProperty().not());

    MenuItem exitMenuItem = createMenuItem("Exit", actionEvent -> Platform.exit());

    fileMenu.getItems().addAll(newMenuItem, openMenuItem, saveMenuItem,
            new SeparatorMenuItem(), exitMenuItem);

    menuBar.getMenus().addAll(fileMenu);
}
项目:SystemMonitorJFX    文件:MainStage.java   
private void initTableContextMenu() {
      TextField textField = new TextField("Type Something"); // we will add a popup menu to this text field
      contextMenu = new ContextMenu();

      MenuItem pauseP = new MenuItem("Stop process");
pauseP.setId("pausep");

MenuItem continueP = new MenuItem("Continue process");
continueP.setId("continuep");

MenuItem killP = new MenuItem("Kill process");
killP.setId("killp");

pauseP.setOnAction(actionEventHandler);
continueP.setOnAction(actionEventHandler);
killP.setOnAction(actionEventHandler);


      contextMenu.getItems().addAll(pauseP, continueP, new SeparatorMenuItem(), killP);
      // ...
      textField.setContextMenu(contextMenu);
  }
项目:gralog    文件:MainMenu.java   
private Menu createFileMenu() {
    Menu menuFile = new Menu("File");
    menuFileNew = new Menu("New");
    menuFileGenerators = new Menu("Generators");

    // "Save" is initially disabled because we do not have a structure.
    menuFileSave = createMenuItem("Save graph as...", handlers.onSave);
    menuFileSave.setDisable(true);
    menuFile.getItems().addAll(
        menuFileNew, menuFileGenerators,
        createMenuItem("Open graph...", handlers.onOpen),
        createMenuItem("Direct input...", handlers.onDirectInput),
        menuFileSave,
        new SeparatorMenuItem(),
        createMenuItem("Load plugin...", handlers.onLoadPlugin),
        new SeparatorMenuItem(),
        createMenuItem("Exit", handlers.onExit));

    return menuFile;
}
项目:fx-log    文件:MainController.java   
/**
 * Binds the recent files menu to the recent files in the config.
 */
private void configureRecentFilesMenu() {
    ListChangeListener<String> updateRecentFilesMenu = change -> {
        ObservableList<MenuItem> items = recentFilesMenu.getItems();
        items.clear();
        if (config.getState().getRecentFiles().isEmpty()) {
            MenuItem noItem = new MenuItem("No recent file");
            noItem.setDisable(true);
            items.add(noItem);
        } else {
            config.getState().getRecentFiles().stream().map(path -> {
                MenuItem menuItem = new MenuItem(path);
                menuItem.setOnAction(event -> openRecentFile(path));
                return menuItem;
            }).forEach(items::add);
            MenuItem sep = new SeparatorMenuItem();
            items.add(sep);
            MenuItem clearItem = new MenuItem("Clear recent files");
            clearItem.setOnAction(event -> config.getState().getRecentFiles().clear());
            items.add(clearItem);
        }
    };
    config.getState().getRecentFiles().addListener(updateRecentFilesMenu);
    // manual trigger the first time for initialization
    updateRecentFilesMenu.onChanged(null);
}
项目:openjfx-8u-dev-tests    文件:MenuItemTest.java   
protected void selectionCycle(boolean enabled, boolean event) {
    clearLastSelectedBtn.mouse().click();
    clearLastEventBtn.mouse().click();
    Wrap<? extends Menu> menu = menuBarLookup.lookup(new MenuByText(MenuItemApp.MIXED_ID)).wrap();
    Parent<MenuItem> menu_as_parent = menu.as(Parent.class, MenuItem.class);
    for (int i = 0; i < menu_as_parent.lookup().size(); i++) {
        menu_as_parent = menu.as(Parent.class, MenuItem.class);
        Wrap<? extends MenuItem> item_wrap = menu_as_parent.lookup().wrap(i);
        MenuItem item = item_wrap.getControl();
        if (SeparatorMenuItem.class.isInstance(item)) {
            continue;
        }
        expand(menu, true);
        item_wrap.mouse().click();
        lastSelected.waitProperty(Wrap.TEXT_PROP_NAME, enabled ? item.getId() : "");
        lastEvent.waitProperty(Wrap.TEXT_PROP_NAME, event ? item.getId() : "");
    }
}
项目:Simulizer    文件:MainMenuBar.java   
/**
 * Dynamically generates the Theme menu.
 *
 * @param menu
 *            The menu item to attach to
 * @return The completed menu
 */
private Menu themeMenu(Menu menu) {
    menu.getItems().clear();

    for (Theme t : wm.getThemes()) {
        MenuItem item = new MenuItem(t.getName());
        item.setOnAction(e -> wm.getThemes().setTheme(t));
        menu.getItems().add(item);
    }

    MenuItem reloadThemeItem = new MenuItem("Refresh Themes");
    reloadThemeItem.setOnAction(e -> {
        wm.getThemes().reload();
        themeMenu(menu);
        wm.getThemes().setTheme(wm.getThemes().getTheme());
    });

    menu.getItems().addAll(new SeparatorMenuItem(), reloadThemeItem);
    return menu;
}
项目:Simulizer    文件:MainMenuBar.java   
/**
 * Dynamically generates the windows menu items
 *
 * @param windowsMenu
 *            The windows menu to add the items to
 */
private void windowsMenuHelper(Menu windowsMenu) {
    windowsMenu.getItems().clear();
    for (WindowEnum wenum : WindowEnum.values()) {
        if (wenum.showInWindowsMenu()) {
            CheckMenuItem item = new CheckMenuItem(wenum.toString());
            item.setSelected(wm.getWorkspace().windowIsOpen(wenum));
            item.setOnAction(e -> {
                InternalWindow window = wm.getWorkspace().findInternalWindow(wenum);
                if (window == null)
                    wm.getWorkspace().openInternalWindow(wenum);
                else
                    window.close();
            });
            windowsMenu.getItems().add(item);
        }
    }

    MenuItem delWindows = new MenuItem("Close All");
    delWindows.setOnAction(e -> wm.getWorkspace().closeAll());
    windowsMenu.getItems().addAll(new SeparatorMenuItem(), delWindows);
}
项目:JttDesktop    文件:DualBuildWallContextMenu.java   
/**
 * Method to apply the functions available to the menu.
 */
private void applyControls() {
   rightWallControl = new MenuItem( HIDE_RIGHT );
   rightWallControl.setOnAction( event -> controlRightWall( display, rightWallControl ) );

   leftWallControl = new MenuItem( HIDE_LEFT );
   leftWallControl.setOnAction( event -> controlLeftWall( display, leftWallControl ) );

   imageFlasherControl = new MenuItem( CONFIGURE_IMAGE_FLASHER );
   imageFlasherControl.setOnAction( event -> display.showImageFlasherConfiguration() );

   MenuItem hideConfig = new MenuItem( HIDE_CONFIGURATION );
   hideConfig.setOnAction( event -> display.hideConfiguration() );

   getItems().addAll( 
         leftWallControl, 
         rightWallControl,
         new SeparatorMenuItem(),
         imageFlasherControl,
         hideConfig
   );
}
项目:JttDesktop    文件:EnvironmentMenuBar.java   
/**
 * Constructs a new {@link EnvironmentMenuBar}.
 * @param operatingSystem the {@link OperatingSystem} for enabling platform specific features.
 */
EnvironmentMenuBar( OperatingSystem operatingSystem ) {
   if ( operatingSystem.isMac() ) {
      setUseSystemMenuBar( true );
   }

   applicationMenu = new Menu( JENKINS_TEST_TRACKER_MENU );

   PreferencesOpenEvent preferenceOpener = new PreferencesOpenEvent();
   preferences = new MenuItem( PREFERENCES_MENU );
   preferences.setOnAction( event -> preferenceOpener.fire( 
            new Event<>( new PreferenceBehaviour( WindowPolicy.Open, null ) ) 
   ) );
   about = new MenuItem( ABOUT_MENU );
   about.setOnAction( event -> preferenceOpener.fire( 
            new Event<>( new PreferenceBehaviour( WindowPolicy.Open, ConfigurationTreeItems.SystemVersion ) ) 
   ) );
   applicationMenu.getItems().addAll( preferences, new SeparatorMenuItem(), about );

   getMenus().add( applicationMenu );
}
项目:slogo    文件:TurtleView.java   
private ContextMenu establishContextMenu () {
    ContextMenu context = new ContextMenu();
    MenuItem turtleStatus = new MenuItem(TURTLE_STATUS + id);
    SeparatorMenuItem separator = new SeparatorMenuItem();

    MenuItem visibility = new MenuItem(TOGGLE_VISIBILITY_PROMPT);
    visibility.setOnAction(e -> visibilityAction());

    MenuItem shape = new MenuItem(CHANGE_SHAPE_PROMPT);
    shape.setOnAction(e -> shapeAction());

    MenuItem color = new MenuItem(CHANGE_TURTLE_PEN_COLOR);
    color.setOnAction(e -> colorAction());

    MenuItem stamp = new MenuItem(STAMP);
    stamp.setOnAction(e -> writeToInternalEditor(new StringBuilder(idsToCommands.getString((STAMP)))));

    context.getItems().addAll(turtleStatus,
                              separator,
                              visibility,
                              color,
                              shape,
                              stamp);

    return context;
}
项目:qupath    文件:ScriptMenuLoader.java   
/**
 * Request that the contents of the menu be updated.
 */
public void updateMenu() {
    String scriptDir = scriptDirectory.get();
    if (scriptDir != null) {
        Path path = Paths.get(scriptDir);
        // Can only set script directory if we have a property, not just any obserable string
        if (scriptDirectory instanceof StringProperty)
            menu.getItems().setAll(miSetPath, miOpenDirectory, miCreateScript, new SeparatorMenuItem());
        else
            menu.getItems().setAll(miOpenDirectory, miCreateScript, new SeparatorMenuItem());
        if (path != null) {
            addMenuItemsForPath(menu, path, true);
        }
    } else if (scriptDirectory instanceof StringProperty)
        menu.getItems().setAll(miSetPath);
    else
        menu.getItems().clear();
}
项目:JVx.javafx    文件:JavaFXSeparator.java   
/**
 * Gets this separator as separator menu item.
 * 
 * @return this separator as separator menu item.
 */
public SeparatorMenuItem getAsMenuItem()
{
    if (separatorMenuItem == null)
    {
        separatorMenuItem = new JavaFXMenuBase<>(new SeparatorMenuItem());

        separatorMenuItem.setBackground(getBackground());
        separatorMenuItem.setCursor(getCursor());
        separatorMenuItem.setFont(getFont());
        separatorMenuItem.setForeground(getForeground());
        separatorMenuItem.setVisible(isVisible());
    }

    return (SeparatorMenuItem) separatorMenuItem.getResource();
}
项目:Cachoeira    文件:MainMenuBar.java   
private Menu createProjectMenu() {
    createProject = new MenuItem("Create");
    createProject.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.CONTROL_DOWN));
    openProject = new MenuItem("Open");
    openProject.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.CONTROL_DOWN));
    saveProject = new MenuItem("Save");
    saveProject.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.CONTROL_DOWN));
    saveAsProject = new MenuItem("Save as");
    saveAsProject.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHIFT_DOWN, KeyCombination.CONTROL_DOWN));
    Menu resourcesMenu = new Menu("Resources");
    exportResources = new MenuItem("Export");
    importResources = new MenuItem("Import");
    resourcesMenu.getItems().addAll(exportResources, importResources);
    exit = new MenuItem("Exit");
    Menu projectMenu = new Menu("Project");
    projectMenu.getItems().addAll(createProject, openProject, saveProject, saveAsProject, resourcesMenu, new SeparatorMenuItem(), exit);
    return projectMenu;
}
项目:Equi    文件:MainPanel.java   
public MainPanel(Stage owner) {
    GraphListPanel panel = new GraphListPanel();
    panel.setGraphProcessor(graph -> processSelectedGraph(graph, owner));

    MenuBar menuBar = new MenuBar();
    Menu fileMenu = new Menu("_File");
    fileMenu.getItems().addAll(
            panel.createMenuItemOpen(owner),
            new SeparatorMenuItem(),
            createMenuItemExit()
    );

    menuBar.getMenus().addAll(fileMenu);

    setTop(menuBar);
    setCenter(panel);
}
项目:jfx-torrent    文件:TorrentContentTreeRow.java   
public TorrentContentTreeRow(final FileTreeViewer fileTreeViewer) {
    this.fileTreeViewer = fileTreeViewer;

    for(int i = 0; i < priorityMenuItems.length; ++i) {
        priorityMenuItems[i].setId(String.valueOf(i));
        priorityMenuItems[i].setToggleGroup(radioMenuGroup);
    }

    priorityTreeMenu.getItems().addAll(priorityMenuItems[5], priorityMenuItems[4],
            priorityMenuItems[3], priorityMenuItems[2], priorityMenuItems[1],                         
            new SeparatorMenuItem(), priorityMenuItems[0]);
    contextMenu.getItems().addAll(selectMenuItem, unselectMenuItem, new SeparatorMenuItem(), 
            selectAllMenuItem, selectNoneMenuItem, new SeparatorMenuItem(), 
            collapseFolderTreeMenuItem, expandFolderTreeMenuItem, new SeparatorMenuItem(), 
            priorityTreeMenu);

       selectMenuItem.setOnAction(evt -> onSelectAction());
       unselectMenuItem.setOnAction(evt -> onUnselectAction());
       selectAllMenuItem.setOnAction(evt -> fileTreeViewer.selectAllEntries());
       selectNoneMenuItem.setOnAction(evt -> fileTreeViewer.deselectAllEntries());
}
项目:jfx-torrent    文件:ApplicationWindow.java   
private ContextMenu buildRemoveButtonContextMenu() {
    final ContextMenu removeOptionsMenu = new ContextMenu();

    final List<RadioMenuItem> removeOptionMenuItems = Arrays.asList(new RadioMenuItem[]{
            new RadioMenuItem("Remove"), new RadioMenuItem("Remove and delete .torrent"),
            new RadioMenuItem("Remove and delete .torrent + Data"),
            new RadioMenuItem("Remove and delete Data")});

    final ToggleGroup removeOptionsToggle = new ToggleGroup();
    removeOptionMenuItems.forEach(i -> i.setToggleGroup(removeOptionsToggle));
    removeOptionMenuItems.get(0).setSelected(true);

    removeOptionsMenu.getItems().addAll(removeOptionMenuItems);
    removeOptionsMenu.getItems().addAll(new SeparatorMenuItem(),
            new CheckMenuItem("Move to trash if possible"));

    return removeOptionsMenu;
}
项目:jfx-torrent    文件:PeerTable.java   
private void createContextMenu() {
    final ContextMenu contextMenu = new ContextMenu();
    contextMenu.getItems().addAll(addPeerMenuItem, new SeparatorMenuItem(), copyPeerListMenuItem,
            copySelectedHostsMenuItem, logTrafficToLoggerMenuItem, reloadIpFilterMenuItem,
            new SeparatorMenuItem(), resolveIpsMenuItem, wholePeerListMenuItem);

       peerTable.setContextMenu(contextMenu);
       peerTable.setRowFactory(table -> {
           final PeerTableRow peerTableRow = new PeerTableRow();
           peerTableRow.setOnContextMenuRequested(cme -> {
               final PeerView peerView = peerTableRow.getItem();
               if(peerView != null) {
                   logTrafficToLoggerMenuItem.setSelected(peerView.isLogTraffic());
                   logTrafficToLoggerMenuItem.setDisable(false);
                   logTrafficToLoggerMenuItem.setOnAction(event ->
                           peerView.setLogTraffic(logTrafficToLoggerMenuItem.isSelected()));
               }
               else {
                   logTrafficToLoggerMenuItem.setSelected(false);
                   logTrafficToLoggerMenuItem.setDisable(true);
               }
           });
           return peerTableRow;
       });
}
项目:properned    文件:MessageKeyListCell.java   
@Override
protected void updateItem(String messageKey, boolean empty) {
    super.updateItem(messageKey, empty);
    setGraphic(null);
    setText(null);
    if (messageKey != null) {
        setText(messageKey);

        MenuItem deleteMenu = getDeleteMenu(messageKey);
        MenuItem copyMenu = getCopyMenu(messageKey);

        this.setContextMenu(new ContextMenu(copyMenu,
                new SeparatorMenuItem(), deleteMenu));

        this.getListView().setOnKeyPressed(
                event -> {
                    if (event.getCode() == KeyCode.C
                            && event.isControlDown()) {
                        String selectedKey = getListView()
                                .getSelectionModel().getSelectedItem();
                        copy(selectedKey);
                    }
                });
    }
}
项目:EcoBuilder    文件:EcoBuilderMenu.java   
public EcoBuilderMenu(final EcoBuilder ecoBuilder) {
    Menu fileMenu = new Menu("File");
    Menu ermrMenu = new Menu("Repository");
    MenuItem saveScenario = new MenuItem("Generate Your Scenario Model");
    MenuItem saveDEM = new MenuItem("Generate DEM");
    MenuItem saveExamples = new MenuItem("Generate Examples");
    MenuItem openProject = new MenuItem("Open Project");
    MenuItem saveProject = new MenuItem("Save Project");
    MenuItem newProject = new MenuItem("New Project");
    MenuItem configure = new MenuItem("Configure");
    MenuItem send = new MenuItem("Send");
    saveDEM.setOnAction(e -> ecoBuilder.saveDEM());
    saveScenario.setOnAction(e -> ecoBuilder.saveScenario());
    saveExamples.setOnAction(e -> ecoBuilder.saveExamples());
    saveProject.setOnAction(e -> ecoBuilder.saveProject());
    openProject.setOnAction(e -> ecoBuilder.loadProject());
    newProject.setOnAction(e -> ecoBuilder.projectLoader.cleanModels());
    send.setOnAction(e -> ecoBuilder.sendToERMR());
    configure.setOnAction(e -> ecoBuilder.configuteERMR());
    fileMenu.getItems().addAll(saveScenario, saveDEM, saveExamples, new SeparatorMenuItem(), openProject, saveProject, newProject);
    ermrMenu.getItems().addAll(configure, send);
    getMenus().addAll(fileMenu, ermrMenu);
}
项目:jabref    文件:ProtectedTermsMenu.java   
public ProtectedTermsMenu(TextArea opener) {
    super(Localization.lang("Protect terms"));
    this.opener = opener;
    MenuItem protectItem = new MenuItem(Localization.lang("Add {} around selected text"));
    protectItem.setOnAction(event -> {
        String selectedText = opener.getSelectedText();
        if ((selectedText != null) && !selectedText.isEmpty()) {
            opener.replaceSelection("{" + selectedText + "}");
        }
    });

    MenuItem formatItem = new MenuItem(Localization.lang("Format field"));
    formatItem.setOnAction(event -> opener.setText(FORMATTER.format(opener.getText())));

    externalFiles = new Menu(Localization.lang("Add selected text to list"));
    updateFiles();

    this.getItems().add(protectItem);
    this.getItems().add(externalFiles);
    this.getItems().add(new SeparatorMenuItem());
    this.getItems().add(formatItem);
}
项目:jabref    文件:PreviewPanel.java   
private ContextMenu createPopupMenu() {
    MenuItem copyPreview = new MenuItem(Localization.lang("Copy preview"), IconTheme.JabRefIcon.COPY.getGraphicNode());
    copyPreview.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.COPY_PREVIEW));
    copyPreview.setOnAction(event -> copyPreviewToClipBoard());
    MenuItem printEntryPreview = new MenuItem(Localization.lang("Print entry preview"), IconTheme.JabRefIcon.PRINTED.getGraphicNode());
    printEntryPreview.setOnAction(event -> print());
    MenuItem previousPreviewLayout = new MenuItem(Localization.menuTitleFX("Previous preview layout"));
    previousPreviewLayout.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.PREVIOUS_PREVIEW_LAYOUT));
    previousPreviewLayout.setOnAction(event -> basePanel.ifPresent(BasePanel::previousPreviewStyle));
    MenuItem nextPreviewLayout = new MenuItem(Localization.menuTitleFX("Next preview layout"));
    nextPreviewLayout.setAccelerator(keyBindingRepository.getKeyCombination(KeyBinding.NEXT_PREVIEW_LAYOUT));
    nextPreviewLayout.setOnAction(event -> basePanel.ifPresent(BasePanel::nextPreviewStyle));

    ContextMenu menu = new ContextMenu();
    menu.getItems().add(copyPreview);
    menu.getItems().add(printEntryPreview);
    menu.getItems().add(new SeparatorMenuItem());
    menu.getItems().add(previousPreviewLayout);
    menu.getItems().add(nextPreviewLayout);
    return menu;
}
项目:pdfsam    文件:WorkspaceMenu.java   
@Inject
public WorkspaceMenu(RecentWorkspacesService service) {
    super(DefaultI18nContext.getInstance().i18n("_Workspace"));
    this.service = service;
    setId("workspaceMenu");
    MenuItem load = new MenuItem(DefaultI18nContext.getInstance().i18n("_Load"));
    load.setId("loadWorkspace");
    load.setOnAction(e -> loadWorkspace());
    MenuItem save = new MenuItem(DefaultI18nContext.getInstance().i18n("_Save"));
    save.setOnAction(e -> saveWorkspace());
    save.setId("saveWorkspace");
    recent = new Menu(DefaultI18nContext.getInstance().i18n("Recen_t"));
    recent.setId("recentWorkspace");
    service.getRecentlyUsedWorkspaces().stream().map(WorkspaceMenuItem::new).forEach(recent.getItems()::add);
    getItems().addAll(load, save, new SeparatorMenuItem(), recent);
    eventStudio().addAnnotatedListeners(this);
}
项目:pdfsam    文件:SelectionTable.java   
private void initTopSectionContextMenu(ContextMenu contextMenu, boolean hasRanges) {
    MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"),
            MaterialIcon.FLIGHT_LAND);
    setDestinationItem.setOnAction(e -> eventStudio().broadcast(
            requestDestination(getSelectionModel().getSelectedItem().descriptor().getFile(), getOwnerModule()),
            getOwnerModule()));
    setDestinationItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.ALT_DOWN));

    selectionChangedConsumer = e -> setDestinationItem.setDisable(!e.isSingleSelection());
    contextMenu.getItems().add(setDestinationItem);

    if (hasRanges) {
        MenuItem setPageRangesItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set as range for all"),
                MaterialIcon.TOC);
        setPageRangesItem.setOnAction(e -> eventStudio().broadcast(
                new SetPageRangesRequest(getSelectionModel().getSelectedItem().pageSelection.get()),
                getOwnerModule()));
        setPageRangesItem.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN));
        selectionChangedConsumer = selectionChangedConsumer
                .andThen(e -> setPageRangesItem.setDisable(!e.isSingleSelection()));
        contextMenu.getItems().add(setPageRangesItem);
    }
    contextMenu.getItems().add(new SeparatorMenuItem());
}
项目:pdfsam    文件:SingleSelectionPaneTest.java   
@Test
public void invalidatedDescriptorDoesntTriggerAnything() throws Exception {
    typePathAndValidate();
    typePathAndValidate("/this/doesnt/exists");
    SingleSelectionPane victim = find("#victim-selection-pane");
    FXTestUtils.invokeAndWait(() -> {
        victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.REQUESTED);
        victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADING);
        victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADED);
    }, 2);
    Label details = find(".-pdfsam-selection-details");
    assertTrue(isEmpty(details.getText()));
    Label encStatus = find(".encryption-status");
    assertTrue(isEmpty(encStatus.getText()));
    ValidableTextField field = find(".validable-container-field");
    field.getContextMenu().getItems().parallelStream().filter(i -> !(i instanceof SeparatorMenuItem))
            .filter(i -> !i.getText().equals(DefaultI18nContext.getInstance().i18n("Remove")))
            .forEach(i -> assertTrue(i.isDisable()));
}
项目:jvarkit    文件:JfxNgs.java   
List<MenuItem> createCommonMenuItems(final Stage stage) {
final List<MenuItem> L=new ArrayList<>();
L.add(createMenuItem("About...",()->doMenuAbout(stage)));
L.add(createMenuItem("Preferences...",()->showPreferencesDialog(stage)));
L.add(createMenuItem("Open in Microsoft Excel...",()->doMenuOpenInExcel(stage)));
   L.add(new SeparatorMenuItem());
L.add(createMenuItem("Open VCF/BAM File...",()->openNgsFile(stage)));
   L.add(createMenuItem("Open Remote BAM...",()->openBamUrl(stage)));
   L.add(createMenuItem("Open Remote VCF...",()->openVcfUrl(stage)));
   L.add(new SeparatorMenuItem());
   L.add(createMenuItem("Tool: index BAM file...",()->doMenuIndexBam(stage)));
   L.add(createMenuItem("Tool: index VCF file...",()->doMenuIndexVcf(stage)));
   L.add(new SeparatorMenuItem());
   L.add(createMenuItem("Close",()->stage.hide()));
   return L;
}
项目:jvarkit    文件:VcfStage.java   
@Override
protected Menu createJavascriptSnippetMenu() {
    final Menu menu = super.createJavascriptSnippetMenu();
    menu.getItems().add(new SeparatorMenuItem());

    MenuItem item= new MenuItem("Insert Samples' name as Array");
    menu.getItems().add(item);
    item.setOnAction(AE->{
        final int caret = super.javascriptArea.getCaretPosition();
        final StringBuilder sb=new StringBuilder("var sampleNames=[").
                append(getVcfFile().getHeader().getSampleNamesInOrder().stream().map(S->"\""+S+"\"").collect(Collectors.joining(","))).
                append("];\n")
                ;
        super.javascriptArea.insertText(caret, sb.toString());
        });

    return menu;
    }
项目:titanium    文件:MainPane.java   
private Menu getServerMenu() {
    Menu result = new Menu("Servers");
    MenuItem addServerItem = new MenuItem("Add a server...", AssetsLoader.getIcon("new_icon.png"));
    MenuItem removeCrtServerItem = new MenuItem("Remove current server", AssetsLoader.getIcon("delete_icon.png"));
    MenuItem connectToAll = new MenuItem("Connect all", AssetsLoader.getIcon("connect.png"));
    MenuItem disconnectAllItem = new MenuItem("Disconnect all", AssetsLoader.getIcon("disconnect.png"));
    MenuItem quitItem = new MenuItem("Quit", AssetsLoader.getIcon("quit_icon.png"));



    addServerItem.setOnAction(this::addServerAction);
    removeCrtServerItem.setOnAction(this::removeServerAction);
    connectToAll.setOnAction(this::connectToAllAction);
    disconnectAllItem.setOnAction(this::disconnectFromAll);
    quitItem.setOnAction(this::quitAction);

    result.getItems().addAll(addServerItem, removeCrtServerItem);
    result.getItems().add(new SeparatorMenuItem());
    result.getItems().addAll(connectToAll, disconnectAllItem);
    result.getItems().add(new SeparatorMenuItem());
    result.getItems().addAll(quitItem);

    cam.getNotConnectedRequiredMenuItems().add(removeCrtServerItem);


    return result;
}
项目:fx-media-tags    文件:FxMediaTags.java   
private ContextMenu createContextMenu() {
    final ContextMenu contextMenu = new ContextMenu();
    final ObservableList<MenuItem> menuItems = contextMenu.getItems();
    menuItems.add(createMenuAdd());
    menuItems.add(createMenuDelete());
    menuItems.add(createMenuRename());
    menuItems.add(new SeparatorMenuItem());
    menuItems.add(new MenuItem("Cancel"));
    return contextMenu;
}
项目:marathonv5    文件:TabDockingContainer.java   
private void populateMenuItems(ContextMenu contextMenu, Tab tab) {
    int tabCount = getTabs().size();
    int tabIndex = getTabs().indexOf(tab);
    ObservableList<MenuItem> items = contextMenu.getItems();
    items.clear();
    MenuItem closeMenuItem = new MenuItem("Close");
    closeMenuItem.setOnAction((e) -> requestClose(tab));
    items.add(closeMenuItem);
    if (tabCount > 1) {
        MenuItem closeRestMenuItem = new MenuItem("Close Others");
        closeRestMenuItem.setOnAction((e) -> closeOtherTabs(tab));
        items.add(closeRestMenuItem);
    }
    if (tabCount > 1 && tabIndex != 0) {
        MenuItem closeLeftTabsMenuItem = new MenuItem("Close Tabs to the Left");
        closeLeftTabsMenuItem.setOnAction((e) -> closeTabsToLeft(tab));
        items.add(closeLeftTabsMenuItem);
    }
    if (tabCount > 1 && tabIndex != tabCount - 1) {
        MenuItem closeRigthTabsMenuItem = new MenuItem("Close Tabs to the Right");
        closeRigthTabsMenuItem.setOnAction((e) -> closeTabsToRight(tab));
        items.add(closeRigthTabsMenuItem);
    }
    if (tabCount > 1) {
        MenuItem closeAllMenuItem = new MenuItem("Close All");
        closeAllMenuItem.setOnAction((e) -> closeAllTabs());
        items.addAll(new SeparatorMenuItem(), closeAllMenuItem);
    }
}
项目:marathonv5    文件:TestRunner.java   
private void populateMenuItems() {
    historyMenuItems.clear();
    populateSavedHistory(TestRunnerHistory.getInstance().getHistory("favourites"));
    populateUnSavedHistory(TestRunnerHistory.getInstance().getHistory("unsaved"));
    if (historyMenuItems.size() > 0) {
        historyMenuItems.add(new SeparatorMenuItem());
    }
    historyMenuItems.add(manageHistoryAction.getMenuItem());
}
项目:marathonv5    文件:TestRunner.java   
private void populateUnSavedHistory(JSONArray unsavedHistory) {
    if (unsavedHistory.length() > 0 && historyMenuItems.size() > 0) {
        historyMenuItems.add(new SeparatorMenuItem());
    }
    ArrayList<MenuItem> items = new ArrayList<>();
    for (int i = 0; i < unsavedHistory.length(); i++) {
        JSONObject testJSON = unsavedHistory.getJSONObject(i);
        MenuItem item = createMenuItem(testJSON, false);
        item.setGraphic(getIcon(State.valueOf(testJSON.getString("state"))));
        items.add(0, item);
    }
    historyMenuItems.addAll(items);
}
项目:marathonv5    文件:JavaFXMenuBarElement.java   
private void getChidernMenuItem(Menu parentMenu, String items, List<MenuItem> menuItems) {
    ObservableList<MenuItem> children = parentMenu.getItems();
    for (MenuItem menuItem : children) {
        if (menuItem instanceof Menu) {
            getChidernMenuItem((Menu) menuItem, items, menuItems);
        }
        if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem, menuItem.getParentMenu()).equals(items)) {
            menuItems.add(menuItem);
            break;
        }
    }
}
项目:marathonv5    文件:JavaFXContextMenuElement.java   
private void getChidernMenuItem(ObservableList<MenuItem> children, String items, List<MenuItem> menuItems) {
    for (MenuItem menuItem : children) {
        if (menuItem instanceof Menu) {
            getChidernMenuItem(((Menu) menuItem).getItems(), items, menuItems);
        }
        if (!(menuItem instanceof SeparatorMenuItem) && getTextForMenuItem(menuItem).equals(items)) {
            menuItems.add(menuItem);
            break;
        }
    }
}
项目:ClassViewer    文件:FileTreeNode.java   
public void setClassFileMenu(Viewer viewer, ContextMenu menu) {
    menu.getItems().clear();
    menu.getItems().addAll(
            copyPathMenu(),
            new SeparatorMenuItem(),
            openInNewTabMenu(viewer),
            openInNewWindowMenu(viewer)
    );
}
项目:MineIDE    文件:TabHelper.java   
public static List<MenuItem> getContextMenu(final Tab tab, final int posTab)
{
    final MenuItem close = new MenuItemTranslate("menu.tab.item.close");
    final MenuItem closeOther = new MenuItemTranslate("menu.tab.item.closeOther");
    final MenuItem closeLeft = new MenuItemTranslate("menu.tab.item.closeLeft");
    final MenuItem closeRight = new MenuItemTranslate("menu.tab.item.closeRight");
    final MenuItem closeAll = new MenuItemTranslate("menu.tab.item.closeAll");

    close.setId("close");
    closeOther.setId("close_other");
    closeLeft.setId("close_left");
    closeRight.setId("close_right");
    closeAll.setId("close_all");

    final ArrayList<MenuItem> item = new ArrayList<>();

    item.add(close);

    if (tab.getTabPane().getTabs().size() > 1)
    {
        item.add(closeOther);

        if (posTab != 0)
            item.add(closeLeft);
        if (posTab != tab.getTabPane().getTabs().size() - 1)
            item.add(closeRight);

        item.add(new SeparatorMenuItem());
        item.add(closeAll);
    }

    return item;
}