Example usage for javafx.scene.control Tab closableProperty

List of usage examples for javafx.scene.control Tab closableProperty

Introduction

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

Prototype

public final BooleanProperty closableProperty() 

Source Link

Document

The closable state for this tab.

Usage

From source file:com.esri.geoevent.test.performance.ui.OrchestratorController.java

private void addFixtureTab(final Fixture fixture, boolean isDefault) {
    try {//from www.j a  v  a  2s . c  o m
        FXMLLoader loader = new FXMLLoader(getClass().getResource("Fixture.fxml"));
        Parent fixtureTab = (Parent) loader.load();

        FixtureController controller = loader.getController();
        controller.setFixture(fixture);
        controller.setIsDefault(isDefault);

        Tab newTab = new Tab(fixture.getName());
        newTab.setContent(fixtureTab);
        newTab.closableProperty().setValue(!isDefault);
        newTab.setOnCloseRequest(event -> {
            boolean isOkClicked = showConfirmationDialog(
                    UIMessages.getMessage("UI_CLOSE_TAB_LABEL", fixture.getName()));
            if (!isOkClicked) {
                event.consume();
            } else {
                fixtures.getFixtures().remove(fixture);
            }
        });
        fixtureTabPane.getTabs().add(newTab);
    } catch (IOException e) {
        e.printStackTrace();
    }
}