Java Code Examples for javafx.scene.control.CheckBox#setDisable()

The following examples show how to use javafx.scene.control.CheckBox#setDisable() . 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: DataSourceTitledPane.java    From constellation with Apache License 2.0 6 votes vote down vote up
public DataSourceTitledPane(final DataAccessPlugin plugin, final ImageView dataSourceIcon, final PluginParametersPaneListener top, final Set<String> globalParamLabels) {
    this.plugin = plugin;
    this.top = top;
    this.globalParamLabels = globalParamLabels;

    isLoaded = false;
    enabled = new CheckBox();
    label = new Label(plugin.getName(), dataSourceIcon);

    setGraphic(createTitleBar());
    enabled.setDisable(true);

    final boolean isExpanded = DataAccessPreferences.isExpanded(plugin.getName(), false);

    createParameters(isExpanded, null);

    setPadding(Insets.EMPTY);
    setTooltip(new Tooltip(plugin.getDescription()));
}
 
Example 2
Source File: CheckBoxes.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public CheckBoxes() {
    VBox vbox = new VBox();
    vbox.setSpacing(10);
    CheckBox cb1 = new CheckBox("Simple checkbox");

    CheckBox cb2 = new CheckBox("Three state checkbox");
    cb2.setAllowIndeterminate(true);
    cb2.setIndeterminate(false);

    CheckBox cb3 = new CheckBox("Disabled");
    cb3.setSelected(true);
    cb3.setDisable(true);

    vbox.getChildren().add(cb1);
    vbox.getChildren().add(cb2);
    vbox.getChildren().add(cb3);
    getChildren().add(vbox);
}
 
Example 3
Source File: CheckBoxes.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public CheckBoxes() {
    VBox vbox = new VBox();
    vbox.setSpacing(10);
    CheckBox cb1 = new CheckBox("Simple checkbox");

    CheckBox cb2 = new CheckBox("Three state checkbox");
    cb2.setAllowIndeterminate(true);
    cb2.setIndeterminate(false);

    CheckBox cb3 = new CheckBox("Disabled");
    cb3.setSelected(true);
    cb3.setDisable(true);

    vbox.getChildren().add(cb1);
    vbox.getChildren().add(cb2);
    vbox.getChildren().add(cb3);
    getChildren().add(vbox);
}
 
Example 4
Source File: EditAxis.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
/**
 * Creates the header for the Axis Editor popup, allowing to configure axis label and unit
 *
 * @param axis The axis to be edited
 * @return pane containing label, label editor and unit editor
 */
private Node getLabelEditor(final Axis axis, final boolean isHorizontal) {
    final GridPane header = new GridPane();
    header.setAlignment(Pos.BASELINE_LEFT);
    final TextField axisLabelTextField = new TextField(axis.getName());
    axisLabelTextField.textProperty().bindBidirectional(axis.nameProperty());
    header.addRow(0, new Label(" axis label: "), axisLabelTextField);

    final TextField axisUnitTextField = new TextField(axis.getUnit());
    axisUnitTextField.setPrefWidth(50.0);
    axisUnitTextField.textProperty().bindBidirectional(axis.unitProperty());
    header.addRow(isHorizontal ? 0 : 1, new Label(" unit: "), axisUnitTextField);

    final TextField unitScaling = new TextField();
    unitScaling.setPrefWidth(80.0);
    final CheckBox autoUnitScaling = new CheckBox(" auto");
    if (axis instanceof DefaultNumericAxis) {
        autoUnitScaling.selectedProperty()
                .bindBidirectional(((DefaultNumericAxis) axis).autoUnitScalingProperty());
        unitScaling.textProperty().bindBidirectional(((DefaultNumericAxis) axis).unitScalingProperty(),
                new NumberStringConverter(new DecimalFormat("0.0####E0")));
        unitScaling.disableProperty().bind(autoUnitScaling.selectedProperty());
    } else {
        // TODO: consider adding an interface on whether
        // autoUnitScaling is editable
        autoUnitScaling.setDisable(true);
        unitScaling.setDisable(true);
    }
    final HBox unitScalingBox = new HBox(unitScaling, autoUnitScaling);
    unitScalingBox.setAlignment(Pos.BASELINE_LEFT);
    header.addRow(isHorizontal ? 0 : 2, new Label(" unit scale:"), unitScalingBox);
    return header;
}
 
Example 5
Source File: MultipleAxesLineChart.java    From chart-fx with Apache License 2.0 5 votes vote down vote up
public Node getLegend() {
    final HBox hBox = new HBox();

    final CheckBox baseChartCheckBox = new CheckBox(baseChart.getYAxis().getLabel());
    baseChartCheckBox.setSelected(true);
    baseChartCheckBox
            .setStyle("-fx-text-fill: " + toRGBCode(chartColorMap.get(baseChart)) + "; -fx-font-weight: bold;");
    baseChartCheckBox.setDisable(true);
    baseChartCheckBox.getStyleClass().add("readonly-checkbox");
    baseChartCheckBox.setOnAction(event -> baseChartCheckBox.setSelected(true));
    hBox.getChildren().add(baseChartCheckBox);

    for (final LineChart<?, ?> lineChart : backgroundCharts) {
        final CheckBox checkBox = new CheckBox(lineChart.getYAxis().getLabel());
        checkBox.setStyle("-fx-text-fill: " + toRGBCode(chartColorMap.get(lineChart)) + "; -fx-font-weight: bold");
        checkBox.setSelected(true);
        checkBox.setOnAction(event -> {
            if (backgroundCharts.contains(lineChart)) {
                backgroundCharts.remove(lineChart);
            } else {
                backgroundCharts.add(lineChart);
            }
        });
        hBox.getChildren().add(checkBox);
    }

    hBox.setAlignment(Pos.CENTER);
    hBox.setSpacing(20);
    hBox.setStyle("-fx-padding: 0 10 20 10");

    return hBox;
}
 
Example 6
Source File: SnapshotTreeTable.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
public SelectionTreeTableColumnCell() {
    checkBox = new CheckBox();

    nullCheckBox = new CheckBox();
    nullCheckBox.setDisable(true);
    nullCheckBox.setSelected(false);

    setGraphic(null);
}
 
Example 7
Source File: SnapshotTreeTable.java    From phoebus with Eclipse Public License 1.0 5 votes vote down vote up
public PVNameTreeTableCell() {
    getStyleClass().add("check-box-tree-table-cell");
    box = new HBox();
    box.setSpacing(5);

    checkBox = new CheckBox();
    nullCheckBox = new CheckBox();
    nullCheckBox.setDisable(true);
    nullCheckBox.setSelected(false);

    setGraphic(null);
}
 
Example 8
Source File: DefaultControlTreeItemGraphic.java    From arma-dialog-creator with MIT License 5 votes vote down vote up
public void setGraphicIsEnabled(boolean enabled) {
	this.getChildren().remove(getChildren().size() - 1);
	String lessVisibleText = "less-visible-tree-cell";
	if (enabled) {
		getChildren().add(rbSelected);
		entry.getStyleClass().remove(lessVisibleText);
	} else {
		CheckBox checkBox = new CheckBox();
		checkBox.setIndeterminate(true);
		checkBox.setDisable(true);
		getChildren().add(checkBox);
		entry.getStyleClass().add(lessVisibleText);
	}
}
 
Example 9
Source File: BooleanInputPane.java    From constellation with Apache License 2.0 4 votes vote down vote up
public BooleanInputPane(final PluginParameter<BooleanParameterValue> parameter) {
    final List<String> recentValues = RecentParameterValues.getRecentValues(parameter.getId());
    field = new CheckBox();
    final BooleanParameterValue pv = parameter.getParameterValue();

    if (recentValues != null) {
        field.setSelected(Boolean.parseBoolean(recentValues.get(0)));
    }

    field.setSelected(pv.get());

    if (parameter.getParameterValue().getGuiInit() != null) {
        parameter.getParameterValue().getGuiInit().init(field);
    }

    field.setDisable(!parameter.isEnabled());
    field.setManaged(parameter.isVisible());
    field.setVisible(parameter.isVisible());
    this.setManaged(parameter.isVisible());
    this.setVisible(parameter.isVisible());

    field.setOnAction(event -> {
        parameter.setBooleanValue(field.isSelected());
    });

    parameter.addListener((PluginParameter<?> pluginParameter, ParameterChange change) -> {
        Platform.runLater(() -> {
            switch (change) {
                case VALUE:
                    // Don't change the value if it isn't necessary.
                    final boolean param = pluginParameter.getBooleanValue();
                    if (param != field.isSelected()) {
                        field.setSelected(param);
                    }
                    break;
                case ENABLED:
                    field.setDisable(!pluginParameter.isEnabled());
                    break;
                case VISIBLE:
                    field.setManaged(parameter.isVisible());
                    field.setVisible(parameter.isVisible());
                    this.setVisible(parameter.isVisible());
                    this.setManaged(parameter.isVisible());
                    break;
                default:
                    LOGGER.log(Level.FINE, "ignoring parameter change type {0}.", change);
                    break;
            }
        });
    });

    getChildren().add(field);
}
 
Example 10
Source File: EditAxis.java    From chart-fx with Apache License 2.0 4 votes vote down vote up
private Pane getLogCheckBoxes(final Axis axis) {
    final Pane boxMax = new VBox();
    VBox.setVgrow(boxMax, Priority.ALWAYS);

    final CheckBox logAxis = new CheckBox("log axis");
    HBox.setHgrow(logAxis, Priority.ALWAYS);
    VBox.setVgrow(logAxis, Priority.ALWAYS);
    logAxis.setMaxWidth(Double.MAX_VALUE);
    logAxis.setSelected(axis.isLogAxis());
    boxMax.getChildren().add(logAxis);

    if (axis instanceof DefaultNumericAxis) {
        logAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).logAxisProperty());
    } else {
        // TODO: consider adding an interface on whether log/non-log
        // is editable
        logAxis.setDisable(true);
    }

    final CheckBox invertedAxis = new CheckBox("inverted");
    HBox.setHgrow(invertedAxis, Priority.ALWAYS);
    VBox.setVgrow(invertedAxis, Priority.ALWAYS);
    invertedAxis.setMaxWidth(Double.MAX_VALUE);
    invertedAxis.setSelected(axis.isInvertedAxis());
    boxMax.getChildren().add(invertedAxis);

    if (axis instanceof DefaultNumericAxis) {
        invertedAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).invertAxisProperty());
    } else {
        // TODO: consider adding an interface on whether
        // invertedAxis is editable
        invertedAxis.setDisable(true);
    }

    final CheckBox timeAxis = new CheckBox("time axis");
    HBox.setHgrow(timeAxis, Priority.ALWAYS);
    VBox.setVgrow(timeAxis, Priority.ALWAYS);
    timeAxis.setMaxWidth(Double.MAX_VALUE);
    timeAxis.setSelected(axis.isTimeAxis());
    boxMax.getChildren().add(timeAxis);

    if (axis instanceof DefaultNumericAxis) {
        timeAxis.selectedProperty().bindBidirectional(((DefaultNumericAxis) axis).timeAxisProperty());
    } else {
        // TODO: consider adding an interface on whether
        // timeAxis is editable
        timeAxis.setDisable(true);
    }

    return boxMax;
}
 
Example 11
Source File: TopsoilPlotEvolution.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
@Override
public List<Node> toolbarControlsFactory() {
    List<Node> controls = super.toolbarControlsFactory();

    CheckBox ellipsesCheckBox = new CheckBox("Ellipses");
    ellipsesCheckBox.setSelected(true);
    ellipsesCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(ELLIPSES, ellipsesCheckBox.isSelected());
    });
    
    ChoiceBox<SigmaPresentationModes> uncertaintyChoiceBox = new ChoiceBox<>(FXCollections.observableArrayList(SigmaPresentationModes.values()));
    uncertaintyChoiceBox.setValue(SigmaPresentationModes.TWO_SIGMA_ABSOLUTE);
    uncertaintyChoiceBox.setConverter(new StringConverter<SigmaPresentationModes>() {
        @Override
        public String toString(SigmaPresentationModes object) {
            return object.getDisplayName();
        }

        @Override
        public SigmaPresentationModes fromString(String string) {
            return null;
        }
    });
    uncertaintyChoiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SigmaPresentationModes>() {
        @Override
        public void changed(ObservableValue observable, SigmaPresentationModes oldValue, SigmaPresentationModes newValue) {
            plot.setProperty(UNCERTAINTY, newValue.getSigmaMultiplier());
        }
    });

    ColorPicker ellipsesColorPicker = new ColorPicker(Color.RED);
    ellipsesColorPicker.setStyle("-fx-font-size: 8px; -fx-font-family: 'Courier New';");
    ellipsesColorPicker.setPrefWidth(100);
    ellipsesColorPicker.setOnAction(mouseEvent -> {
        // to satisfy D3
        plot.setProperty(ELLIPSE_FILL_COLOR, ellipsesColorPicker.getValue().toString().substring(0, 8).replaceAll("0x", "#"));
    });

    CheckBox matrixCheckBox = new CheckBox("Matrix");
    matrixCheckBox.setSelected(true);
    matrixCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(EVOLUTION_MATRIX, matrixCheckBox.isSelected());
    });

    CheckBox allSelectedCheckBox = new CheckBox("Select All");
    allSelectedCheckBox.setSelected(true);
    allSelectedCheckBox.setOnAction(mouseEvent -> {
        setSelectedAllData(allSelectedCheckBox.isSelected());
    });

    CheckBox regressionUnctEnvelopeCheckBox = new CheckBox("2D Regression Unct");
    regressionUnctEnvelopeCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(REGRESSION_ENVELOPE, regressionUnctEnvelopeCheckBox.isSelected());
    });

    CheckBox regressionCheckBox = new CheckBox("2D Regression");
    regressionCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setDisable(true);
    regressionCheckBox.setOnAction(mouseEvent -> {
        boolean isRegression = regressionCheckBox.isSelected();
        plot.setProperty(REGRESSION_LINE, isRegression);
        regressionUnctEnvelopeCheckBox.setDisable(!isRegression);
    });

    controls.add(ellipsesCheckBox);
    controls.add(uncertaintyChoiceBox);
    controls.add(ellipsesColorPicker);
    controls.add(allSelectedCheckBox);
    controls.add(matrixCheckBox);
    controls.add(regressionCheckBox);
    controls.add(regressionUnctEnvelopeCheckBox);

    return controls;
}
 
Example 12
Source File: TopsoilPlotWetherill.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
@Override
public List<Node> toolbarControlsFactory() {
    List<Node> controls = super.toolbarControlsFactory();

    CheckBox ellipsesCheckBox = new CheckBox("Ellipses");
    ellipsesCheckBox.setSelected(true);
    ellipsesCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(ELLIPSES, ellipsesCheckBox.isSelected());
    });
    
    ChoiceBox<SigmaPresentationModes> uncertaintyChoiceBox = new ChoiceBox<>(FXCollections.observableArrayList(SigmaPresentationModes.values()));
    uncertaintyChoiceBox.setValue(SigmaPresentationModes.TWO_SIGMA_ABSOLUTE);
    uncertaintyChoiceBox.setConverter(new StringConverter<SigmaPresentationModes>() {
        @Override
        public String toString(SigmaPresentationModes object) {
            return object.getDisplayName();
        }

        @Override
        public SigmaPresentationModes fromString(String string) {
            return null;
        }
    });
    uncertaintyChoiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SigmaPresentationModes>() {
        @Override
        public void changed(ObservableValue observable, SigmaPresentationModes oldValue, SigmaPresentationModes newValue) {
            plot.setProperty(UNCERTAINTY, newValue.getSigmaMultiplier());
        }
    });

    ColorPicker ellipsesColorPicker = new ColorPicker(Color.RED);
    ellipsesColorPicker.setStyle("-fx-font-size: 8px; -fx-font-family: 'Courier New';");
    ellipsesColorPicker.setPrefWidth(100);
    ellipsesColorPicker.setOnAction(mouseEvent -> {
        // to satisfy D3
        plot.setProperty(ELLIPSE_FILL_COLOR, ellipsesColorPicker.getValue().toString().substring(0, 8).replaceAll("0x", "#"));
    });

    CheckBox concordiaLineCheckBox = new CheckBox("Concordia");
    concordiaLineCheckBox.setSelected(true);
    concordiaLineCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(CONCORDIA_LINE, concordiaLineCheckBox.isSelected());
    });

    CheckBox allSelectedCheckBox = new CheckBox("Select All");
    allSelectedCheckBox.setSelected(true);
    allSelectedCheckBox.setOnAction(mouseEvent -> {
        setSelectedAllData(allSelectedCheckBox.isSelected());
    });

    CheckBox regressionUnctEnvelopeCheckBox = new CheckBox("2D Regression Unct");
    regressionUnctEnvelopeCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(REGRESSION_ENVELOPE, regressionUnctEnvelopeCheckBox.isSelected());
    });

    CheckBox regressionCheckBox = new CheckBox("2D Regression");
    regressionCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setDisable(true);
    regressionCheckBox.setOnAction(mouseEvent -> {
        boolean isRegression = regressionCheckBox.isSelected();
        plot.setProperty(REGRESSION_LINE, isRegression);
        regressionUnctEnvelopeCheckBox.setDisable(!isRegression);
    });

    controls.add(ellipsesCheckBox);
    controls.add(uncertaintyChoiceBox);
    controls.add(ellipsesColorPicker);
    controls.add(allSelectedCheckBox);
    controls.add(concordiaLineCheckBox);
    controls.add(regressionCheckBox);
    controls.add(regressionUnctEnvelopeCheckBox);

    return controls;
}