private void createMarginFields() { NumericTextField topField = new NumericTextField(); NumericTextField rightField = new NumericTextField(); NumericTextField bottomField = new NumericTextField(); NumericTextField leftField = new NumericTextField(); StringConverter<Number> converter = new NumberStringConverter(); leftField.textProperty().bindBidirectional(getSkinnable().leftMarginProperty(), converter); rightField.textProperty().bindBidirectional(getSkinnable().rightMarginProperty(), converter); topField.textProperty().bindBidirectional(getSkinnable().topMarginProperty(), converter); bottomField.textProperty().bindBidirectional(getSkinnable().bottomMarginProperty(), converter); marginsGridPane = new GridPane(); marginsGridPane.getStyleClass().add("custom-fields"); marginsGridPane.add(new Label(Messages.getString("MarginSelector.TOP")), 0, 0); marginsGridPane.add(topField, 1, 0); marginsGridPane.add(new Label(Messages.getString("MarginSelector.RIGHT")), 2, 0); marginsGridPane.add(rightField, 3, 0); marginsGridPane.add(new Label(Messages.getString("MarginSelector.BOTTOM")), 0, 1); marginsGridPane.add(bottomField, 1, 1); marginsGridPane.add(new Label(Messages.getString("MarginSelector.LEFT")), 2, 1); marginsGridPane.add(leftField, 3, 1); }
public void changed(GroupEntity previousSelected, GroupEntity currentSelected) { if (previousSelected != null) { xPosField.textProperty().unbindBidirectional(previousSelected.getRect().xProperty()); yPosField.textProperty().unbindBidirectional(previousSelected.getRect().yProperty()); heightField.textProperty().unbindBidirectional(previousSelected.getRect().heightProperty()); widthField.textProperty().unbindBidirectional(previousSelected.getRect().widthProperty()); rotateField.textProperty().unbindBidirectional(previousSelected.rotateProperty()); } if (currentSelected != null) { xPosField.textProperty().bindBidirectional(currentSelected.getRect().xProperty(), new NumberStringConverter()); yPosField.textProperty().bindBidirectional(currentSelected.getRect().yProperty(), new NumberStringConverter()); heightField.textProperty().bindBidirectional(currentSelected.getRect().heightProperty(), new NumberStringConverter()); widthField.textProperty().bindBidirectional(currentSelected.getRect().widthProperty(), new NumberStringConverter()); rotateField.textProperty().bindBidirectional(currentSelected.rotateProperty(), new NumberStringConverter()); } }
@FXML private void initialize(){ circleButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.CIRCLE)); squareButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.SQUARE)); diamondButton.selectedProperty().bindBidirectional(presenter.getShapeProperty().getToggle(Shape.DIAMOND)); airbrushButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.AIRBRUSH)); roughButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.ROUGH)); noiseButton.selectedProperty().bindBidirectional(presenter.getModeProperty().getToggle(Mode.NOISE)); sizeSlider.setMax(PencilConfiguratorPresenter.MAX_SIZE); sizeSlider.valueProperty().bindBidirectional(presenter.getSizeProperty()); sizeField.textProperty().bindBidirectional(presenter.getSizeProperty(), new NumberStringConverter()); strengthSlider.valueProperty().bindBidirectional(presenter.getStrengthProperty()); strengthField.textProperty().bindBidirectional(presenter.getStrengthProperty(), new NumberStringConverter()); }
@PostConstruct public void init() { // Since this is a special page, we only allow to go back from here. this.backButton.setVisible(false); this.nextButton.setVisible(false); this.finishButton.setText("Back"); // Bind to datamodel mapDBAptamerPoolBloomFilterCapacityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolBloomFilterCapacity(), new NumberStringConverter()); mapDBAptamerPoolBloomFilterCollisionProbabilityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolBloomFilterCollisionProbability(), new NumberStringConverter()); mapDBAptamerPoolMaxTreeMapCapacityTextField.textProperty().bindBidirectional(getDataModel().getMapDBAptamerPoolMaxTreeMapCapacity(), new NumberStringConverter()); mapDBSelectionCycleBloomFilterCollisionProbabilityTextField.textProperty().bindBidirectional(getDataModel().getMapDBSelectionCycleBloomFilterCollisionProbability(), new NumberStringConverter()); performanceMaxNumberOfCoresSpinner.getValueFactory().valueProperty().bindBidirectional(getDataModel().getPerformanceMaxNumberOfCores()); }
@Override public void initialize(final URL location, final ResourceBundle resources) { nodeId.setTextFormatter(new TextFormatter<>(new NumberStringConverter())); radius.setTextFormatter(new TextFormatter<>(new NumberStringConverter())); currentNodeId.textProperty().bind(graphDimensionsCalculator.getCenterNodeIdProperty().asString()); currentRadius.textProperty().bind(graphDimensionsCalculator.getRadiusProperty().asString()); graphDimensionsCalculator.getCenterNodeIdProperty().addListener( (observable, oldValue, newValue) -> nodeId.setText(String.valueOf(newValue))); graphDimensionsCalculator.getRadiusProperty().addListener( (observable, oldValue, newValue) -> radius.setText(String.valueOf(newValue))); }
/** * Pokusí se přidat item do slotu. * Pokud slot neobsahuje žádný item, tak je vložen celý. * Pokud slot obsahuje jiný item, tak se nic nevloží, jinak se pouze přičte počet * * @param item {@link ItemBase} * @param ammount Počet, který se má přidat */ public void addItem(ItemBase item, int ammount) { if (itemStack == null) { itemStack = new ItemStack(item, ammount); lblAmmount.textProperty() .bindBidirectional(itemStack.ammountProperty(), new NumberStringConverter()); setImage(item.getImage()); itemStack.getItem().imageProperty().addListener(imageChangeListener); return; } if (itemStack.containsItemType(item)) { itemStack.addAmmount(ammount); } }
public static void initTextFormater(TextField textField, MaxActValue maxActValue) { textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter())); textField.setTextFormatter(new TextFormatter<>(new NumberStringConverter(), null, FormUtils.integerFilter( maxActValue.getMinValue().intValue(), maxActValue.getMaxValue().intValue() ))); textField.textProperty().bindBidirectional(maxActValue.actValueProperty(), new NumberStringConverter()); }
public void start(Stage stage) throws Exception { Customer customer = Customer.createSample(555); DirtyState dirtyState = new DirtyState(customer); Form form = new Form(); form.setPadding(new Insets(20)); Fieldset contactInfo = form.fieldset("Contact Information"); TextField idInput = new TextField(); idInput.textProperty().bindBidirectional(customer.idProperty(), new NumberStringConverter()); contactInfo.field("Id", idInput); TextField usernameInput = new TextField(); usernameInput.textProperty().bindBidirectional(customer.usernameProperty()); contactInfo.field("Username", usernameInput); TextField zipInput = new TextField(); zipInput.textProperty().bindBidirectional(customer.zipProperty()); zipInput.setMinWidth(80); zipInput.setMaxWidth(80); TextField cityInput = new TextField(); cityInput.textProperty().bindBidirectional(customer.cityProperty()); contactInfo.field("Zip/City", zipInput, cityInput); Button saveButton = new Button("Save"); saveButton.disableProperty().bind(dirtyState.not()); saveButton.setOnAction(event -> dirtyState.reset()); Button undoButton = new Button("Undo"); undoButton.setOnAction(event -> dirtyState.undo()); undoButton.visibleProperty().bind(dirtyState); contactInfo.field(saveButton, undoButton); stage.setScene(new Scene(form, 400,-1)); stage.show(); }
private TableView<Pojo> buildTable() { TableView<Pojo> table = new TableView<>(); table.setEditable(true); table.getItems().addAll(buildPojoList()); TableColumn<Pojo, String> columnA = new TableColumn<>("ColA"); TableColumn<Pojo, String> columnB = new TableColumn<>("ColB"); TableColumn<Pojo, Number> columnC = new TableColumn<>("ColB"); columnA.setCellValueFactory(new PropertyValueFactory<Pojo, String>("a")); columnB.setCellValueFactory(new PropertyValueFactory<Pojo, String>("b")); columnC.setCellValueFactory(new PropertyValueFactory<Pojo, Number>("c")); columnA.setCellFactory(TextFieldTableCell.forTableColumn()); columnB.setCellFactory(TextFieldTableCell.forTableColumn()); columnC.setCellFactory(param -> new TextFieldTableCell<>(new NumberStringConverter())); columnA.setOnEditCommit(event -> event.getRowValue().setA(event.getNewValue())); columnB.setOnEditCommit(event -> event.getRowValue().setB(event.getNewValue())); columnC.setOnEditCommit(event -> event.getRowValue().setC(event.getNewValue().intValue())); columnA.setSortable(true); columnB.setSortable(true); columnC.setSortable(true); table.getColumns().add(columnA); table.getColumns().add(columnB); table.getColumns().add(columnC); columnA.prefWidthProperty().bind(table.widthProperty().multiply(0.33)); columnB.prefWidthProperty().bind(table.widthProperty().multiply(0.33)); columnC.prefWidthProperty().bind(table.widthProperty().multiply(0.33)); TableFilter<Pojo> tableFilter = new TableFilter<>(table); tableFilter.filterColumn(columnA); tableFilter.filterColumn(columnB); tableFilter.filterColumn(columnC); return table; }
public void initialize() { final ObservableList<MsSpectrumType> renderingChoices = FXCollections.observableArrayList(MsSpectrumType.CENTROIDED, MsSpectrumType.PROFILE); renderingTypeColumn.setCellFactory(ChoiceBoxTableCell.forTableColumn(renderingChoices)); colorColumn.setCellFactory(column -> new ColorTableCell<MsSpectrumDataSet>(column)); lineThicknessColumn .setCellFactory(column -> new SpinnerTableCell<MsSpectrumDataSet>(column, 1, 5)); intensityScaleColumn.setCellFactory(TextFieldTableCell.forTableColumn( new NumberStringConverter(MZmineCore.getConfiguration().getIntensityFormat()))); showDataPointsColumn .setCellFactory(column -> new CheckBoxTableCell<MsSpectrumDataSet, Boolean>() { { tableRowProperty().addListener(e -> { TableRow<?> row = getTableRow(); if (row == null) return; MsSpectrumDataSet dataSet = (MsSpectrumDataSet) row.getItem(); if (dataSet == null) return; disableProperty() .bind(dataSet.renderingTypeProperty().isEqualTo(MsSpectrumType.CENTROIDED)); }); } }); }
/** * initializes the bindings of the sliders and the analysis pane */ private void initializeBindings() { //First, bind the LoadedData.analyzeAll boolean property to the radio buttons LoadedData.analyzeSelectedProperty().bind(compareSelectedSamplesButton.selectedProperty()); //Since the slider value property is double and the text field property is a string, we need to convert them //Defining own class to avoid exceptions class MyNumberStringConverter extends NumberStringConverter { @Override public Number fromString(String value) { try { return super.fromString(value); } catch (RuntimeException ex) { return 0; } } } StringConverter<Number> converter = new MyNumberStringConverter(); //Bind every slider to its corresponding text field and vice versa Bindings.bindBidirectional(minPosCorrelationText.textProperty(), posCorrelationRangeSlider.lowValueProperty(), converter); Bindings.bindBidirectional(maxPosCorrelationText.textProperty(), posCorrelationRangeSlider.highValueProperty(), converter); Bindings.bindBidirectional(minNegCorrelationText.textProperty(), negCorrelationRangeSlider.lowValueProperty(), converter); Bindings.bindBidirectional(maxNegCorrelationText.textProperty(), negCorrelationRangeSlider.highValueProperty(), converter); Bindings.bindBidirectional(maxPValueText.textProperty(), maxPValueSlider.valueProperty(), converter); Bindings.bindBidirectional(minFrequencyText.textProperty(), frequencyRangeSlider.lowValueProperty(), converter); Bindings.bindBidirectional(maxFrequencyText.textProperty(), frequencyRangeSlider.highValueProperty(), converter); Bindings.bindBidirectional(excludeFrequencyText.textProperty(), excludeFrequencySlider.valueProperty(), converter); //Bind the internal filter properties to the slider values AnalysisData.posCorrelationLowerFilterProperty().bind(posCorrelationRangeSlider.lowValueProperty()); AnalysisData.posCorrelationUpperFilterProperty().bind(posCorrelationRangeSlider.highValueProperty()); AnalysisData.negCorrelationLowerFilterProperty().bind(negCorrelationRangeSlider.lowValueProperty()); AnalysisData.negCorrelationUpperFilterProperty().bind(negCorrelationRangeSlider.highValueProperty()); AnalysisData.minFrequencyProperty().bind(frequencyRangeSlider.lowValueProperty()); AnalysisData.maxFrequencyProperty().bind(frequencyRangeSlider.highValueProperty()); AnalysisData.maxPValueProperty().bind(maxPValueSlider.valueProperty()); AnalysisData.excludeFrequencyThresholdProperty().bind(excludeFrequencySlider.valueProperty()); //The values of the negative slider can't be set to values below 0 via FXML for reasons beyond human understanding, // so we set them manually negCorrelationRangeSlider.setLowValue(-1); negCorrelationRangeSlider.setHighValue(-0.5); //We want the graph to be redone if one of the following occurs: //1. Radio button switches between "Analyze All" and "Analyze Selected" compareSelectedSamplesButton.selectedProperty().addListener(observable -> { if ((!compareSelectedSamplesButton.isSelected() || LoadedData.getSelectedSamples().size() >= 3) && rankChoiceBox.getValue() != null) startAnalysis(); }); //2. Rank selection changes rankChoiceBox.valueProperty().addListener((observable, oldValue, newValue) -> { if (newValue != null && LoadedData.getSamplesToAnalyze().size()>=3) { AnalysisData.setLevel_of_analysis(newValue.toLowerCase()); startAnalysis(); } }); //3. Sample selection changes while "Analyze Selected" is selected AND at least three samples are selected LoadedData.getSelectedSamples().addListener((InvalidationListener) observable -> { if (compareSelectedSamplesButton.isSelected() && LoadedData.getSelectedSamples().size() >= 3) { startAnalysis(); } }); //4. Correlation radio button is changed pearsonCorrelationButton.selectedProperty().addListener(o -> startAnalysis()); spearmanCorrelationButton.selectedProperty().addListener(o -> startAnalysis()); kendallCorrelationButton.selectedProperty().addListener(o -> startAnalysis()); //5. Global frequency threshold is changed excludeFrequencySlider.valueProperty().addListener(o -> startAnalysis()); }
@Override public void initialize(URL location, ResourceBundle resources) { terrainName.textProperty().bindBidirectional(terrainProperties.name); terrainSize.textProperty().bindBidirectional(terrainProperties.size, new NumberStringConverter()); terrainLocation.textProperty().bindBidirectional(terrainProperties.location); }
public static TextField numberFieldFor(Property p){ TextField tf = new TextField(); tf.textProperty().bindBidirectional(p, new NumberStringConverter()); return tf; }
public void setStellarObject(StellarObjectModel stellarObject) { this.stellarObject = stellarObject; this.epochTextField.getInnerTextField().textProperty().bindBidirectional(stellarObject.epochProperty(), new NumberStringConverter(Locale.ENGLISH, "#.####")); this.periodTextField.getInnerTextField().textProperty().bindBidirectional(stellarObject.periodProperty(), new NumberStringConverter(Locale.ENGLISH, "#.##########")); }
public Scene createScene() { String basename = getClass().getPackage().getName().replace('.', '/') + "/app"; URL fxml = getClass().getClassLoader().getResource(basename + ".fxml"); FXMLLoader fxmlLoader = new FXMLLoader(fxml); fxmlLoader.setControllerFactory(param -> AppView.this); Parent root = null; try { root = (Parent) fxmlLoader.load(); } catch (IOException e) { throw new IllegalStateException(e); } organization.textProperty().addListener((observable, oldValue, newValue) -> { model.setState(isBlank(newValue) ? DISABLED : READY); }); model.stateProperty().addListener((observable, oldValue, newValue) -> Platform.runLater(() -> { switch (newValue) { case DISABLED: enabled.setValue(false); running.setValue(false); break; case READY: enabled.setValue(true); running.setValue(false); break; case RUNNING: enabled.setValue(false); running.setValue(true); break; } })); ObservableList<Repository> items = createJavaFXThreadProxyList(model.getRepositories().sorted()); repositories.setItems(items); EventStreams.sizeOf(items).subscribe(v -> total.setText(String.valueOf(v))); organization.textProperty().bindBidirectional(model.organizationProperty()); bindBidirectional(limit.textProperty(), model.limitProperty(), new NumberStringConverter()); loadButton.disableProperty().bind(Bindings.not(enabled)); cancelButton.disableProperty().bind(Bindings.not(running)); progress.visibleProperty().bind(running); Scene scene = new Scene(root); scene.getStylesheets().addAll(basename + ".css", "bootstrapfx.css"); return scene; }
private void initNavigationPane() { //region *** Buttons *** backButton.setOnAction(this::handleHistoryBack); forwardButton.setOnAction(this::handleHistoryForward); refreshButton.setOnAction(this::handleRefresh); snapshotButton.setOnAction(this::handleTakeSnapshot); forwardButton.setOnAction(this::handleHistoryForward); backButton.disableProperty().bind(backwardHistory.emptyStackProperty); forwardButton.disableProperty().bind(forwardHistory.emptyStackProperty); //endregion //region *** Time pickers *** this.currentState = new XYChartViewState(getWorksheet().getFromDateTime(), getWorksheet().getToDateTime(), 0, 100); getWorksheet().fromDateTimeProperty().bind(currentState.startX); getWorksheet().toDateTimeProperty().bind(currentState.endX); plotChart(currentState.asSelection(), true); endDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty()); startDate.zoneIdProperty().bind(getWorksheet().timeZoneProperty()); startDate.dateTimeValueProperty().bindBidirectional(currentState.startX); endDate.dateTimeValueProperty().bindBidirectional(currentState.endX); //endregion //region *** Crosshair *** DateTimeFormatter dateTimeFormatter = DateTimeFormatter.RFC_1123_DATE_TIME;// DateTimeFormatter.ofLocalizedDateTime(FormatStyle.SHORT, FormatStyle.MEDIUM); NumberStringConverter numberFormatter = new NumberStringConverter(Locale.getDefault(Locale.Category.FORMAT)); crossHair = new XYChartCrosshair<>(chart, chartParent, dateTimeFormatter::format, n -> String.format("%,.2f", n.doubleValue())); crossHair.onSelectionDone(s -> { logger.debug(() -> "Applying zoom selection: " + s.toString()); currentState.setSelection(s, true); }); hCrosshair.selectedProperty().bindBidirectional(globalPrefs.horizontalMarkerOnProperty()); vCrosshair.selectedProperty().bindBidirectional(globalPrefs.verticalMarkerOnProperty()); crossHair.horizontalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isShiftPressed() || hCrosshair.isSelected(), hCrosshair.selectedProperty(), globalPrefs.shiftPressedProperty())); crossHair.verticalMarkerVisibleProperty().bind(Bindings.createBooleanBinding(() -> globalPrefs.isCtrlPressed() || vCrosshair.isSelected(), vCrosshair.selectedProperty(), globalPrefs.ctrlPressedProperty())); currentColumn.setVisible(crossHair.isVerticalMarkerVisible()); crossHair.verticalMarkerVisibleProperty().addListener((observable, oldValue, newValue) -> currentColumn.setVisible(newValue)); setAndBindTextFormatter(yMinRange, numberFormatter, currentState.startY, ((ValueAxis<Double>) chart.getYAxis()).lowerBoundProperty()); setAndBindTextFormatter(yMaxRange, numberFormatter, currentState.endY, ((ValueAxis<Double>) chart.getYAxis()).upperBoundProperty()); //endregion }
public void initialize(java.net.URL location, java.util.ResourceBundle resources) { preferences = Preferences.userNodeForPackage(this.getClass()); replayController = new ReplayController(); BooleanBinding runnerIsNull = Bindings.createBooleanBinding(() -> replayController.getRunner() == null, replayController.runnerProperty()); buttonPlay.disableProperty().bind(runnerIsNull.or(replayController.playingProperty())); buttonPause.disableProperty().bind(runnerIsNull.or(replayController.playingProperty().not())); slider.disableProperty().bind(runnerIsNull); replayController.changingProperty().bind(slider.valueChangingProperty()); labelTick.textProperty().bindBidirectional(replayController.tickProperty(), new NumberStringConverter()); labelLastTick.textProperty().bindBidirectional(replayController.lastTickProperty(), new NumberStringConverter()); slider.maxProperty().bind(replayController.lastTickProperty()); replayController.tickProperty().addListener((observable, oldValue, newValue) -> { if (!slider.isValueChanging()) { slider.setValue(newValue.intValue()); } }); slider.valueProperty().addListener((observable, oldValue, newValue) -> { replayController.getRunner().setDemandedTick(newValue.intValue()); }); TableColumn<ObservableEntity, String> entityTableIdColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(0); entityTableIdColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().indexProperty() : new ReadOnlyStringWrapper("")); TableColumn<ObservableEntity, String> entityTableNameColumn = (TableColumn<ObservableEntity, String>) entityTable.getColumns().get(1); entityTableNameColumn.setCellValueFactory(param -> param.getValue() != null ? param.getValue().nameProperty() : new ReadOnlyStringWrapper("")); entityTable.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { log.info("entity table selection from {} to {}", oldValue, newValue); detailTable.setItems(newValue); }); TableColumn<ObservableEntityProperty, String> idColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(0); idColumn.setCellValueFactory(param -> param.getValue().indexProperty()); TableColumn<ObservableEntityProperty, String> nameColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(1); nameColumn.setCellValueFactory(param -> param.getValue().nameProperty()); TableColumn<ObservableEntityProperty, String> valueColumn = (TableColumn<ObservableEntityProperty, String>) detailTable.getColumns().get(2); valueColumn.setCellValueFactory(param -> param.getValue().valueProperty()); entityNameFilter.textProperty().addListener(observable -> { if (filteredEntityList != null) { filteredEntityList.setPredicate(allFilterFunc); filteredEntityList.setPredicate(filterFunc); } }); mapControl = new MapControl(); mapCanvasPane.getChildren().add(mapControl); mapCanvasPane.setTopAnchor(mapControl, 0.0); mapCanvasPane.setBottomAnchor(mapControl, 0.0); mapCanvasPane.setLeftAnchor(mapControl, 0.0); mapCanvasPane.setRightAnchor(mapControl, 0.0); mapCanvasPane.widthProperty().addListener(evt -> resizeMapControl()); mapCanvasPane.heightProperty().addListener(evt -> resizeMapControl()); }
@FXML public void initialize() { NumberFormat xAxisFormatter; if (xAxis instanceof NumberAxis) xAxisFormatter = ((NumberAxis) xAxis).getNumberFormatOverride(); else xAxisFormatter = NumberFormat.getNumberInstance(); NumberFormat yAxisFormatter; if (yAxis instanceof NumberAxis) yAxisFormatter = ((NumberAxis) yAxis).getNumberFormatOverride(); else yAxisFormatter = NumberFormat.getNumberInstance(); xAxisLabel.setText(xAxis.getLabel()); yAxisLabel.setText(yAxis.getLabel()); xAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter))); xAxisRangeMin.disableProperty().bind(xAxisAutoRange.selectedProperty()); xAxisRangeMin.setText(String.valueOf(xAxis.getLowerBound())); xAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(xAxisFormatter))); xAxisRangeMax.disableProperty().bind(xAxisAutoRange.selectedProperty()); xAxisRangeMax.setText(String.valueOf(xAxis.getUpperBound())); xAxisAutoRange.setSelected(xAxis.isAutoRange()); yAxisRangeMin.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisRangeMin.setText(String.valueOf(yAxis.getLowerBound())); yAxisRangeMin.disableProperty().bind(yAxisAutoRange.selectedProperty()); yAxisRangeMax.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisRangeMax.setText(String.valueOf(yAxis.getUpperBound())); yAxisRangeMax.disableProperty().bind(yAxisAutoRange.selectedProperty()); yAxisAutoRange.setSelected(yAxis.isAutoRange()); xAxisTickSize.disableProperty().bind(xAxisAutoTickSize.selectedProperty()); xAxisTickSize.setText(String.valueOf(xAxis.getTickUnit().getSize())); xAxisAutoTickSize.setSelected(xAxis.isAutoTickUnitSelection()); yAxisTickSize.setTextFormatter(new TextFormatter<>(new NumberStringConverter(yAxisFormatter))); yAxisTickSize.setText(String.valueOf(yAxis.getTickUnit().getSize())); yAxisTickSize.disableProperty().bind(yAxisAutoTickSize.selectedProperty()); yAxisAutoTickSize.setSelected(yAxis.isAutoTickUnitSelection()); }
/** Generate button event handler */ @FXML public void generate() { // Artificial Value Generation pop-up menu final Stage options = new Stage(); options.initModality(Modality.APPLICATION_MODAL); options.initOwner(mainApp.getStage()); HBox optionsBox = new HBox(10); optionsBox.setPadding(new Insets(10, 15, 10, 15)); Button ok = new Button("OK"); Label amountOfRowsLabel = new Label("Amount of row: "); // Artificial Value Generation Slider final Slider amountOfRows = new Slider(0, 500, 1); amountOfRows .valueProperty() .addListener((obs, oldVal, newVal) -> amountOfRows.setValue(newVal.intValue())); amountOfRows.setShowTickLabels(true); amountOfRows.setShowTickMarks(true); amountOfRows.setMajorTickUnit(50); amountOfRows.setMinorTickCount(5); TextField amountOfRowsValue = new TextField(String.valueOf(amountOfRows.getValue())); amountOfRowsValue.textProperty().bindBidirectional(amountOfRows.valueProperty(), new NumberStringConverter()); optionsBox.getChildren().add(amountOfRowsLabel); optionsBox.getChildren().add(amountOfRows); optionsBox.getChildren().add(amountOfRowsValue); optionsBox.getChildren().add(ok); Scene optionScene = new Scene(optionsBox, 600, 60); options.setResizable(false); options.setTitle("Artificial Value Generation"); options.setScene(optionScene); options.show(); resultText.appendText("\nArtificial values have been generated\n"); // Artificial Value Generation Event Handler ok.setOnAction(e -> { realLayersFeatures.clear(); for (int i = 0; i < Math.round(amountOfRows.getValue()); i++) { double sponginess = ArtificialValueGenerator.getRandom3Sigma(); double amountOfClay = ArtificialValueGenerator.getRandom3Sigma(); double amountOfCarbonate = ArtificialValueGenerator.getRandom3Sigma(); double vPAmplitude = ArtificialValueGenerator.getRandom3Sigma(); realLayersFeatures.add(new RealLayerFeatures(i+1, sponginess, amountOfClay, amountOfCarbonate, vPAmplitude)); options.close(); } }); }
@Override public void initialize(URL location, ResourceBundle resources) { ProtocolConfiguration prop = con.getConfiguration(); historyList.setItems(ctx.getHistory()); clearBtn.setOnAction(a -> historyList.getItems().clear()); securityCombo.getItems().addAll(FXCollections.observableArrayList(SecurityType.NONE, SecurityType.VNC_Auth)); securityCombo.getSelectionModel().selectedItemProperty().addListener((l, a, b) -> { prop.securityProperty().set(b != null ? b : SecurityType.UNKNOWN); }); pwdField.disableProperty().bind(Bindings.equal(SecurityType.NONE, securityCombo.getSelectionModel().selectedItemProperty())); prop.hostProperty().bindBidirectional(ipField.textProperty()); StringConverter<Number> converter = new NumberStringConverter("#"); Bindings.bindBidirectional(portField.textProperty(), prop.portProperty(), converter); prop.passwordProperty().bindBidirectional(pwdField.textProperty()); prop.sslProperty().bindBidirectional(sslCB.selectedProperty()); prop.sharedProperty().bindBidirectional(sharedCB.selectedProperty()); forceRfb33CB.setSelected(prop.versionProperty().get() == ProtocolVersion.RFB_3_3); forceRfb33CB.selectedProperty().addListener((l, a, b) -> prop.versionProperty().set(b ? ProtocolVersion.RFB_3_3 : ProtocolVersion.RFB_3_8)); listeningCB.selectedProperty().bindBidirectional(con.listeningModeProperty()); Bindings.bindBidirectional(listeningPortField.textProperty(), con.listeningPortProperty(), converter); listeningPortField.disableProperty().bind(listeningCB.selectedProperty().not()); prop.rawEncProperty().bindBidirectional(rawCB.selectedProperty()); prop.copyRectEncProperty().bindBidirectional(copyrectCB.selectedProperty()); prop.hextileEncProperty().bindBidirectional(hextileCB.selectedProperty()); prop.clientCursorProperty().bindBidirectional(cursorCB.selectedProperty()); prop.desktopSizeProperty().bindBidirectional(desktopCB.selectedProperty()); prop.zlibEncProperty().bindBidirectional(zlibCB.selectedProperty()); portField.textProperty().addListener((observable, oldValue, newValue) -> { if (newValue != null && !newValue.isEmpty() && !newValue.matches("[0-9]+")) { if (!oldValue.matches("[0-9]+")) { ((StringProperty) observable).setValue(""); return; } ((StringProperty) observable).setValue(oldValue); } }); con.connectingProperty().addListener((l, a, b) -> Platform.runLater(() -> ipField.getParent().setDisable(b))); ctx.bind(ipField.textProperty(), "hostField"); ctx.bind(portField.textProperty(), "portField"); ctx.bind(userField.textProperty(), "userField"); ctx.bind(pwdField.textProperty(), "pwdField"); ctx.bind(securityCombo, "authType"); ctx.bind(sslCB.selectedProperty(), "useSSL"); ctx.bind(sharedCB.selectedProperty(), "useSharedView"); ctx.bind(forceRfb33CB.selectedProperty(), "forceRfb33"); ctx.bind(listeningCB.selectedProperty(), "listeningMode"); ctx.bind(listeningPortField.textProperty(), "listeningPortField"); ctx.bind(rawCB.selectedProperty(), "useRaw"); ctx.bind(copyrectCB.selectedProperty(), "useCopyRect"); ctx.bind(hextileCB.selectedProperty(), "useHextile"); ctx.bind(cursorCB.selectedProperty(), "useCursor"); ctx.bind(desktopCB.selectedProperty(), "useDesktopSize"); ctx.bind(zlibCB.selectedProperty(), "useZlib"); if (securityCombo.getSelectionModel().getSelectedIndex() < 0) { securityCombo.getSelectionModel().select(SecurityType.VNC_Auth); } historyList.getSelectionModel().selectedItemProperty().addListener((l, a, b) -> updateData(b)); con.connectInfoProperty().addListener((l, a, b) -> Platform.runLater(() -> addToHistory(b))); }
/** * Initializes the controller class. */ @Override public void initialize(URL url, ResourceBundle rb) { fillTableComboBoxes(); additionalPartNoTable.setItems(pfx.getAdditionalPartNos()); priceTable.setItems(pfx.getPrices()); additionalPartNoTable.setEditable(true); priceTable.setEditable(true); tradeNameColumn.setCellValueFactory(new PropertyValueFactory<>("contractor")); partNoColumn.setCellFactory(TextFieldTableCell.forTableColumn()); partNoColumn.setCellValueFactory(new PropertyValueFactory<>("partNo")); partNoColumn.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<AdditionalPartNo, String>>() { @Override public void handle(TableColumn.CellEditEvent<AdditionalPartNo, String> e) { ((AdditionalPartNo)e.getTableView().getItems().get(e.getTablePosition().getRow())).setPartNo(e.getNewValue()); } }); partNoColumn.setEditable(true); priceTypeColumn.setCellValueFactory(new PropertyValueFactory<>("priceType")); priceDoubleColumn.setCellValueFactory(new PropertyValueFactory<>("price")); // see CustomTableCell documentation // this is necessary if we want an editable Double Column representing a FXProperty // priceDoubleColumn.setCellFactory(CustomTableCell.forTableColumn(new DoubleStringConverter())); priceDoubleColumn.setEditable(true); priceDoubleColumn.setCellFactory( TextFieldTableCell.<Prices, Double>forTableColumn(new MyDoubleStringConverter())); priceDoubleColumn.setOnEditCommit(event -> { final Double value = event.getNewValue() != null ? event.getNewValue() : event.getOldValue(); ((Prices)event.getTableView().getItems().get(event.getTablePosition().getRow())).setPrice(value); event.getTableView().refresh(); }); pfx.nameProperty() .bindBidirectional(nameTextArea.textProperty()); pfx.descriptionProperty() .bindBidirectional(descriptionTextArea.textProperty()); pfx.partNoProperty() .bindBidirectional(partNoTextField.textProperty()); pfx.eolProperty() .bindBidirectional(eolDatePicker.valueProperty()); imageIdTextField.textProperty() .bindBidirectional(pfx.imageIdProperty(), new NumberStringConverter()); gtinTextField.textProperty() .bindBidirectional(pfx.gtinProperty(), new NumberStringConverter()); pfx.tradeNameProperty() .bindBidirectional(tradeNameComboBox.valueProperty()); pfx.productGroupProperty() .bindBidirectional(productGroupComboBox.valueProperty()); pfx.salesChannelProperty() .bindBidirectional(salesChannelComboBox.valueProperty()); // Defaults pfx.setProductGroup(ProductGroup.values()[0]); pfx.setSalesChannel(SalesChannel.UNKNOWN); pfx.setTradeName(TradeName.values()[0]); }
public void initialize() { colorColumn.setCellFactory(column -> new ColorTableCell<ChromatogramPlotDataSet>(column)); lineThicknessColumn .setCellFactory(column -> new SpinnerTableCell<ChromatogramPlotDataSet>(column, 1, 5)); intensityScaleColumn.setCellFactory(TextFieldTableCell.forTableColumn( new NumberStringConverter(MZmineCore.getConfiguration().getIntensityFormat()))); showDataPointsColumn .setCellFactory(column -> new CheckBoxTableCell<ChromatogramPlotDataSet, Boolean>()); }