Example usage for javafx.scene.control TabPane getTabs

List of usage examples for javafx.scene.control TabPane getTabs

Introduction

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

Prototype

public final ObservableList<Tab> getTabs() 

Source Link

Document

The tabs to display in this TabPane.

Usage

From source file:org.jamocha.gui.JamochaGui.java

private Scene generateScene() {
    final TabPane tabPane = new TabPane();
    tabPane.setSide(Side.LEFT);//  w w  w  . j  a v  a2s .c  o m

    this.log = new TextArea();
    final Tab logTab = new Tab("Log");
    logTab.setContent(this.log);
    logTab.setClosable(false);

    final Tab networkTab = new Tab("Network");
    networkTab.setClosable(false);
    final ScrollPane scrollPane = new ScrollPane();
    networkTab.setContent(scrollPane);

    this.networkVisualisation = new NetworkVisualisation(this.jamocha.getNetwork());
    this.networkVisualisation.setTranslateX(10);
    this.networkVisualisation.setTranslateY(10);
    this.networkVisualisation.update();
    scrollPane.setContent(this.networkVisualisation);

    tabPane.getTabs().addAll(logTab, networkTab);

    final Scene scene = new Scene(tabPane);
    tabPane.prefHeightProperty().bind(scene.heightProperty());
    tabPane.prefWidthProperty().bind(scene.widthProperty());
    return scene;
}

From source file:io.github.moosbusch.permagon.configuration.builder.spi.AbstractPermagonBuilder.java

protected void buildTabPane(TabPane pane) {
    if (containsKey(NODE_TABS_PROPERTY)) {
        Object obj = Objects.requireNonNull(get(NODE_TABS_PROPERTY));

        if (obj instanceof ObservableMap) {
            ObservableMap propertiesMap = (ObservableMap) obj;
            Object childrenObj = Objects.requireNonNull(propertiesMap.get(NODE_TABS_PROPERTY));

            if (childrenObj instanceof ObservableList) {
                pane.getTabs().addAll((ObservableList) childrenObj);
            }/*from   w  w w  . j a  v a2 s  .  c om*/
        }
    }
}

From source file:ipat_fx.FXMLDocumentController.java

public TabPane getByProfile(HashMap<String, ArrayList<GridPane>> map, int noOfProfiles) {

    TabPane tabpane = new TabPane();
    Tab tabForProfile;//from ww w. java 2 s. co m
    FlowPane paneForProfile;

    for (int i = 0; i < noOfProfiles; i++) {
        tabForProfile = new Tab();
        paneForProfile = new FlowPane();
        tabForProfile.setId("li_Profile_" + i);
        tabForProfile.setText("Profile " + i);
        int j = 0;
        for (Iterator<String> iterator = map.keySet().iterator(); iterator.hasNext(); j++) {
            String nameOfArtefact = iterator.next();
            ArrayList<GridPane> cells = map.get(nameOfArtefact);
            paneForProfile.getChildren().add(cells.get(i));
        }
        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(paneForProfile);
        tabForProfile.setContent(scrollPane);
        tabpane.getTabs().add(tabForProfile);
    }
    return tabpane;
}

From source file:ipat_fx.FXMLDocumentController.java

public TabPane getByImage(HashMap<String, ArrayList<GridPane>> map) {

    TabPane tabpane = new TabPane();
    Tab tabForImage;/*from  w w w  .  j  a  v  a 2 s  .co  m*/
    FlowPane paneForImage;

    Iterator<String> iterator = map.keySet().iterator();
    while (iterator.hasNext()) {
        tabForImage = new Tab();
        paneForImage = new FlowPane();
        String nameOfArtefact = iterator.next();
        tabForImage.setId("li_" + nameOfArtefact);
        tabForImage.setText(nameOfArtefact);
        ArrayList<GridPane> cells = map.get(nameOfArtefact);
        for (GridPane cell1 : cells) {
            GridPane cell = cell1;
            //paneForImage.add(cell, 0, i);
            paneForImage.getChildren().add(cell);
        }
        ScrollPane scrollPane = new ScrollPane();
        scrollPane.setContent(paneForImage);
        tabForImage.setContent(scrollPane);
        tabpane.getTabs().add(tabForImage);
    }
    return tabpane;
}

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

private Pane createSidePane() {
    BorderPane pane = new BorderPane();

    TabPane tabPane = new TabPane();

    kmDisplay = new KaplanMeierDisplay(null, null, null, null);
    BorderPane paneKaplanMeier = new BorderPane();
    paneKaplanMeier.setCenter(kmDisplay.getView());
    paneKaplanMeier.setPadding(new Insets(10, 10, 10, 10));
    //      comboMainMeasurement.prefWidthProperty().bind(paneKaplanMeier.widthProperty());
    comboMainMeasurement.setMaxWidth(Double.MAX_VALUE);
    comboMainMeasurement.setTooltip(new Tooltip("Measurement thresholded to create survival curves etc."));

    GridPane kmTop = new GridPane();
    kmTop.add(new Label("Score"), 0, 0);
    kmTop.add(comboMainMeasurement, 1, 0);
    kmTop.add(new Label("Survival type"), 0, 1);
    kmTop.add(comboSurvival, 1, 1);/*from   w  ww  .  j  a  v a 2  s.  c om*/
    comboSurvival.setTooltip(new Tooltip("Specify overall or recurrence-free survival (if applicable)"));
    comboSurvival.setMaxWidth(Double.MAX_VALUE);
    GridPane.setHgrow(comboMainMeasurement, Priority.ALWAYS);
    GridPane.setHgrow(comboSurvival, Priority.ALWAYS);
    kmTop.setHgap(5);
    paneKaplanMeier.setTop(kmTop);
    //      kmDisplay.setOrientation(Orientation.VERTICAL);

    histogramDisplay = new HistogramDisplay(model, false);

    comboMainMeasurement.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        histogramDisplay.refreshCombo();
        histogramDisplay.showHistogram(n);
        updateSurvivalCurves();
    });
    comboMeasurementMethod.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        histogramDisplay.refreshHistogram();
        scatterPane.updateChart();
        updateSurvivalCurves();
    });
    comboSurvival.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> {
        updateSurvivalCurves();
    });

    // Create a Tab for showing images
    BorderPane paneImages = new BorderPane();
    CheckBox cbShowOverlay = new CheckBox("Show overlay");
    imageAvailability.addListener((c, v, n) -> {
        if (n == ImageAvailability.OVERLAY_ONLY)
            cbShowOverlay.setSelected(true);
        else if (n == ImageAvailability.IMAGE_ONLY)
            cbShowOverlay.setSelected(false);
        cbShowOverlay.setDisable(n != ImageAvailability.BOTH);
    });
    ListView<TMAEntry> listImages = new ListView<>();
    listImages.setCellFactory(v -> new ImageListCell(cbShowOverlay.selectedProperty(), imageCache));
    listImages.widthProperty().addListener((v, o, n) -> listImages.refresh());
    listImages.setStyle("-fx-control-inner-background-alt: -fx-control-inner-background ;");
    table.getSelectionModel().getSelectedItems().addListener((Change<? extends TreeItem<TMAEntry>> e) -> {
        List<TMAEntry> entries = new ArrayList<>();
        for (TreeItem<TMAEntry> item : e.getList()) {
            if (item.getChildren().isEmpty()) {
                if (item.getValue().hasImage() || item.getValue().hasOverlay())
                    entries.add(item.getValue());
            } else {
                for (TreeItem<TMAEntry> item2 : item.getChildren()) {
                    if (item2.getValue().hasImage() || item2.getValue().hasOverlay())
                        entries.add(item2.getValue());
                }
            }
            listImages.getItems().setAll(entries);
        }
    });
    cbShowOverlay.setAlignment(Pos.CENTER);
    cbShowOverlay.setMaxWidth(Double.MAX_VALUE);
    cbShowOverlay.setPadding(new Insets(5, 5, 5, 5));
    cbShowOverlay.selectedProperty().addListener((v, o, n) -> listImages.refresh());
    paneImages.setCenter(listImages);
    paneImages.setTop(cbShowOverlay);

    // Determine visibility based upon whether there are any images to show
    //      Tab tabImages = new Tab("Images", paneImages);

    ScrollPane scrollPane = new ScrollPane(paneKaplanMeier);
    scrollPane.setFitToWidth(true);
    scrollPane.setFitToHeight(true);
    scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED);
    scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED);
    Tab tabSurvival = new Tab("Survival", scrollPane);
    tabPane.getTabs().addAll(new Tab("Table", getCustomizeTablePane()),
            //            tabImages,
            new Tab("Histogram", histogramDisplay.getPane()), new Tab("Scatterplot", scatterPane.getPane()),
            tabSurvival);
    tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE);

    //      if (imageAvailability.get() != ImageAvailability.NONE)
    //         tabPane.getTabs().add(1, tabImages);
    //      
    //      imageAvailability.addListener((c, v, n) -> {
    //         if (n == ImageAvailability.NONE)
    //            tabPane.getTabs().remove(tabImages);
    //         else if (!tabPane.getTabs().contains(tabImages))
    //            tabPane.getTabs().add(1, tabImages);
    //      });

    //      tabSurvival.visibleProperty().bind(
    //            Bindings.createBooleanBinding(() -> !survivalColumns.isEmpty(), survivalColumns)
    //            );

    pane.setCenter(tabPane);

    pane.setMinWidth(350);

    return pane;
}