Java Code Examples for javafx.scene.control.CheckBox#setOnAction()
The following examples show how to use
javafx.scene.control.CheckBox#setOnAction() .
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: SnapshotTreeTable.java From phoebus with Eclipse Public License 1.0 | 6 votes |
SelectionTreeTableColumn() { super("", "Include this PV when restoring values", 30, 30, false); setCellValueFactory(cell -> new ReadOnlyObjectWrapper<>(cell.getValue().getValue())); //for those entries, which have a read-only property, disable the checkbox setCellFactory(cell -> new SelectionTreeTableColumnCell()); setEditable(true); setSortable(false); selectAllCheckBox = new CheckBox(); selectAllCheckBox.setSelected(false); selectAllCheckBox.setOnAction(action -> rootTTE.cbti.setSelected(selectAllCheckBox.isSelected())); // selectAllCheckBox.setOnAction(action -> treeTableEntryItems.values().stream().filter(item -> !item.folder) // .filter(item -> !item.tableEntry.readOnlyProperty().get()) // .forEach(item -> item.tableEntry.selectedProperty().set(selectAllCheckBox.isSelected()))); setGraphic(selectAllCheckBox); MenuItem inverseMI = new MenuItem("Inverse Selection"); inverseMI.setOnAction(action -> treeTableEntryItems.values().stream().filter(item -> !item.folder) .filter(item -> !item.tableEntry.readOnlyProperty().get()) .forEach(item -> item.tableEntry.selectedProperty().set(!item.tableEntry.selectedProperty().get()))); final ContextMenu contextMenu = new ContextMenu(inverseMI); selectAllCheckBox.setOnMouseReleased(e -> { if (e.getButton() == MouseButton.SECONDARY) { contextMenu.show(selectAllCheckBox, e.getScreenX(), e.getScreenY()); } }); }
Example 2
Source File: StepRepresentationLicence.java From phoenicis with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void drawStepContent() { super.drawStepContent(); TextArea licenceWidget = new TextArea(licenceText); licenceWidget.setLayoutX(10); licenceWidget.setLayoutY(100); licenceWidget.setMinWidth(700); licenceWidget.setMaxWidth(700); licenceWidget.setMinHeight(308); licenceWidget.setMaxHeight(308); licenceWidget.setEditable(false); CheckBox confirmWidget = new CheckBox(tr("I agree")); confirmWidget.setOnAction(event -> { isAgree = !isAgree; confirmWidget.setSelected(isAgree); setNextButtonEnabled(isAgree); }); confirmWidget.setLayoutX(10); confirmWidget.setLayoutY(418); setNextButtonEnabled(false); this.addToContentPane(licenceWidget); this.addToContentPane(confirmWidget); }
Example 3
Source File: CheckableImageListCell.java From ShootOFF with GNU General Public License v3.0 | 6 votes |
public static void cacheCamera(Camera c, CameraSelectionListener listener) { final ImageView iv = new ImageView(); iv.setFitWidth(100); iv.setFitHeight(75); new Thread(() -> { final Optional<Image> img = fetchWebcamImage(c); if (img.isPresent()) { iv.setImage(img.get()); } }, "FetchImageCellWebcamImages").start(); final CheckBox cb = new CheckBox(); cb.setOnAction((event) -> { if (listener != null) listener.cameraSelectionChanged(c, cb.isSelected()); }); checkCache.put(c, cb); final HBox webcamContainer = new HBox(cb, iv); webcamContainer.setAlignment(Pos.CENTER); containerCache.put(c, webcamContainer); }
Example 4
Source File: PlotConfigDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
private int addTraceContent(final GridPane layout, int row, final Trace<?> trace) { Label label = new Label(trace.getName()); layout.add(label, 5, row); final ColorPicker color = createPicker(trace.getColor()); color.setOnAction(event -> { trace.setColor(color.getValue()); plot.requestUpdate(); }); layout.add(color, 6, row); final CheckBox visible = new CheckBox(Messages.PlotConfigVisible); visible.setSelected(trace.isVisible()); visible.setOnAction(event -> { trace.setVisible(visible.isSelected()); plot.requestUpdate(); }); layout.add(visible, 7, row++); return row; }
Example 5
Source File: EditAnnotationDialog.java From phoebus with Eclipse Public License 1.0 | 6 votes |
@Override protected void updateItem(AnnotationItem item, boolean empty) { super.updateItem(item, empty); if (item == null) return; String text = item.annotation.getTrace().getLabel() + ": " + item.annotation.getText().replaceAll("\n", "\\\\n"); if (text.length() > MAX_LENGTH) text = text.substring(0, MAX_LENGTH) + "..."; final CheckBox selector = new CheckBox(text); selector.setTextFill(item.annotation.getTrace().getColor()); selector.setSelected(true); final Button edit = new Button(Messages.AnnotationEditBtn); final BorderPane line = new BorderPane(); line.setLeft(selector); line.setRight(edit); setGraphic(line); // 'Graphic' == any Node that represents the cell selector.setOnAction(event -> item.selected = selector.isSelected()); edit.setOnAction(event -> editAnnotation(item.annotation)); }
Example 6
Source File: MultipleAxesLineChart.java From chart-fx with Apache License 2.0 | 5 votes |
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 7
Source File: Overlay.java From bisq with GNU Affero General Public License v3.0 | 5 votes |
protected void addDontShowAgainCheckBox(boolean isChecked) { if (dontShowAgainId != null) { // We might have set it and overridden the default, so we check if it is not set if (dontShowAgainText == null) dontShowAgainText = Res.get("popup.doNotShowAgain"); CheckBox dontShowAgainCheckBox = new AutoTooltipCheckBox(dontShowAgainText); HBox.setHgrow(dontShowAgainCheckBox, Priority.NEVER); buttonBox.getChildren().add(0, dontShowAgainCheckBox); dontShowAgainCheckBox.setSelected(isChecked); DontShowAgainLookup.dontShowAgain(dontShowAgainId, isChecked); dontShowAgainCheckBox.setOnAction(e -> DontShowAgainLookup.dontShowAgain(dontShowAgainId, dontShowAgainCheckBox.isSelected())); } }
Example 8
Source File: CheckBoxRepresentation.java From phoebus with Eclipse Public License 1.0 | 5 votes |
@Override protected final CheckBox createJFXNode() throws Exception { final CheckBox checkbox = new CheckBox(label); checkbox.setMinSize(ButtonBase.USE_PREF_SIZE, ButtonBase.USE_PREF_SIZE); checkbox.setMnemonicParsing(false); if (! toolkit.isEditMode()) checkbox.setOnAction(event -> handlePress()); return checkbox; }
Example 9
Source File: AcqButtonTests.java From chart-fx with Apache License 2.0 | 5 votes |
public Pane getAcquisitionBarTest(final boolean isPauseEnabled) { final VBox root = new VBox(); CheckBox cbDisabled = new CheckBox("disable acquisition buttons"); AcquisitionButtonBar acqBar = new AcquisitionButtonBar(isPauseEnabled); // overwrite default style with local preference acqBar.getStylesheets().setAll(AcquisitionButtonBar.class.getResource("acq_button_small.css").toExternalForm()); //acqBar.getStylesheets().setAll(AcquisitionButtonBar.class.getResource("acq_button_medium.css").toExternalForm()); cbDisabled.setOnAction(evt -> acqBar.setDisable(cbDisabled.isSelected())); CheckBox cb1 = new CheckBox("Property 'PlayStop' selected"); cb1.selectedProperty().bindBidirectional(acqBar.playStopStateProperty()); CheckBox cb2 = new CheckBox("Property 'Play' selected"); cb2.selectedProperty().bindBidirectional(acqBar.playStateProperty()); CheckBox cb3 = new CheckBox("Property 'Pause' selected"); cb3.selectedProperty().bindBidirectional(acqBar.pauseStateProperty()); CheckBox cb4 = new CheckBox("Property 'Stop' selected"); cb4.selectedProperty().bindBidirectional(acqBar.stopStateProperty()); root.getChildren() .addAll(new Label("AcquisitionButtonBar " + (isPauseEnabled ? "with" : "without") + " pause button functionality "), new HBox(cbDisabled), acqBar, new VBox(new Label("AcquisitionButtonBar state property values:"), cb1, cb2, cb3, cb4)); return root; }
Example 10
Source File: Exercise_16_12.java From Intro-to-Java-Programming with MIT License | 5 votes |
@Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a text area TextArea textArea = new TextArea(); textArea.setEditable(false); textArea.setWrapText(false); // Create a scrollPane ScrollPane scrollPane = new ScrollPane(textArea); // Create two check boxes CheckBox chkEditable = new CheckBox("Editable"); CheckBox chkWrap = new CheckBox("Wrap"); // Create a hbox HBox paneForButtons = new HBox(5); paneForButtons.setAlignment(Pos.CENTER); paneForButtons.getChildren().addAll(chkEditable, chkWrap); // Create a pane BorderPane pane = new BorderPane(); pane.setCenter(scrollPane); pane.setBottom(paneForButtons); // Create and register handlers chkEditable.setOnAction(e -> { textArea.setEditable(chkEditable.isSelected()); }); chkWrap.setOnAction(e -> { textArea.setWrapText(chkWrap.isSelected()); }); // Create a scene and place it in the stage Scene scene = new Scene(pane); primaryStage.setTitle("Exercise_16_12"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage }
Example 11
Source File: SnapshotTable.java From phoebus with Eclipse Public License 1.0 | 5 votes |
SelectionTableColumn() { super("", "Include this PV when restoring values", 30, 30, false); setCellValueFactory(new PropertyValueFactory<>("selected")); //for those entries, which have a read-only property, disable the checkbox setCellFactory(column -> { TableCell<TableEntry, Boolean> cell = new CheckBoxTableCell<>(null,null); cell.itemProperty().addListener((a, o, n) -> { cell.getStyleClass().remove("check-box-table-cell-disabled"); TableRow<?> row = cell.getTableRow(); if (row != null) { TableEntry item = (TableEntry) row.getItem(); if (item != null) { cell.setEditable(!item.readOnlyProperty().get()); if (item.readOnlyProperty().get()) { cell.getStyleClass().add("check-box-table-cell-disabled"); } } } }); return cell; }); setEditable(true); setSortable(false); selectAllCheckBox = new CheckBox(); selectAllCheckBox.setSelected(false); selectAllCheckBox.setOnAction(e -> getItems().stream().filter(te -> !te.readOnlyProperty().get()) .forEach(te -> te.selectedProperty().setValue(selectAllCheckBox.isSelected()))); setGraphic(selectAllCheckBox); MenuItem inverseMI = new MenuItem("Inverse Selection"); inverseMI.setOnAction(e -> getItems().stream().filter(te -> !te.readOnlyProperty().get()) .forEach(te -> te.selectedProperty().setValue(!te.selectedProperty().get()))); final ContextMenu contextMenu = new ContextMenu(inverseMI); selectAllCheckBox.setOnMouseReleased(e -> { if (e.getButton() == MouseButton.SECONDARY) { contextMenu.show(selectAllCheckBox, e.getScreenX(), e.getScreenY()); } }); }
Example 12
Source File: LogbooksTagsView.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** * Add a new CheckMenuItem to the drop down ContextMenu. * @param item - Item to be added. */ private void addToLogbookDropDown(String item) { CheckBox checkBox = new CheckBox(item); CustomMenuItem newLogbook = new CustomMenuItem(checkBox); newLogbook.setHideOnClick(false); checkBox.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { CheckBox source = (CheckBox) e.getSource(); String text = source.getText(); if (source.isSelected()) { if (! model.hasSelectedLogbook(text)) { model.addSelectedLogbook(text); } setFieldText(logbookDropDown, model.getSelectedLogbooks(), logbookField); } else { model.removeSelectedLogbook(text); setFieldText(logbookDropDown, model.getSelectedLogbooks(), logbookField); } } }); if (model.hasSelectedLogbook(item)) checkBox.fire(); logbookDropDown.getItems().add(newLogbook); }
Example 13
Source File: MultiCheckboxCombo.java From phoebus with Eclipse Public License 1.0 | 5 votes |
/** @param options Options to offer in the drop-down */ public void setOptions(final Collection<T> options) { selection.clear(); getItems().clear(); // Could use CheckMenuItem instead of CheckBox-in-CustomMenuItem, // but that adds/removes a check mark. // When _not_ selected, there's just an empty space, not // immediately obvious that item _can_ be selected. // Adding/removing one CheckMenuItem closes the drop-down, // while this approach allows it to stay open. for (T item : options) { final CheckBox checkbox = new CheckBox(item.toString()); checkbox.setUserData(item); checkbox.setOnAction(event -> { if (checkbox.isSelected()) selection.add(item); else selection.remove(item); }); final CustomMenuItem menuitem = new CustomMenuItem(checkbox); menuitem.setHideOnClick(false); getItems().add(menuitem); } }
Example 14
Source File: ScatterPlot3DFXDemo2.java From jfree-fxdemos with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static Node createDemoNode() { XYZDataset dataset = createDataset(); Chart3D chart = createChart(dataset); Chart3DViewer viewer = new Chart3DViewer(chart); BorderPane node = new BorderPane(); node.setCenter(viewer); HBox container = new HBox(); CheckBox checkBox = new CheckBox("Logarithmic Axis?"); checkBox.setSelected(true); checkBox.setOnAction((e) -> { XYZPlot plot = (XYZPlot) chart.getPlot(); if (checkBox.isSelected()) { LogAxis3D logAxis = new LogAxis3D("Y (log scale)"); logAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR); logAxis.receive(new ChartStyler(chart.getStyle())); plot.setYAxis(logAxis); } else { NumberAxis3D yAxis = new NumberAxis3D("Y"); yAxis.setTickLabelOrientation(LabelOrientation.PERPENDICULAR); yAxis.receive(new ChartStyler(chart.getStyle())); plot.setYAxis(yAxis); } }); container.setAlignment(Pos.CENTER); container.setPadding(new Insets(4.0, 4.0, 4.0, 4.0)); container.getChildren().add(checkBox); node.setBottom(container); return node; }
Example 15
Source File: OptionalModuleEditor.java From old-mzmine3 with GNU General Public License v2.0 | 5 votes |
public OptionalModuleEditor(PropertySheet.Item parameter) { if (!(parameter instanceof OptionalModuleParameter)) throw new IllegalArgumentException(); this.optionalModuleParameter = (OptionalModuleParameter) parameter; checkBox = new CheckBox(); setButton = new Button("Setup.."); setButton.setFocusTraversable(false); checkBox.setOnAction(e -> { setButton.setDisable(!checkBox.isSelected()); }); setButton.setDisable(true); setButton.setOnAction(e -> { optionalModuleParameter.getEmbeddedParameters().showSetupDialog(null); // Fire the checkBox to update the validation decorations checkBox.setSelected(false); checkBox.setSelected(true); }); // FlowPane setting setHgap(10); getChildren().addAll(checkBox, setButton); }
Example 16
Source File: ShotSectorPane.java From ShootOFF with GNU General Public License v3.0 | 5 votes |
public ShotSectorPane(Pane parent, CameraManager cameraManager) { final GridPane checkboxGrid = new GridPane(); sectors = new CheckBox[JavaShotDetector.SECTOR_ROWS][JavaShotDetector.SECTOR_COLUMNS]; for (int x = 0; x < JavaShotDetector.SECTOR_COLUMNS; x++) { for (int y = 0; y < JavaShotDetector.SECTOR_ROWS; y++) { final CheckBox sector = new CheckBox(); sectors[y][x] = sector; sector.setSelected(cameraManager.isSectorOn(x, y)); sector.setOnAction((event) -> { cameraManager.setSectorStatuses(getSectorStatuses()); }); checkboxGrid.add(sector, x, y); } } final Button doneButton = new Button("Done"); doneButton.setOnAction((event) -> { parent.getChildren().remove(this); }); setTop(checkboxGrid); setLeft(doneButton); parent.getChildren().add(this); }
Example 17
Source File: TopsoilPlotWetherill.java From ET_Redux with Apache License 2.0 | 4 votes |
@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; }
Example 18
Source File: BouncingTargets.java From ShootOFF with GNU General Public License v3.0 | 4 votes |
private void addSettingControls() { final GridPane bouncingTargetsPane = new GridPane(); final ColumnConstraints cc = new ColumnConstraints(100); cc.setHalignment(HPos.CENTER); bouncingTargetsPane.getColumnConstraints().addAll(new ColumnConstraints(), cc); final int MAX_TARGETS = 10; final int MAX_VELOCITY = 30; final int SHOOT_DEFAULT_COUNT = 4 - 1; final int DONT_SHOOT_DEFAULT_COUNT = 1 - 1; final int DEFAULT_MAX_VELOCITY = 10; final ObservableList<String> targetCounts = FXCollections.observableArrayList(); for (int i = 1; i <= MAX_TARGETS; i++) targetCounts.add(Integer.toString(i)); final ComboBox<String> shootTargetsComboBox = new ComboBox<>(targetCounts); shootTargetsComboBox.getSelectionModel().select(SHOOT_DEFAULT_COUNT); shootTargetsComboBox.valueProperty().addListener((observable, oldValue, newValue) -> { shootCount = Integer.parseInt(newValue); stopExercise(); startExercise(); }); bouncingTargetsPane.add(new Label("Shoot Targets:"), 0, 0); bouncingTargetsPane.add(shootTargetsComboBox, 1, 0); final ComboBox<String> dontShootTargetsComboBox = new ComboBox<>(targetCounts); dontShootTargetsComboBox.getSelectionModel().select(DONT_SHOOT_DEFAULT_COUNT); dontShootTargetsComboBox.valueProperty().addListener((observable, oldValue, newValue) -> { dontShootCount = Integer.parseInt(newValue); stopExercise(); startExercise(); }); bouncingTargetsPane.add(new Label("Don't Shoot Targets:"), 0, 1); bouncingTargetsPane.add(dontShootTargetsComboBox, 1, 1); final ObservableList<String> maxVelocity = FXCollections.observableArrayList(); for (int i = 1; i <= MAX_VELOCITY; i++) maxVelocity.add(Integer.toString(i)); final ComboBox<String> maxVelocityComboBox = new ComboBox<>(maxVelocity); maxVelocityComboBox.getSelectionModel().select(DEFAULT_MAX_VELOCITY - 1); maxVelocityComboBox.valueProperty().addListener((observable, oldValue, newValue) -> { BouncingTargets.maxVelocity = Integer.parseInt(newValue); stopExercise(); startExercise(); }); bouncingTargetsPane.add(new Label("Max Target Speed:"), 0, 2); bouncingTargetsPane.add(maxVelocityComboBox, 1, 2); final CheckBox removeTargets = new CheckBox(); removeTargets.setOnAction((event) -> removeShootTargets = removeTargets.isSelected()); bouncingTargetsPane.add(new Label("Remove Hit Shoot Targets:"), 0, 3); bouncingTargetsPane.add(removeTargets, 1, 3); super.addExercisePane(bouncingTargetsPane); }
Example 19
Source File: AddPVDialog.java From phoebus with Eclipse Public License 1.0 | 4 votes |
private Node createContent(final Model model, final int count) { final GridPane layout = new GridPane(); // layout.setGridLinesVisible(true); layout.setHgap(5); layout.setVgap(5); final ColumnConstraints stay = new ColumnConstraints(); final ColumnConstraints fill = new ColumnConstraints(); fill.setHgrow(Priority.ALWAYS); layout.getColumnConstraints().addAll(stay, stay, fill); axis_options = FXCollections.observableArrayList(model.getAxes().stream().map(AxisConfig::getName).collect(Collectors.toList())); axis_options.add(0, Messages.AddPV_NewOrEmptyAxis); int row = -1; for (int i=0; i<count; ++i) { final String nm = count == 1 ? Messages.Name : Messages.Name + " " + (i+1); layout.add(new Label(nm), 0, ++row); final TextField name = new TextField(); name.textProperty().addListener(event -> checkDuplicateName(name)); name.setTooltip(new Tooltip(formula ? Messages.AddFormula_NameTT : Messages.AddPV_NameTT)); if (! formula) PVAutocompleteMenu.INSTANCE.attachField(name); names.add(name); layout.add(name, 1, row, 2, 1); if (! formula) { layout.add(new Label(Messages.AddPV_Period), 0, ++row); final TextField period = new TextField(Double.toString(Preferences.scan_period)); period.setTooltip(new Tooltip(Messages.AddPV_PeriodTT)); periods.add(period); period.setDisable(true); layout.add(period, 1, row); final CheckBox monitor = new CheckBox(Messages.AddPV_OnChange); monitor.setTooltip(new Tooltip(Messages.AddPV_OnChangeTT)); monitor.setSelected(true); monitors.add(monitor); monitor.setOnAction(event -> period.setDisable(monitor.isSelected())); layout.add(monitors.get(i), 2, row); } layout.add(new Label(Messages.AddPV_Axis), 0, ++row); final ChoiceBox<String> axis = new ChoiceBox<>(axis_options); axis.setTooltip(new Tooltip(Messages.AddPV_AxisTT)); axis.getSelectionModel().select(0); axes.add(axis); layout.add(axes.get(i), 1, row); layout.add(new Separator(), 0, ++row, 3, 1); } return layout; }
Example 20
Source File: TopsoilPlotEvolution.java From ET_Redux with Apache License 2.0 | 4 votes |
@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; }