javafx.scene.control.SeparatorMenuItem Java Examples
The following examples show how to use
javafx.scene.control.SeparatorMenuItem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenLabeler.java From OpenLabeler with Apache License 2.0 | 6 votes |
private void initOSMac(ResourceBundle bundle) { MenuToolkit tk = MenuToolkit.toolkit(); String appName = bundle.getString("app.name"); Menu appMenu = new Menu(appName); // Name for appMenu can't be set at Runtime MenuItem aboutItem = tk.createAboutMenuItem(appName, createAboutStage(bundle)); MenuItem prefsItem = new MenuItem(bundle.getString("menu.preferences")); prefsItem.acceleratorProperty().set(new KeyCodeCombination(KeyCode.COMMA, KeyCombination.SHORTCUT_DOWN)); prefsItem.setOnAction(event -> new PreferencePane().showAndWait()); appMenu.getItems().addAll(aboutItem, new SeparatorMenuItem(), prefsItem, new SeparatorMenuItem(), tk.createHideMenuItem(appName), tk.createHideOthersMenuItem(), tk.createUnhideAllMenuItem(), new SeparatorMenuItem(), tk.createQuitMenuItem(appName)); Menu windowMenu = new Menu(bundle.getString("menu.window")); windowMenu.getItems().addAll(tk.createMinimizeMenuItem(), tk.createZoomMenuItem(), tk.createCycleWindowsItem(), new SeparatorMenuItem(), tk.createBringAllToFrontItem()); // Update the existing Application menu tk.setForceQuitOnCmdQ(false); tk.setApplicationMenu(appMenu); }
Example #2
Source File: FXTree.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void createContextMenu() { final ContextMenu menu = new ContextMenu(); tree_view.setOnContextMenuRequested(event -> { menu.getItems().clear(); if (ContextMenuHelper.addSupportedEntries(tree_view, menu)) menu.getItems().add(new SeparatorMenuItem()); menu.getItems().add(new PrintAction(tree_view)); menu.getItems().add(new SaveSnapshotAction(tree_view)); menu.getItems().add(new SendEmailAction(tree_view, "PV Snapshot", () -> "See attached screenshot.", () -> Screenshot.imageFromNode(tree_view))); menu.getItems().add(new SendLogbookAction(tree_view, "PV Snapshot", () -> "See attached screenshot.", () -> Screenshot.imageFromNode(tree_view))); menu.show(tree_view.getScene().getWindow(), event.getScreenX(), event.getScreenY()); }); tree_view.setContextMenu(menu); }
Example #3
Source File: WaveformView.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void createContextMenu() { final ContextMenu menu = new ContextMenu(); plot.setOnContextMenuRequested(event -> { menu.getItems().setAll(new ToggleToolbarMenuItem(plot)); final List<Trace<Double>> traces = new ArrayList<>(); plot.getTraces().forEach(traces::add); if (! traces.isEmpty()) menu.getItems().add(new ToggleLinesMenuItem(plot, traces)); menu.getItems().addAll(new SeparatorMenuItem(), new PrintAction(plot), new SaveSnapshotAction(plot)); menu.show(getScene().getWindow(), event.getScreenX(), event.getScreenY()); }); }
Example #4
Source File: SearchView.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private void updateContextMenu(final ContextMenuEvent event) { final ContextMenu menu = channel_table.getContextMenu(); final List<ChannelInfo> selection = channel_table.getSelectionModel().getSelectedItems(); if (selection.isEmpty()) menu.getItems().clear(); else { menu.getItems().setAll(new AddToPlotAction(channel_table, model, undo, selection), new SeparatorMenuItem()); SelectionService.getInstance().setSelection(channel_table, selection); ContextMenuHelper.addSupportedEntries(channel_table, menu); menu.show(channel_table.getScene().getWindow(), event.getScreenX(), event.getScreenY()); } }
Example #5
Source File: Menu.java From DeskChan with GNU Lesser General Public License v3.0 | 6 votes |
protected synchronized void updateImpl(){ ObservableList<javafx.scene.control.MenuItem> contextMenuItems = contextMenu.getItems(); contextMenuItems.clear(); javafx.scene.control.MenuItem item = new javafx.scene.control.MenuItem(Main.getString("options")); item.setOnAction(optionsMenuItemAction); contextMenuItems.add(item); item = new javafx.scene.control.MenuItem(Main.getString("send-top")); item.setOnAction(frontMenuItemAction); contextMenuItems.add(item); contextMenuItems.add(new SeparatorMenuItem()); for(PluginMenuItem it : menuItems){ contextMenuItems.add(it.getJavaFXItem()); } contextMenuItems.add(new SeparatorMenuItem()); item = new javafx.scene.control.MenuItem(Main.getString("quit")); item.setOnAction(quitMenuItemAction); contextMenuItems.add(item); }
Example #6
Source File: RFXMenuItemTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@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)); }
Example #7
Source File: RFXMenuItemTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@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)); }
Example #8
Source File: RFXMenuItemTest.java From marathonv5 with Apache License 2.0 | 6 votes |
@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)); }
Example #9
Source File: ChartContainerController.java From trex-stateless-gui with Apache License 2.0 | 6 votes |
public ChartContainerController(String selectedType, IntegerProperty interval) { Initialization.initializeFXML(this, "/fxml/dashboard/charts/ChartContainer.fxml"); this.interval = interval; chartType = new SimpleStringProperty(); chartType.addListener(this::handleChartTypeChanged); chartType.set(selectedType); contextMenu = new ContextMenu(); contextMenu.getItems().addAll( createContextMenuItem(ChartsFactory.ChartTypes.TX_PPS), createContextMenuItem(ChartsFactory.ChartTypes.RX_PPS), createContextMenuItem(ChartsFactory.ChartTypes.TX_BPS_L1), createContextMenuItem(ChartsFactory.ChartTypes.TX_BPS_L2), createContextMenuItem(ChartsFactory.ChartTypes.RX_BPS_L2), createContextMenuItem(ChartsFactory.ChartTypes.PACKET_LOSS), new SeparatorMenuItem(), createContextMenuItem(ChartsFactory.ChartTypes.MAX_LATENCY, runningConfiguration.latencyEnabledProperty()), createContextMenuItem(ChartsFactory.ChartTypes.AVG_LATENCY, runningConfiguration.latencyEnabledProperty()), createContextMenuItem(ChartsFactory.ChartTypes.JITTER_LATENCY, runningConfiguration.latencyEnabledProperty()), createContextMenuItem(ChartsFactory.ChartTypes.TEMPORARY_MAX_LATENCY, runningConfiguration.latencyEnabledProperty()), createContextMenuItem(ChartsFactory.ChartTypes.LATENCY_HISTOGRAM, runningConfiguration.latencyEnabledProperty()) ); }
Example #10
Source File: MyBoxController.java From MyBox with Apache License 2.0 | 6 votes |
@FXML private void showRecentMenu(MouseEvent event) { hideMenu(event); popMenu = new ContextMenu(); popMenu.setAutoHide(true); popMenu.getItems().addAll(getRecentMenu()); popMenu.getItems().add(new SeparatorMenuItem()); MenuItem closeMenu = new MenuItem(message("MenuClose")); closeMenu.setStyle("-fx-text-fill: #2e598a;"); closeMenu.setOnAction((ActionEvent cevent) -> { popMenu.hide(); popMenu = null; }); popMenu.getItems().add(closeMenu); showMenu(recentBox, event); view.setImage(new Image("img/RecentAccess.png")); text.setText(message("RecentAccessImageTips")); locateImage(recentBox, true); }
Example #11
Source File: AppContextMenu.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@Inject AppContextMenu(WorkspaceMenu workspace, ModulesMenu modulesMenu) { MenuItem exit = new MenuItem(DefaultI18nContext.getInstance().i18n("E_xit")); exit.setOnAction(e -> Platform.exit()); exit.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN)); getItems().addAll(workspace, modulesMenu); if (!Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS_DEPRECATED) && !Boolean.getBoolean(PreferencesDashboardItem.PDFSAM_DISABLE_SETTINGS)) { MenuItem settings = new MenuItem(DefaultI18nContext.getInstance().i18n("_Settings")); settings.setOnAction( e -> eventStudio().broadcast(new SetActiveDashboardItemRequest(PreferencesDashboardItem.ID))); getItems().add(settings); } getItems().addAll(new SeparatorMenuItem(), exit); }
Example #12
Source File: SingleSelectionPaneTest.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@Test public void invalidatedDescriptorDoesntTriggerAnything() throws Exception { typePathAndValidate(); typePathAndValidate("/this/doesnt/exists"); WaitForAsyncUtils.waitForAsyncFx(2000, () -> { victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.REQUESTED); victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADING); victim.getPdfDocumentDescriptor().moveStatusTo(PdfDescriptorLoadingStatus.LOADED); }); Labeled details = lookup(".-pdfsam-selection-details").queryLabeled(); assertTrue(isEmpty(details.getText())); Labeled encStatus = lookup(".encryption-status").queryLabeled(); assertTrue(isEmpty(encStatus.getText())); var field = lookup(".validable-container-field").queryAs(ValidableTextField.class); field.getContextMenu().getItems().parallelStream().filter(i -> !(i instanceof SeparatorMenuItem)) .filter(i -> !i.getText().equals(DefaultI18nContext.getInstance().i18n("Remove"))) .forEach(i -> assertTrue(i.isDisable())); }
Example #13
Source File: WorkspaceMenu.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
@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_ts")); recent.setId("recentWorkspace"); service.getRecentlyUsedWorkspaces().stream().map(WorkspaceMenuItem::new).forEach(recent.getItems()::add); MenuItem clear = new MenuItem(DefaultI18nContext.getInstance().i18n("_Clear recents")); clear.setOnAction(e -> clearWorkspaces()); clear.setId("clearWorkspaces"); getItems().addAll(load, save, new SeparatorMenuItem(), recent, clear); eventStudio().addAnnotatedListeners(this); }
Example #14
Source File: SelectionTable.java From pdfsam with GNU Affero General Public License v3.0 | 6 votes |
private void initTopSectionContextMenu(ContextMenu contextMenu, boolean hasRanges) { MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"), MaterialDesignIcon.AIRPLANE_LANDING); 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"), MaterialDesignIcon.FORMAT_INDENT_INCREASE); 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()); }
Example #15
Source File: ConsolePane.java From xframium-java with GNU General Public License v3.0 | 5 votes |
private Menu getCommandsMenu () { Menu menuCommands = new Menu ("Commands"); MenuItem menuItemToggleScreens = getMenuItem ("Screen history", e -> toggleHistory (), KeyCode.S); menuItemAssistant = getMenuItem ("Transfers", e -> screen.getAssistantStage ().show (), KeyCode.T); menuItemConsoleLog = getMenuItem ("Console log", e -> screen.getConsoleLogStage ().show (), KeyCode.L); setIsConsole (false); menuCommands.getItems ().addAll (menuItemToggleScreens, menuItemAssistant, menuItemConsoleLog, new SeparatorMenuItem (), screen.getMenuItemUpload (), screen.getMenuItemDownload ()); if (!SYSTEM_MENUBAR) { MenuItem quitMenuItem = new MenuItem ("Quit"); menuCommands.getItems ().addAll (new SeparatorMenuItem (), quitMenuItem); quitMenuItem.setOnAction (e -> Platform.exit ()); quitMenuItem.setAccelerator (new KeyCodeCombination (KeyCode.Q, KeyCombination.SHORTCUT_DOWN)); } return menuCommands; }
Example #16
Source File: GUI.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private void createContextMenu() { // Create menu with dummy entry (otherwise it won't show up) final ContextMenu menu = new ContextMenu(new MenuItem()); // Update menu based on selection menu.setOnShowing(event -> { // Get selected Cells and their PV names final List<Cell> cells = new ArrayList<>(); final List<ProcessVariable> pvnames = new ArrayList<>(); final List<Instance> rows = table.getItems(); for (TablePosition<?, ?> sel : table.getSelectionModel().getSelectedCells()) { final Cell cell = rows.get(sel.getRow()).getCell(sel.getColumn()-1); cells.add(cell); pvnames.add(new ProcessVariable(cell.getName())); } // Update menu final ObservableList<MenuItem> items = menu.getItems(); items.clear(); items.add(new RestoreCellValues(cells)); items.add(new SetCellValues(table, cells)); // Add PV name entries if (pvnames.size() > 0) { items.add(new SeparatorMenuItem()); SelectionService.getInstance().setSelection("AlarmUI", pvnames); ContextMenuHelper.addSupportedEntries(table, menu); } }); table.setContextMenu(menu); }
Example #17
Source File: AlarmTableUI.java From phoebus with Eclipse Public License 1.0 | 5 votes |
private void createContextMenu(final TableView<AlarmInfoRow> table, final boolean active) { final ContextMenu menu = new ContextMenu(); table.setOnContextMenuRequested(event -> { final ObservableList<MenuItem> menu_items = menu.getItems(); menu_items.clear(); final List<AlarmTreeItem<?>> selection = new ArrayList<>(); for (AlarmInfoRow row : table.getSelectionModel().getSelectedItems()) selection.add(row.item); // Add guidance etc. new AlarmContextMenuHelper().addSupportedEntries(table, client, menu, selection); if (menu_items.size() > 0) menu_items.add(new SeparatorMenuItem()); if (AlarmUI.mayConfigure(client) && selection.size() == 1) { menu_items.add(new ConfigureComponentAction(table, client, selection.get(0))); menu_items.add(new SeparatorMenuItem()); } menu_items.add(new PrintAction(this)); menu_items.add(new SaveSnapshotAction(table)); menu_items.add(new SendEmailAction(table, "Alarm Snapshot", this::list_alarms, () -> Screenshot.imageFromNode(this))); menu_items.add(new SendLogbookAction(table, "Alarm Snapshot", this::list_alarms, () -> Screenshot.imageFromNode(this))); menu.show(table.getScene().getWindow(), event.getScreenX(), event.getScreenY()); }); }
Example #18
Source File: Main.java From sis with Apache License 2.0 | 5 votes |
/** * Invoked by JavaFX for starting the application. * This method is called on the JavaFX Application Thread. * * @param window the primary stage onto which the application scene will be be set. */ @Override public void start(final Stage window) { this.window = window; final Vocabulary vocabulary = Vocabulary.getResources((Locale) null); /* * Configure the menu bar. For most menu item, the action is to invoke a method * of the same name in this application class (e.g. open()). */ final MenuBar menus = new MenuBar(); final Menu file = new Menu(vocabulary.getString(Vocabulary.Keys.File)); { final MenuItem open = new MenuItem(vocabulary.getMenuLabel(Vocabulary.Keys.Open)); open.setAccelerator(KeyCombination.keyCombination("Shortcut+O")); open.setOnAction(e -> open()); final MenuItem exit = new MenuItem(vocabulary.getString(Vocabulary.Keys.Exit)); exit.setOnAction(e -> Platform.exit()); file.getItems().addAll(open, new SeparatorMenuItem(), exit); } menus.getMenus().add(file); /* * Set the main content and show. */ content = new ResourceView(); final BorderPane pane = new BorderPane(); pane.setTop(menus); pane.setCenter(content.pane); Scene scene = new Scene(pane); window.setTitle("Apache Spatial Information System"); window.setScene(scene); window.setWidth(800); window.setHeight(650); window.show(); }
Example #19
Source File: TagBoard.java From OpenLabeler with Apache License 2.0 | 5 votes |
private void onContextMenuEvent(ContextMenuEvent event) { ObjectTag selected = selectedObjectProperty.get(); if (selected == null) { return; } contextMenu = new ContextMenu(); for (int i = 0; i < 10 && i < Settings.recentNamesProperty.size(); i++) { NameColor nameColor = Settings.recentNamesProperty.get(i); String name = nameColor.getName(); if (name.isEmpty() || name.isBlank()) { continue; } MenuItem mi = new MenuItem(name); mi.setOnAction(value -> { selected.nameProperty().set(name); Settings.recentNamesProperty.addName(name); }); contextMenu.getItems().add(mi); } if (!contextMenu.getItems().isEmpty()) { contextMenu.getItems().add(new SeparatorMenuItem()); } MenuItem editName = new MenuItem(bundle.getString("menu.editName")); editName.setOnAction(value -> { NameEditor editor = new NameEditor(selected.nameProperty().get()); String label = editor.showPopup(event.getScreenX(), event.getScreenY(), getScene().getWindow()); selected.nameProperty().set(label); Settings.recentNamesProperty.addName(label); }); MenuItem delete = new MenuItem(bundle.getString("menu.delete")); delete.setOnAction(value -> deleteSelected(bundle.getString("menu.delete"))); contextMenu.getItems().addAll(editName, delete); contextMenu.setAutoHide(true); contextMenu.show(imageView, event.getScreenX(), event.getScreenY()); event.consume(); }
Example #20
Source File: SingleSelectionPaneTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Test public void disableMenuOnSwitchToInvalid() throws Exception { typePathAndValidate(); typePathAndValidate("/this/doesnt/exists"); ValidableTextField victim = lookup(".validable-container-field").queryAs(ValidableTextField.class); victim.getContextMenu().getItems().parallelStream().filter(i -> !(i instanceof SeparatorMenuItem)) .filter(i -> !i.getText().equals(DefaultI18nContext.getInstance().i18n("Remove"))) .forEach(i -> assertTrue(i.isDisable())); }
Example #21
Source File: SingleSelectionPaneTest.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
@Test public void disableMenuOnInvalid() { typePathAndValidate("/this/doesnt/exists"); ValidableTextField victim = lookup(".validable-container-field").queryAs(ValidableTextField.class); victim.getContextMenu().getItems().parallelStream().filter(i -> !(i instanceof SeparatorMenuItem)) .filter(i -> !i.getText().equals(DefaultI18nContext.getInstance().i18n("Remove"))) .forEach(i -> assertTrue(i.getText(), i.isDisable())); }
Example #22
Source File: SelectionTable.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
private void initBottomSectionContextMenu(ContextMenu contextMenu) { MenuItem copyItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Copy to clipboard"), MaterialDesignIcon.CONTENT_COPY); copyItem.setOnAction(e -> copySelectedToClipboard()); MenuItem infoItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Document properties"), MaterialDesignIcon.INFORMATION_OUTLINE); infoItem.setOnAction(e -> Platform.runLater(() -> eventStudio() .broadcast(new ShowPdfDescriptorRequest(getSelectionModel().getSelectedItem().descriptor())))); MenuItem openFileItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open"), MaterialDesignIcon.FILE_PDF_BOX); openFileItem.setOnAction(e -> eventStudio() .broadcast(new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile()))); MenuItem openFolderItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open Folder"), MaterialDesignIcon.FOLDER_OUTLINE); openFolderItem.setOnAction(e -> eventStudio().broadcast( new OpenFileRequest(getSelectionModel().getSelectedItem().descriptor().getFile().getParentFile()))); copyItem.setAccelerator(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN)); infoItem.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN)); openFileItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN)); openFolderItem.setAccelerator( new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN, KeyCombination.ALT_DOWN)); contextMenu.getItems().addAll(new SeparatorMenuItem(), copyItem, infoItem, openFileItem, openFolderItem); selectionChangedConsumer = selectionChangedConsumer.andThen(e -> { copyItem.setDisable(e.isClearSelection()); infoItem.setDisable(!e.isSingleSelection()); openFileItem.setDisable(!e.isSingleSelection()); openFolderItem.setDisable(!e.isSingleSelection()); }); }
Example #23
Source File: PluginsStage.java From xframium-java with GNU General Public License v3.0 | 5 votes |
private void rebuildMenu () { ObservableList<MenuItem> items = menu.getItems (); while (items.size () > baseMenuSize) items.remove (menu.getItems ().size () - 1); menu.getItems ().add (new SeparatorMenuItem ()); for (PluginEntry pluginEntry : plugins) if (pluginEntry.isActivated && pluginEntry.requestMenuItem != null) items.add (pluginEntry.requestMenuItem); }
Example #24
Source File: SingleSelectionPane.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
private void initContextMenu() { MenuItem infoItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Document properties"), MaterialDesignIcon.INFORMATION_OUTLINE); infoItem.setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.ALT_DOWN)); infoItem.setOnAction( e -> Platform.runLater(() -> eventStudio().broadcast(new ShowPdfDescriptorRequest(descriptor)))); removeSelected = createMenuItem(DefaultI18nContext.getInstance().i18n("Remove"), MaterialDesignIcon.MINUS); removeSelected.setOnAction(e -> eventStudio().broadcast(new ClearModuleEvent(), getOwnerModule())); MenuItem setDestinationItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Set destination"), MaterialDesignIcon.AIRPLANE_LANDING); setDestinationItem.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.ALT_DOWN)); setDestinationItem.setOnAction(e -> eventStudio() .broadcast(requestDestination(descriptor.getFile(), getOwnerModule()), getOwnerModule())); MenuItem openFileItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open"), MaterialDesignIcon.FILE_PDF_BOX); openFileItem.setOnAction(e -> eventStudio().broadcast(new OpenFileRequest(descriptor.getFile()))); MenuItem openFolderItem = createMenuItem(DefaultI18nContext.getInstance().i18n("Open Folder"), MaterialDesignIcon.FOLDER_OUTLINE); openFolderItem .setOnAction(e -> eventStudio().broadcast(new OpenFileRequest(descriptor.getFile().getParentFile()))); field.getTextField().setContextMenu(new ContextMenu(setDestinationItem, new SeparatorMenuItem(), removeSelected, new SeparatorMenuItem(), infoItem, openFileItem, openFolderItem)); }
Example #25
Source File: EditorFrame.java From JetUML with GNU General Public License v3.0 | 5 votes |
private void createFileMenu(MenuBar pMenuBar, List<NewDiagramHandler> pNewDiagramHandlers) { MenuFactory factory = new MenuFactory(RESOURCES); // Special menu items whose creation can't be inlined in the factory call. Menu newMenu = factory.createMenu("file.new", false); for( NewDiagramHandler handler : pNewDiagramHandlers ) { newMenu.getItems().add(factory.createMenuItem(handler.getDiagramType().getName().toLowerCase(), false, handler)); } aRecentFilesMenu = factory.createMenu("file.recent", false); buildRecentFilesMenu(); // Standard factory invocation pMenuBar.getMenus().add(factory.createMenu("file", false, newMenu, factory.createMenuItem("file.open", false, event -> openFile()), aRecentFilesMenu, factory.createMenuItem("file.close", true, event -> close()), factory.createMenuItem("file.save", true, event -> save()), factory.createMenuItem("file.save_as", true, event -> saveAs()), factory.createMenuItem("file.duplicate", true, event -> duplicate()), factory.createMenuItem("file.export_image", true, event -> exportImage()), factory.createMenuItem("file.copy_to_clipboard", true, event -> copyToClipboard()), new SeparatorMenuItem(), factory.createMenuItem("file.exit", false, event -> exit()))); }
Example #26
Source File: FeatureTablePopupMenu.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public FeatureTablePopupMenu(FeatureTable featureTable, TreeTableView<FeatureTableRow> treeTable) { this.featureTable = featureTable; this.treeTable = treeTable; /* * Show menu */ Menu showMenu = new Menu("Show"); // XIC MenuItem xicItem = new MenuItem("Extracted Ion Chromatogram (XIC)"); xicItem.setOnAction(handleClick("XIC")); showMenu.getItems().addAll(xicItem); getItems().addAll(showMenu); getItems().addAll(new SeparatorMenuItem()); /* * Other items */ // Expand MenuItem expandItem = new MenuItem("Expand all groups"); expandItem.setOnAction(handleClick("Expand")); getItems().addAll(expandItem); // Collapse MenuItem collapsItem = new MenuItem("Collapse all groups"); collapsItem.setOnAction(handleClick("Collapse")); getItems().addAll(collapsItem); getItems().addAll(new SeparatorMenuItem()); // Delete MenuItem deleteItem = new MenuItem("Delete selected row(s)"); deleteItem.setOnAction(handleClick("Delete")); getItems().addAll(deleteItem); }
Example #27
Source File: PluginsStage.java From dm3270 with Apache License 2.0 | 5 votes |
private void rebuildMenu () // ---------------------------------------------------------------------------------// { System.out.println ("rebuilding"); ObservableList<MenuItem> items = menu.getItems (); while (items.size () > baseMenuSize) items.remove (menu.getItems ().size () - 1); menu.getItems ().add (new SeparatorMenuItem ()); for (PluginEntry pluginEntry : plugins) if (pluginEntry.isActivated && pluginEntry.requestMenuItem != null) items.add (pluginEntry.requestMenuItem); }
Example #28
Source File: ActionUtils.java From markdown-writer-fx with BSD 2-Clause "Simplified" License | 5 votes |
public static MenuItem[] createMenuItems(Action... actions) { MenuItem[] menuItems = new MenuItem[actions.length]; for (int i = 0; i < actions.length; i++) { menuItems[i] = (actions[i] != null) ? createMenuItem(actions[i]) : new SeparatorMenuItem(); } return menuItems; }
Example #29
Source File: MainMenuController.java From logbook-kai with MIT License | 5 votes |
/** * プラグインのMenuItemを追加します * * @param serviceClass サービスプロバイダインターフェイス * @param items MenuItemの追加先 */ private <S extends Plugin<MenuItem>> void addMenuItem(Class<S> serviceClass, ObservableList<MenuItem> items) { List<MenuItem> addItem = Plugin.getContent(serviceClass); if (!addItem.isEmpty()) { items.add(new SeparatorMenuItem()); addItem.forEach(items::add); } }
Example #30
Source File: TraceContextMenu.java From erlyberly with GNU General Public License v3.0 | 5 votes |
public TraceContextMenu(DbgController aDbgContoller) { dbgController = aDbgContoller; getItems().add(menuItem("Copy All", "shortcut+c", this::onCopy)); getItems().add(menuItem("Copy Function Call", null, this::onCopyCalls)); getItems().add(new SeparatorMenuItem()); getItems().add(menuItem("Delete", "delete", this::onDelete)); getItems().add(menuItem("Delete All", "shortcut+n", this::onDeleteAll)); getItems().add(menuItem("Add Breaker", "shortcut+b", this::onAddBreaker)); getItems().add(menuItem("Toggle Trace", null, this::onTraceToggle)); }