javafx.scene.control.SplitMenuButton Java Examples

The following examples show how to use javafx.scene.control.SplitMenuButton. 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: RequestComponent.java    From milkman with MIT License 5 votes vote down vote up
public RequestComponentFxml(RequestComponent controller) {
	setId("requestComponent");
	HboxExt reqEdit = add(hbox("generalRequestEdit"));
	controller.mainEditingArea = reqEdit.add(hbox("mainEditingArea"), true);
	
	controller.submitBtn = reqEdit.add(new SplitMenuButton());

	JavaFxUtils.publishEscToParent(controller.submitBtn);
	controller.submitBtn.setId("submitBtn");
	controller.submitBtn.setText("submit");
	controller.submitBtn.setOnAction(e -> controller.onSubmit());
	
	
	controller.saveBtn = reqEdit.add(new SplitMenuButton());
	controller.saveBtn.setId("saveBtn");
	controller.saveBtn.setText("save");
	controller.saveBtn.setOnAction(e -> controller.onSave());
	controller.saveBtn.getStyleClass().add("secondary");
	
	MenuItem saveAs = new MenuItem("save as...");
	saveAs.setOnAction(e -> controller.onSaveAs());
	controller.saveBtn.getItems().add(saveAs);
	
	MenuItem export = new MenuItem("export...");
	export.setOnAction(e -> controller.onExport());
	controller.saveBtn.getItems().add(export);
	
	JFXTabPane tabPane = add(new JFXTabPane(), true);
	tabPane.setId("tabs");
	tabPane.setDisableAnimation(true);
	controller.tabs = tabPane;
	tabPane.setPrefHeight(300);
	
}
 
Example #2
Source File: SelectionTableToolbarTest.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
@Test
@Category(NoHeadless.class)
public void clearAllSettings() {
    Listener<ClearModuleEvent> listener = mock(Listener.class);
    ArgumentCaptor<ClearModuleEvent> captor = ArgumentCaptor.forClass(ClearModuleEvent.class);
    eventStudio().add(ClearModuleEvent.class, listener, MODULE);
    SplitMenuButton btn = lookup("#clear-button").queryAs(SplitMenuButton.class);
    for (Node child : btn.getChildrenUnmodifiable()) {
        if (child.getStyleClass().contains("arrow-button")) {
            clickOn(child).clickOn(".menu-item");
        }
    }
    verify(listener).onEvent(captor.capture());
    assertTrue(captor.getValue().clearEverything);
}
 
Example #3
Source File: Screenshot.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
/**
 * @return A node with screenshot buttons which can be inserted into the toolbar
 */
public HBox getScreenshotInteractorBar() {
    final HBox buttonBar = new HBox();
    final Separator separator = new Separator();
    separator.setOrientation(Orientation.VERTICAL);
    SplitMenuButton button = new SplitMenuButton();
    button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
            new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.0)));
    button.setOnAction(evt -> {
        if (toFile) {
            screenshotToFile(true);
        } else {
            screenshotToClipboard();
        }
    });
    MenuItem toClipMenu = new MenuItem("Screenshot to clipboard",
            new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD));
    toClipMenu.setOnAction(evt -> {
        toFile = false;
        button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
                new Glyph(FONT_AWESOME, FontAwesome.Glyph.CLIPBOARD).size(FONT_SIZE - 8.8)));
        button.setTooltip(new Tooltip("Copy screenshot of plot to Clipboard"));
        screenshotToClipboard();
    });
    MenuItem toFileMenu = new MenuItem("Screenshot to file", new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE));
    toFileMenu.setOnAction(evt -> {
        toFile = true;
        button.setGraphic(new HBox(0.1, new Glyph(FONT_AWESOME, FontAwesome.Glyph.CAMERA).size(FONT_SIZE),
                new Glyph(FONT_AWESOME, FontAwesome.Glyph.FILE).size(FONT_SIZE - 8.0)));
        button.setTooltip(new Tooltip("Save plot as image"));
        screenshotToFile(true);
    });
    MenuItem settingsMenu = new MenuItem("Screenshot settings", new Glyph(FONT_AWESOME, FontAwesome.Glyph.WRENCH));
    settingsMenu.setOnAction(evt -> {
        ScreenshotDialog alert = new ScreenshotDialog();
        alert.showAndWait() //
                .filter(response -> response == ButtonType.OK) //
                .ifPresent(response -> {
                    directory.set(alert.getDirectory());
                    pattern.set(alert.getPattern());
                });
    });
    button.getItems().addAll(toClipMenu, toFileMenu, new SeparatorMenuItem(), settingsMenu);

    buttonBar.getChildren().addAll(separator, button);
    return buttonBar;
}
 
Example #4
Source File: DisplayWindow.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
private SplitMenuButton createNewButton() {
    SplitMenuButton newButton = new SplitMenuButton(newTestcaseAction.getMenuItem(), etAction.getMenuItem());
    newButton.setGraphic(newTestcaseAction.getButton().getGraphic());
    newButton.setOnAction(newTestcaseAction.getButton().getOnAction());
    return newButton;
}