use of javafx.scene.control.SeparatorMenuItem in project jvarkit by lindenb.
the class JfxNgs method createCommonMenuItems.
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;
}
use of javafx.scene.control.SeparatorMenuItem in project jvarkit by lindenb.
the class JfxNgs method start.
/*
private void showPreferenceDialoge(Window parentStage)
{
Stage dialog = new Stage();
dialog.setTitle("Preferences");
dialog.initOwner(parentStage);
dialog.initModality(Modality.APPLICATION_MODAL);
dialog.showAndWait();
}*/
@Override
public void start(final Stage primaryStage) throws Exception {
final Parameters params = this.getParameters();
primaryStage.setTitle(getClass().getSimpleName());
Menu menu = new Menu("File");
menu.getItems().addAll(createCommonMenuItems(primaryStage));
menu.getItems().add(new SeparatorMenuItem());
MenuItem menuItem = new MenuItem("Quit...");
menuItem.setOnAction(AE -> doMenuQuit());
menu.getItems().add(menuItem);
MenuBar bar = new MenuBar(menu);
FlowPane flow = new FlowPane(5, 5);
flow.setPadding(new Insets(10));
flow.getChildren().add(new Label("Set Location of all frames to:"));
final TextField textField = new TextField();
textField.setPrefColumnCount(25);
textField.setPromptText("Location. e:g '2:1234-5678'");
flow.getChildren().add(textField);
Button button = new Button("Go");
flow.getChildren().add(button);
textField.setTooltip(new Tooltip("set genomic location can be: empty, 'contig', 'contig:pos', 'contig:start-end' and (\"unmapped\" for bam)"));
final EventHandler<ActionEvent> handler = new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
final String loc = textField.getText().trim();
LOG.info("moveTo all to " + loc);
for (final NgsStage<?, ?> sc : all_opened_stages) {
LOG.info("moveTo " + sc.getTitle() + " to " + loc);
sc.moveTo(loc);
}
}
};
button.setOnAction(handler);
button.setTooltip(new Tooltip("Go the specified genomic location."));
textField.setOnAction(handler);
BorderPane pane = new BorderPane();
pane.setPadding(new Insets(5));
pane.setBottom(new Label("Author: Pierre Lindenbaum PhD."));
VBox vbox1 = new VBox(bar, flow, pane);
final Scene scene = new Scene(vbox1, 500, 300);
primaryStage.setScene(scene);
Exception lastException = null;
primaryStage.addEventHandler(WindowEvent.WINDOW_SHOWING, new EventHandler<WindowEvent>() {
@Override
public void handle(final WindowEvent event) {
final List<String> unnamedParams = new ArrayList<>(params.getUnnamed());
String startPos = "";
int optind = 0;
while (optind + 1 < unnamedParams.size()) {
if (unnamedParams.get(optind).equals("-h") || unnamedParams.get(optind).equals("--help")) {
unnamedParams.remove(optind);
System.out.println("JfxNgs : Pierre Lindenbaum PhD 2017");
System.out.println("Options:");
System.out.println(" -h|--help this screen.");
System.out.println(" -p|--position (string) the starting position");
Platform.exit();
} else if (unnamedParams.get(optind).equals("-p") || unnamedParams.get(optind).equals("--position")) {
startPos = unnamedParams.get(optind + 1);
unnamedParams.remove(optind + 1);
unnamedParams.remove(optind);
} else {
optind++;
}
}
for (final String arg : unnamedParams) {
VcfFile vcfin = null;
BamFile bamin = null;
try {
if (IOUtil.isUrl(arg)) {
if (arg.endsWith(".bam")) {
bamin = BamFile.newInstance(arg);
} else if (arg.endsWith(".vcf.gz")) {
vcfin = VcfFile.newInstance(arg);
}
} else {
final File f = new File(arg);
if (fileMatchExtensionFilter(f.getName(), BamStage.EXTENSION_FILTERS)) {
bamin = BamFile.newInstance(f);
} else if (fileMatchExtensionFilter(f.getName(), VcfStage.EXTENSION_FILTERS)) {
vcfin = VcfFile.newInstance(f);
} else {
JfxNgs.showExceptionDialog(primaryStage, "Cannot open " + f);
}
}
if (vcfin != null) {
new VcfStage(JfxNgs.this, vcfin).setLocationOnOpen(startPos).show();
} else if (bamin != null) {
new BamStage(JfxNgs.this, bamin).show();
}
} catch (Exception e) {
CloserUtil.close(vcfin);
CloserUtil.close(bamin);
showExceptionDialog(primaryStage, e);
}
}
}
});
primaryStage.show();
}
use of javafx.scene.control.SeparatorMenuItem in project pmd by pmd.
the class MainDesignerController method updateRecentFilesMenu.
private void updateRecentFilesMenu() {
List<MenuItem> items = new ArrayList<>();
List<File> filesToClear = new ArrayList<>();
for (final File f : recentFiles) {
if (f.exists() && f.isFile()) {
CustomMenuItem item = new CustomMenuItem(new Label(f.getName()));
item.setOnAction(e -> loadSourceFromFile(f));
item.setMnemonicParsing(false);
Tooltip.install(item.getContent(), new Tooltip(f.getAbsolutePath()));
items.add(item);
} else {
filesToClear.add(f);
}
}
recentFiles.removeAll(filesToClear);
if (items.isEmpty()) {
openRecentMenu.setDisable(true);
return;
}
Collections.reverse(items);
items.add(new SeparatorMenuItem());
MenuItem clearItem = new MenuItem();
clearItem.setText("Clear menu");
clearItem.setOnAction(e -> {
recentFiles.clear();
openRecentMenu.setDisable(true);
});
items.add(clearItem);
openRecentMenu.getItems().setAll(items);
}
use of javafx.scene.control.SeparatorMenuItem in project DeskChan by DeskChan.
the class PluginMenu method updateImpl.
private static synchronized void updateImpl() {
dorkbox.systemTray.Menu menu = trayRef.getMenu();
menu.clear();
trayRef.setStatus(App.NAME);
menu.add(new MenuItem(Main.getString("options"), optionsMenuItemAction));
menu.add(new MenuItem(Main.getString("send-top"), frontMenuItemAction));
menu.add(new Separator());
try {
for (PluginMenuItem it : menuItems) {
menu.add(it.getDorkBoxItem());
}
} catch (ConcurrentModificationException e) {
Main.log("Concurrent modification by tray. Write us if it cause you lags.");
return;
}
menu.add(new Separator());
menu.add(new MenuItem(Main.getString("quit"), quitMenuItemAction));
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);
}
use of javafx.scene.control.SeparatorMenuItem in project jgnash by ccavanaugh.
the class AccountsViewController method getTreeTableRow.
private TreeTableRow<Account> getTreeTableRow() {
final TreeTableRow<Account> treeTableRow = new TreeTableRow<>();
// double click handler
treeTableRow.setOnMouseClicked(event -> {
if (event.getButton().equals(MouseButton.PRIMARY) && event.getClickCount() == 2) {
if (selectedAccount.get() != null && !selectedAccount.get().isPlaceHolder()) {
JavaFXUtils.runLater(AccountsViewController.this::handleZoomAccountAction);
}
}
});
final ContextMenu rowMenu = new ContextMenu();
final MenuItem newItem = new MenuItem(resources.getString("Menu.New.Name"));
newItem.setOnAction(event -> handleNewAccountAction());
final MenuItem modifyItem = new MenuItem(resources.getString("Menu.Modify.Name"));
modifyItem.setOnAction(event -> handleModifyAccountAction());
final MenuItem deleteItem = new MenuItem(resources.getString("Menu.Delete.Name"));
deleteItem.setOnAction(event -> handleDeleteAccountAction());
deleteItem.disableProperty().bind(deleteButton.disabledProperty());
final MenuItem visibilityMenuItem = new MenuItem(resources.getString("Menu.Hide.Name"));
visibilityMenuItem.setOnAction(event -> handleModifyAccountAction());
visibilityMenuItem.setOnAction(event -> new Thread(() -> {
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
if (engine != null) {
engine.toggleAccountVisibility(selectedAccount.get());
}
}).start());
final MenuItem reconcileItem = new MenuItem(resources.getString("Menu.Reconcile.Name"));
reconcileItem.setOnAction(event -> handleReconcileAction());
rowMenu.getItems().addAll(newItem, modifyItem, deleteItem, new SeparatorMenuItem(), visibilityMenuItem, new SeparatorMenuItem(), reconcileItem);
rowMenu.setOnShowing(event -> visibilityMenuItem.setText(selectedAccount.get().isVisible() ? resources.getString("Menu.Hide.Name") : resources.getString("Menu.Show.Name")));
treeTableRow.contextMenuProperty().bind(Bindings.when(Bindings.isNotNull(treeTableRow.itemProperty())).then(rowMenu).otherwise((ContextMenu) null));
return treeTableRow;
}
Aggregations