Example usage for javafx.scene.control Separator Separator

List of usage examples for javafx.scene.control Separator Separator

Introduction

In this page you can find the example usage for javafx.scene.control Separator Separator.

Prototype

public Separator() 

Source Link

Document

Creates a new horizontal separator with halignment and valignment set to their respective CENTER values.

Usage

From source file:eu.over9000.skadi.ui.MainWindow.java

private void setupToolbar(final Stage stage) {

    this.add = GlyphsDude.createIconButton(FontAwesomeIcons.PLUS);
    this.addName = new TextField();
    this.addName.setOnAction(event -> this.add.fire());

    this.add.setOnAction(event -> {
        final String name = this.addName.getText().trim();

        if (name.isEmpty()) {
            return;
        }//w ww .j  a  v  a 2  s  .  c  om

        final boolean result = this.channelHandler.addChannel(name, this.sb);

        if (result) {
            this.addName.clear();
        }

    });

    this.imprt = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD);
    this.imprt.setOnAction(event -> {
        final TextInputDialog dialog = new TextInputDialog();
        dialog.initModality(Modality.APPLICATION_MODAL);
        dialog.initOwner(stage);
        dialog.setTitle("Import followed channels");
        dialog.setHeaderText("Import followed channels from Twitch");
        dialog.setGraphic(null);
        dialog.setContentText("Twitch username:");

        dialog.showAndWait().ifPresent(name -> {
            final ImportFollowedService ifs = new ImportFollowedService(this.channelHandler, name, this.sb);
            ifs.start();
        });
    });

    this.details = GlyphsDude.createIconButton(FontAwesomeIcons.INFO);
    this.details.setDisable(true);
    this.details.setOnAction(event -> {
        this.detailChannel.set(this.table.getSelectionModel().getSelectedItem());
        if (!this.sp.getItems().contains(this.detailPane)) {
            this.sp.getItems().add(this.detailPane);
            this.doDetailSlide(true);
        }
    });
    this.details.setTooltip(new Tooltip("Show channel information"));

    this.remove = GlyphsDude.createIconButton(FontAwesomeIcons.TRASH);
    this.remove.setDisable(true);
    this.remove.setOnAction(event -> {
        final Channel candidate = this.table.getSelectionModel().getSelectedItem();

        final Alert alert = new Alert(AlertType.CONFIRMATION);
        alert.initModality(Modality.APPLICATION_MODAL);
        alert.initOwner(stage);
        alert.setTitle("Delete channel");
        alert.setHeaderText("Delete " + candidate.getName());
        alert.setContentText("Do you really want to delete " + candidate.getName() + "?");

        final Optional<ButtonType> result = alert.showAndWait();
        if (result.get() == ButtonType.OK) {
            this.channelHandler.getChannels().remove(candidate);
            this.sb.setText("Removed channel " + candidate.getName());
        }
    });

    this.refresh = GlyphsDude.createIconButton(FontAwesomeIcons.REFRESH);
    this.refresh.setTooltip(new Tooltip("Refresh all channels"));
    this.refresh.setOnAction(event -> {
        this.refresh.setDisable(true);
        final ForcedChannelUpdateService service = new ForcedChannelUpdateService(this.channelHandler, this.sb,
                this.refresh);
        service.start();
    });

    this.settings = GlyphsDude.createIconButton(FontAwesomeIcons.COG);
    this.settings.setTooltip(new Tooltip("Settings"));
    this.settings.setOnAction(event -> {
        final SettingsDialog dialog = new SettingsDialog();
        dialog.initModality(Modality.APPLICATION_MODAL);
        dialog.initOwner(stage);
        final Optional<StateContainer> result = dialog.showAndWait();
        if (result.isPresent()) {
            this.persistenceHandler.saveState(result.get());
        }
    });

    this.onlineOnly = new ToggleButton("Live", GlyphsDude.createIcon(FontAwesomeIcons.FILTER));
    this.onlineOnly.setSelected(this.currentState.isOnlineFilterActive());

    this.onlineOnly.setOnAction(event -> {
        this.currentState.setOnlineFilterActive(this.onlineOnly.isSelected());
        this.persistenceHandler.saveState(this.currentState);
        this.updateFilterPredicate();
    });
    // TODO re-enable if 8u60 is released
    this.onlineOnly.setDisable(true);

    this.filterText = new TextField();
    this.filterText.textProperty().addListener((obs, oldV, newV) -> this.updateFilterPredicate());
    this.filterText.setTooltip(new Tooltip("Filter channels by name, status and game"));

    // TODO re-enable if 8u60 is released
    this.filterText.setDisable(true);

    this.tb = new ToolBar();
    this.tb.getItems().addAll(this.addName, this.add, this.imprt, new Separator(), this.refresh, this.settings,
            new Separator(), this.onlineOnly, this.filterText, new Separator(), this.details, this.remove);

    this.chatAndStreamButton = new HandlerControlButton(this.chatHandler, this.streamHandler, this.table,
            this.tb, this.sb);

    this.updateFilterPredicate();
}

From source file:com.github.drbookings.ui.controller.UpcomingController.java

private void update() {
    final int lookAheadDays = SettingsManager.getInstance().getUpcomingLookAhead();
    this.box.getChildren().clear();
    for (int i = 0; i < lookAheadDays; i++) {
        final LocalDate date = LocalDate.now().plusDays(i);
        final List<BookingEntry> upcomingBookings = manager.getBookingEntries().stream()
                .filter(b -> b.getDate().equals(date)).collect(Collectors.toList());
        final List<CleaningEntry> upcomingCleanings = manager.getCleaningEntries().stream()
                .filter(c -> c.getDate().equals(date)).collect(Collectors.toList());
        addEvents(date, upcomingBookings, upcomingCleanings);
        if (i != lookAheadDays - 1) {
            this.box.getChildren().add(new Separator());
        }/*from w w w . java  2  s  . c om*/
    }
}

From source file:be.makercafe.apps.makerbench.editors.GCodeEditor.java

/**
 * Creates the toolBar for the editor.//from w w  w .  j a va  2 s.c o m
 *
 * @return
 */

private ToolBar createToolBar() {

    ToolBar toolBar = new ToolBar();
    toolBar.setOrientation(Orientation.HORIZONTAL);

    Button btnSave = GlyphsDude.createIconButton(MaterialDesignIcon.FLOPPY, "Save");
    btnSave.setOnAction(this::handleSaveButton);

    Button btnExportSTL = GlyphsDude.createIconButton(MaterialDesignIcon.EXPORT, "Export STL");

    btnExportSTL.setOnAction(this::handleExportAsStlFile);

    Button btnExportPNG = GlyphsDude.createIconButton(MaterialDesignIcon.CAMERA, "Export PNG");
    btnExportPNG.setOnAction(this::handleExportAsPngFile);

    Button btnRun = GlyphsDude.createIconButton(MaterialDesignIcon.RUN, "Run");
    btnRun.setOnAction(this::handleCompileAndRun);

    ToggleButton btnAutoCompile = GlyphsDude.createIconToggleButton(MaterialDesignIcon.AUTO_FIX,
            "Automatic run", null, ContentDisplay.LEFT);
    btnAutoCompile.setSelected(false);

    ToggleButton btn3DNav = GlyphsDude.createIconToggleButton(MaterialDesignIcon.ROTATE_3D, "3D Navigation ",
            null, ContentDisplay.LEFT);
    btn3DNav.setSelected(false);

    ComboBox cbxSourceExamples = new ComboBox();
    cbxSourceExamples.getItems().addAll("BatteryHolder", "BoardMount", "BreadBoardConnector", "ServoMount",
            "Wheel");
    this.cbxSourceExamples = cbxSourceExamples; // TODO: maybe cleaner way
    // to do this ?

    Button btnPasteSource = GlyphsDude.createIconButton(MaterialDesignIcon.CONTENT_PASTE, "Paste source");
    btnPasteSource.setOnAction(this::handlePasteSource);

    toolBar.getItems().addAll(btnSave, btnExportSTL, btnExportPNG, new Separator(), btnRun, new Separator(),
            btnAutoCompile, new Separator(), cbxSourceExamples, btnPasteSource);

    return toolBar;

}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addSeparator() {
    final HBox bb = new HBox();
    bb.setPrefHeight(20);/* ww w.ja  v a 2s. com*/
    bb.setAlignment(Pos.CENTER);
    final Separator s = new Separator();
    s.getStyleClass().add("large-separator");
    bb.getChildren().add(s);
    HBox.setHgrow(s, Priority.ALWAYS);
    content.getChildren().add(bb);
}

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private void addBookingEntry(final BookingBean be) {
    // System.err.println("Adding entry for " + be);
    final VBox box = new VBox(4);
    // box.setPadding(new Insets(4));
    addRow0(box, be);//from  w  w w  .j  a v  a2  s . c  o m
    box.getChildren().add(new Separator());
    addRowNetEarnings(box, be);
    box.getChildren().add(new Separator());
    addRowFees(box, be);
    box.getChildren().add(new Separator());
    addRow4(box, be);
    box.getChildren().add(new Separator());
    addRow5(box, be);
    box.getChildren().add(new Separator());
    addRow1(box, be);
    addRow2(box, be);
    addModifyButton(box, be);
    content.getChildren().add(box);

}

From source file:io.bitsquare.gui.main.overlays.Overlay.java

protected void addSeparator() {
    if (headLine != null) {
        Separator separator = new Separator();
        separator.setMouseTransparent(true);
        separator.setOrientation(Orientation.HORIZONTAL);
        separator.setStyle("-fx-background: #ccc;");
        GridPane.setHalignment(separator, HPos.CENTER);
        GridPane.setRowIndex(separator, ++rowIndex);
        GridPane.setColumnSpan(separator, 2);

        gridPane.getChildren().add(separator);
    }/*www.  j a v a2  s. c  o  m*/
}

From source file:qupath.lib.gui.tma.TMASummaryViewer.java

private Pane getCustomizeTablePane() {
    TableView<TreeTableColumn<TMAEntry, ?>> tableColumns = new TableView<>();
    tableColumns.setPlaceholder(new Text("No columns available"));
    tableColumns.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    tableColumns.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);

    SortedList<TreeTableColumn<TMAEntry, ?>> sortedColumns = new SortedList<>(
            table.getColumns().filtered(p -> !p.getText().trim().isEmpty()));
    sortedColumns.setComparator((c1, c2) -> c1.getText().compareTo(c2.getText()));
    tableColumns.setItems(sortedColumns);
    sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());
    //      sortedColumns.comparatorProperty().bind(tableColumns.comparatorProperty());

    TableColumn<TreeTableColumn<TMAEntry, ?>, String> columnName = new TableColumn<>("Column");
    columnName.setCellValueFactory(v -> v.getValue().textProperty());
    TableColumn<TreeTableColumn<TMAEntry, ?>, Boolean> columnVisible = new TableColumn<>("Visible");
    columnVisible.setCellValueFactory(v -> v.getValue().visibleProperty());
    //      columnVisible.setCellValueFactory(col -> {
    //         SimpleBooleanProperty prop = new SimpleBooleanProperty(col.getValue().isVisible());
    //         prop.addListener((v, o, n) -> col.getValue().setVisible(n));
    //         return prop;
    //      });/*from  w  w w  .j a v a  2s . co m*/
    tableColumns.setEditable(true);
    columnVisible.setCellFactory(v -> new CheckBoxTableCell<>());
    tableColumns.getColumns().add(columnName);
    tableColumns.getColumns().add(columnVisible);
    ContextMenu contextMenu = new ContextMenu();

    Action actionShowSelected = new Action("Show selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(true);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    Action actionHideSelected = new Action("Hide selected", e -> {
        for (TreeTableColumn<?, ?> col : tableColumns.getSelectionModel().getSelectedItems()) {
            if (col != null)
                col.setVisible(false);
            else {
                // Not sure why this happens...?
                logger.trace("Selected column is null!");
            }
        }
    });

    contextMenu.getItems().addAll(ActionUtils.createMenuItem(actionShowSelected),
            ActionUtils.createMenuItem(actionHideSelected));
    tableColumns.setContextMenu(contextMenu);
    tableColumns.setTooltip(
            new Tooltip("Show or hide table columns - right-click to change multiple columns at once"));

    BorderPane paneColumns = new BorderPane(tableColumns);
    paneColumns.setBottom(PanelToolsFX.createColumnGridControls(ActionUtils.createButton(actionShowSelected),
            ActionUtils.createButton(actionHideSelected)));

    VBox paneRows = new VBox();

    // Create a box to filter on some metadata text
    ComboBox<String> comboMetadata = new ComboBox<>();
    comboMetadata.setItems(metadataNames);
    comboMetadata.getSelectionModel().getSelectedItem();
    comboMetadata.setPromptText("Select column");
    TextField tfFilter = new TextField();
    CheckBox cbExact = new CheckBox("Exact");
    // Set listeners
    cbExact.selectedProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    tfFilter.textProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));
    comboMetadata.getSelectionModel().selectedItemProperty().addListener(
            (v, o, n) -> setMetadataTextPredicate(comboMetadata.getSelectionModel().getSelectedItem(),
                    tfFilter.getText(), cbExact.isSelected(), !cbExact.isSelected()));

    GridPane paneMetadata = new GridPane();
    paneMetadata.add(comboMetadata, 0, 0);
    paneMetadata.add(tfFilter, 1, 0);
    paneMetadata.add(cbExact, 2, 0);
    paneMetadata.setPadding(new Insets(10, 10, 10, 10));
    paneMetadata.setVgap(2);
    paneMetadata.setHgap(5);
    comboMetadata.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(tfFilter, Priority.ALWAYS);
    GridPane.setFillWidth(comboMetadata, Boolean.TRUE);
    GridPane.setFillWidth(tfFilter, Boolean.TRUE);

    TitledPane tpMetadata = new TitledPane("Metadata filter", paneMetadata);
    tpMetadata.setExpanded(false);
    //      tpMetadata.setCollapsible(false);
    Tooltip tooltipMetadata = new Tooltip(
            "Enter text to filter entries according to a selected metadata column");
    Tooltip.install(paneMetadata, tooltipMetadata);
    tpMetadata.setTooltip(tooltipMetadata);
    paneRows.getChildren().add(tpMetadata);

    // Add measurement predicate
    TextField tfCommand = new TextField();
    tfCommand.setTooltip(new Tooltip("Predicate used to filter entries for inclusion"));

    TextFields.bindAutoCompletion(tfCommand, e -> {
        int ind = tfCommand.getText().lastIndexOf("\"");
        if (ind < 0)
            return Collections.emptyList();
        String part = tfCommand.getText().substring(ind + 1);
        return measurementNames.stream().filter(n -> n.startsWith(part)).map(n -> "\"" + n + "\" ")
                .collect(Collectors.toList());
    });

    String instructions = "Enter a predicate to filter entries.\n"
            + "Only entries passing the test will be included in any results.\n"
            + "Examples of predicates include:\n" + "    \"Num Tumor\" > 200\n"
            + "    \"Num Tumor\" > 100 && \"Num Stroma\" < 1000";
    //      labelInstructions.setTooltip(new Tooltip("Note: measurement names must be in \"inverted commands\" and\n" + 
    //            "&& indicates 'and', while || indicates 'or'."));

    BorderPane paneMeasurementFilter = new BorderPane(tfCommand);
    Label label = new Label("Predicate: ");
    label.setAlignment(Pos.CENTER);
    label.setMaxHeight(Double.MAX_VALUE);
    paneMeasurementFilter.setLeft(label);

    Button btnApply = new Button("Apply");
    btnApply.setOnAction(e -> {
        TablePredicate predicateNew = new TablePredicate(tfCommand.getText());
        if (predicateNew.isValid()) {
            predicateMeasurements.set(predicateNew);
        } else {
            DisplayHelpers.showErrorMessage("Invalid predicate",
                    "Current predicate '" + tfCommand.getText() + "' is invalid!");
        }
        e.consume();
    });
    TitledPane tpMeasurementFilter = new TitledPane("Measurement filter", paneMeasurementFilter);
    tpMeasurementFilter.setExpanded(false);
    Tooltip tooltipInstructions = new Tooltip(instructions);
    tpMeasurementFilter.setTooltip(tooltipInstructions);
    Tooltip.install(paneMeasurementFilter, tooltipInstructions);
    paneMeasurementFilter.setRight(btnApply);

    paneRows.getChildren().add(tpMeasurementFilter);

    logger.info("Predicate set to: {}", predicateMeasurements.get());

    VBox pane = new VBox();
    //      TitledPane tpColumns = new TitledPane("Select column", paneColumns);
    //      tpColumns.setMaxHeight(Double.MAX_VALUE);
    //      tpColumns.setCollapsible(false);
    pane.getChildren().addAll(paneColumns, new Separator(), paneRows);
    VBox.setVgrow(paneColumns, Priority.ALWAYS);

    return pane;
}

From source file:tachyon.view.Viewer.java

public Viewer(Resource scr, Project pro) {
    super(scr, pro);
    getCenter().setCenter(new ScrollPane(view = new ImageView(image = readFromFile(scr.getFile()))));
    controls = new ToolBar();
    controls.setPadding(new Insets(5, 10, 5, 10));
    getCenter().setTop(controls);//from  www.  jav a  2 s .com
    controls.getItems().addAll(zIn = new Button("Zoom In"), zOut = new Button("Zoom Out"), new Separator(),
            rotate = new Button("Rotate"), new Separator(), revert = new Button("Revert"));
    zIn.setOnAction((e) -> {
        if (zoom.get() < 2.0) {
            zoom.set(zoom.get() + 0.1);
        }
    });
    zOut.setOnAction((e) -> {
        if (zoom.get() > 0.2) {
            zoom.set(zoom.get() - 0.1);
        }
    });
    zoom.addListener((ob, older, newer) -> {
        view.setFitHeight(newer.doubleValue() * image.getHeight());
        view.setFitWidth(newer.doubleValue() * image.getWidth());
    });
    rotate.setOnAction((e) -> {
        view.setRotate(view.getRotate() + 90);
    });
    revert.setOnAction((e) -> {
        zoom.set(1.0);
        view.setRotate(0);
    });
}