List of usage examples for javafx.util StringConverter StringConverter
StringConverter
From source file:io.bitsquare.gui.components.paymentmethods.BlockChainForm.java
@Override protected void addTradeCurrencyComboBox() { currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Cryptocurrency:", Layout.FIRST_ROW_AND_GROUP_DISTANCE).second; currencyComboBox.setPromptText("Select cryptocurrency"); currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedCryptoCurrencies())); currencyComboBox.setVisibleRowCount(Math.min(currencyComboBox.getItems().size(), 20)); currencyComboBox.setConverter(new StringConverter<TradeCurrency>() { @Override// w w w . j a v a 2 s. c o m public String toString(TradeCurrency tradeCurrency) { return tradeCurrency.getNameAndCode(); } @Override public TradeCurrency fromString(String s) { return null; } }); currencyComboBox.setOnAction(e -> { paymentAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); updateFromInputs(); }); }
From source file:gov.va.isaac.gui.ConceptNode.java
/** * descriptionReader is optional/*from w w w .j a v a2 s.co m*/ */ public ConceptNode(ConceptVersionBI initialConcept, boolean flagAsInvalidWhenBlank, ObservableList<SimpleDisplayConcept> dropDownOptions, Function<ConceptVersionBI, String> descriptionReader) { c_ = initialConcept; //We can't simply use the ObservableList from the CommonlyUsedConcepts, because it infinite loops - there doesn't seem to be a way //to change the items in the drop down without changing the selection. So, we have this hack instead. listChangeListener_ = new ListChangeListener<SimpleDisplayConcept>() { @Override public void onChanged(Change<? extends SimpleDisplayConcept> c) { //TODO I still have an infinite loop here. Find and fix. logger.debug("updating concept dropdown"); disableChangeListener_ = true; SimpleDisplayConcept temp = cb_.getValue(); cb_.setItems(FXCollections.observableArrayList(dropDownOptions_)); cb_.setValue(temp); cb_.getSelectionModel().select(temp); disableChangeListener_ = false; } }; descriptionReader_ = (descriptionReader == null ? (conceptVersion) -> { return conceptVersion == null ? "" : OTFUtility.getDescription(conceptVersion); } : descriptionReader); dropDownOptions_ = dropDownOptions == null ? AppContext.getService(CommonlyUsedConcepts.class).getObservableConcepts() : dropDownOptions; dropDownOptions_.addListener(new WeakListChangeListener<SimpleDisplayConcept>(listChangeListener_)); conceptBinding_ = new ObjectBinding<ConceptVersionBI>() { @Override protected ConceptVersionBI computeValue() { return c_; } }; flagAsInvalidWhenBlank_ = flagAsInvalidWhenBlank; cb_ = new ComboBox<>(); cb_.setConverter(new StringConverter<SimpleDisplayConcept>() { @Override public String toString(SimpleDisplayConcept object) { return object == null ? "" : object.getDescription(); } @Override public SimpleDisplayConcept fromString(String string) { return new SimpleDisplayConcept(string, 0); } }); cb_.setValue(new SimpleDisplayConcept("", 0)); cb_.setEditable(true); cb_.setMaxWidth(Double.MAX_VALUE); cb_.setPrefWidth(ComboBox.USE_COMPUTED_SIZE); cb_.setMinWidth(200.0); cb_.setPromptText("Type, drop or select a concept"); cb_.setItems(FXCollections.observableArrayList(dropDownOptions_)); cb_.setVisibleRowCount(11); cm_ = new ContextMenu(); MenuItem copyText = new MenuItem("Copy Description"); copyText.setGraphic(Images.COPY.createImageView()); copyText.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { CustomClipboard.set(cb_.getEditor().getText()); } }); cm_.getItems().add(copyText); CommonMenusNIdProvider nidProvider = new CommonMenusNIdProvider() { @Override public Set<Integer> getNIds() { Set<Integer> nids = new HashSet<>(); if (c_ != null) { nids.add(c_.getNid()); } return nids; } }; CommonMenuBuilderI menuBuilder = CommonMenus.CommonMenuBuilder.newInstance(); menuBuilder.setInvisibleWhenFalse(isValid); CommonMenus.addCommonMenus(cm_, menuBuilder, nidProvider); cb_.getEditor().setContextMenu(cm_); updateGUI(); new LookAheadConceptPopup(cb_); if (cb_.getValue().getNid() == 0) { if (flagAsInvalidWhenBlank_) { isValid.setInvalid("Concept Required"); } } else { isValid.setValid(); } cb_.valueProperty().addListener(new ChangeListener<SimpleDisplayConcept>() { @Override public void changed(ObservableValue<? extends SimpleDisplayConcept> observable, SimpleDisplayConcept oldValue, SimpleDisplayConcept newValue) { if (newValue == null) { logger.debug("Combo Value Changed - null entry"); } else { logger.debug("Combo Value Changed: {} {}", newValue.getDescription(), newValue.getNid()); } if (disableChangeListener_) { logger.debug("change listener disabled"); return; } if (newValue == null) { //This can happen if someone calls clearSelection() - it passes in a null. cb_.setValue(new SimpleDisplayConcept("", 0)); return; } else { if (newValue.shouldIgnoreChange()) { logger.debug("One time change ignore"); return; } //Whenever the focus leaves the combo box editor, a new combo box is generated. But, the new box will have 0 for an id. detect and ignore if (oldValue != null && oldValue.getDescription().equals(newValue.getDescription()) && newValue.getNid() == 0) { logger.debug("Not a real change, ignore"); newValue.setNid(oldValue.getNid()); return; } lookup(); } } }); AppContext.getService(DragRegistry.class).setupDragAndDrop(cb_, new SingleConceptIdProvider() { @Override public String getConceptId() { return cb_.getValue().getNid() + ""; } }, true); pi_ = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS); pi_.visibleProperty().bind(isLookupInProgress_); pi_.setPrefHeight(16.0); pi_.setPrefWidth(16.0); pi_.setMaxWidth(16.0); pi_.setMaxHeight(16.0); lookupFailImage_ = Images.EXCLAMATION.createImageView(); lookupFailImage_.visibleProperty().bind(isValid.not().and(isLookupInProgress_.not())); Tooltip t = new Tooltip(); t.textProperty().bind(isValid.getReasonWhyInvalid()); Tooltip.install(lookupFailImage_, t); StackPane sp = new StackPane(); sp.setMaxWidth(Double.MAX_VALUE); sp.getChildren().add(cb_); sp.getChildren().add(lookupFailImage_); sp.getChildren().add(pi_); StackPane.setAlignment(cb_, Pos.CENTER_LEFT); StackPane.setAlignment(lookupFailImage_, Pos.CENTER_RIGHT); StackPane.setMargin(lookupFailImage_, new Insets(0.0, 30.0, 0.0, 0.0)); StackPane.setAlignment(pi_, Pos.CENTER_RIGHT); StackPane.setMargin(pi_, new Insets(0.0, 30.0, 0.0, 0.0)); hbox_ = new HBox(); hbox_.setSpacing(5.0); hbox_.setAlignment(Pos.CENTER_LEFT); hbox_.getChildren().add(sp); HBox.setHgrow(sp, Priority.SOMETIMES); }
From source file:investiagenofx2.view.InvestiaGenOFXController.java
/** * Initializes the controller class./*from w w w. j a va2 s .co m*/ * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { txt_investiaURL.setText(PropertiesInit.getInvestiaURL()); dtp_lastDate.setValue(LocalDate.parse(PropertiesInit.getLastGenUsedDate())); String[] clientNums = PropertiesInit.getClientNumList().split(","); for (String clientNum : clientNums) { if (!clientNum.trim().isEmpty()) { cbo_clientNum.getItems().add(clientNum.trim()); } } Arrays.fill(linkAccountToLocalAccountIndex, -1); resetControls(); cbo_clientNum.getEditor().addEventFilter(KeyEvent.KEY_PRESSED, event -> { if (event.getCode() == KeyCode.DELETE) { cbo_clientNum.getItems().remove(cbo_clientNum.getValue()); event.consume(); } }); dtp_lastDate.setConverter(new StringConverter<LocalDate>() { final String pattern = "yyyy-MM-dd"; final DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern(pattern); { dtp_lastDate.setPromptText(pattern.toLowerCase()); } @Override public String toString(LocalDate date) { if (date != null) { return dateFormatter.format(date); } else { return ""; } } @Override public LocalDate fromString(String string) { if (string != null && !string.isEmpty()) { return LocalDate.parse(string, dateFormatter); } else { return null; } } }); //This deals with the bug located here where the datepicker value is not updated on focus lost //https://bugs.openjdk.java.net/browse/JDK-8092295?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel dtp_lastDate.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (!newValue) { dtp_lastDate .setValue(dtp_lastDate.getConverter().fromString(dtp_lastDate.getEditor().getText())); } } }); }
From source file:retsys.client.controller.StandardController.java
protected <T extends Model> AutoCompletionBinding<T> bindForAutocompletion(TextField control, String entity, String filter) {/*from w w w .ja v a2 s.co m*/ return TextFields.bindAutoCompletion(control, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<T>>() { @Override public Collection<T> call(AutoCompletionBinding.ISuggestionRequest param) { List<T> list = null; try { LovHandler lovHandler = new LovHandler(entity, filter); String response = lovHandler.getSuggestions(param.getUserText()); list = (List<T>) new JsonHelper().convertJsonStringToObject(response, new TypeReference<List<T>>() { }); } catch (IOException ex) { Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex); } return list; } }, new StringConverter<T>() { @Override public String toString(T object) { System.out.println("here..." + object); return object.getName() + " (ID:" + object.getId() + ")"; } @Override public T fromString(String string) { throw new UnsupportedOperationException(); } }); }
From source file:com.bekwam.resignator.ResignatorAppMainViewController.java
@FXML public void initialize() { try {/*from w ww .j a va 2 s . c om*/ miHelp.setAccelerator(KeyCombination.keyCombination("F1")); cbType.getItems().add(SigningArgumentsType.JAR); cbType.getItems().add(SigningArgumentsType.FOLDER); cbType.getSelectionModel().select(SigningArgumentsType.JAR); cbType.setConverter(new StringConverter<SigningArgumentsType>() { @Override public String toString(SigningArgumentsType type) { return StringUtils.capitalize(StringUtils.lowerCase(String.valueOf(type))); } @Override public SigningArgumentsType fromString(String type) { return Enum.valueOf(SigningArgumentsType.class, StringUtils.upperCase(type)); } }); activeConfiguration.activeProfileProperty().bindBidirectional(activeProfile.profileNameProperty()); tfSourceFile.textProperty().bindBidirectional(activeProfile.sourceFileFileNameProperty()); tfTargetFile.textProperty().bindBidirectional(activeProfile.targetFileFileNameProperty()); ckReplace.selectedProperty().bindBidirectional(activeProfile.replaceSignaturesProperty()); cbType.valueProperty().bindBidirectional(activeProfile.argsTypeProperty()); miSave.disableProperty().bind(needsSave.not()); tfSourceFile.textProperty().addListener(new WeakInvalidationListener(needsSaveListener)); tfTargetFile.textProperty().addListener(new WeakInvalidationListener(needsSaveListener)); ckReplace.selectedProperty().addListener(new WeakInvalidationListener(needsSaveListener)); cbType.valueProperty().addListener(new WeakInvalidationListener(needsSaveListener)); lblSource.setText(SOURCE_LABEL_JAR); lblTarget.setText(TARGET_LABEL_JAR); cbType.getSelectionModel().selectedItemProperty().addListener((ov, old_v, new_v) -> { if (new_v == SigningArgumentsType.FOLDER) { if (!lblSource.getText().equalsIgnoreCase(SOURCE_LABEL_FOLDER)) { lblSource.setText(SOURCE_LABEL_FOLDER); } if (!lblSource.getText().equalsIgnoreCase(TARGET_LABEL_FOLDER)) { lblTarget.setText(TARGET_LABEL_FOLDER); } } else { if (!lblSource.getText().equalsIgnoreCase(SOURCE_LABEL_JAR)) { lblSource.setText(SOURCE_LABEL_JAR); } if (!lblSource.getText().equalsIgnoreCase(TARGET_LABEL_JAR)) { lblTarget.setText(TARGET_LABEL_JAR); } } }); lvProfiles.getSelectionModel().selectedItemProperty().addListener((ov, old_v, new_v) -> { if (new_v == null) { // coming from clearSelection or sort return; } if (needsSave.getValue()) { Alert alert = new Alert(Alert.AlertType.CONFIRMATION, "Discard unsaved profile?"); alert.setHeaderText("Unsaved profile"); Optional<ButtonType> response = alert.showAndWait(); if (!response.isPresent() || response.get() != ButtonType.OK) { if (logger.isDebugEnabled()) { logger.debug("[SELECT] discard canceled"); } return; } } if (logger.isDebugEnabled()) { logger.debug("[SELECT] nv={}", new_v); } doLoadProfile(new_v); }); lvProfiles.setCellFactory(TextFieldListCell.forListView()); Task<Void> t = new Task<Void>() { @Override protected Void call() throws Exception { updateMessage("Loading configuration"); configurationDS.loadConfiguration(); if (!configurationDS.isSecured()) { if (logger.isDebugEnabled()) { logger.debug("[CALL] config not secured; getting password"); } NewPasswordController npc = newPasswordControllerProvider.get(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] npc id={}", npc.hashCode()); } Platform.runLater(() -> { try { npc.showAndWait(); } catch (Exception exc) { logger.error("error showing npc", exc); } }); synchronized (npc) { try { npc.wait(MAX_WAIT_TIME); // 10 minutes to enter the password } catch (InterruptedException exc) { logger.error("new password operation interrupted", exc); } } if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] npc={}", npc.getHashedPassword()); } if (StringUtils.isNotEmpty(npc.getHashedPassword())) { activeConfiguration.setHashedPassword(npc.getHashedPassword()); activeConfiguration.setUnhashedPassword(npc.getUnhashedPassword()); activeConfiguration.setLastUpdatedDateTime(LocalDateTime.now()); configurationDS.saveConfiguration(); configurationDS.loadConfiguration(); configurationDS.decrypt(activeConfiguration.getUnhashedPassword()); } else { Platform.runLater(() -> { Alert noPassword = new Alert(Alert.AlertType.INFORMATION, "You'll need to provide a password to save your keystore credentials."); noPassword.showAndWait(); }); return null; } } else { PasswordController pc = passwordControllerProvider.get(); Platform.runLater(() -> { try { pc.showAndWait(); } catch (Exception exc) { logger.error("error showing pc", exc); } }); synchronized (pc) { try { pc.wait(MAX_WAIT_TIME); // 10 minutes to enter the password } catch (InterruptedException exc) { logger.error("password operation interrupted", exc); } } Platform.runLater(() -> { if (pc.getStage().isShowing()) { // ended in timeout timeout pc.getStage().hide(); } if (pc.wasCancelled() || pc.wasReset() || !pc.doesPasswordMatch()) { if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] was cancelled or the number of retries was exceeded"); } String msg = ""; if (pc.wasCancelled()) { msg = "You must provide a password to the datastore. Exitting..."; } else if (pc.wasReset()) { msg = "Data file removed. Exitting..."; } else { msg = "Exceeded maximum number of retries. Exitting..."; } Alert alert = new Alert(Alert.AlertType.WARNING, msg); alert.setOnCloseRequest((evt) -> { Platform.exit(); System.exit(1); }); alert.showAndWait(); } else { // // save password for later decryption ops // activeConfiguration.setUnhashedPassword(pc.getPassword()); configurationDS.decrypt(activeConfiguration.getUnhashedPassword()); // // init profileBrowser // if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles from source"); } long startTimeMillis = System.currentTimeMillis(); final List<String> profileNames = configurationDS.getProfiles().stream() .map(Profile::getProfileName).sorted((o1, o2) -> o1.compareToIgnoreCase(o2)) .collect(Collectors.toList()); final List<String> recentProfiles = configurationDS.getRecentProfileNames(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles into UI"); } lvProfiles.setItems(FXCollections.observableArrayList(profileNames)); if (CollectionUtils.isNotEmpty(recentProfiles)) { mRecentProfiles.getItems().clear(); mRecentProfiles.getItems().addAll( FXCollections.observableArrayList(recentProfiles.stream().map((s) -> { MenuItem mi = new MenuItem(s); mi.setOnAction(recentProfileLoadHandler); return mi; }).collect(Collectors.toList()))); } // // #31 preload the last active profile // if (StringUtils.isNotEmpty(activeConfiguration.getActiveProfile())) { if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] preloading last active profile={}", activeConfiguration.getActiveProfile()); } doLoadProfile(activeConfiguration.getActiveProfile()); } long endTimeMillis = System.currentTimeMillis(); if (logger.isDebugEnabled()) { logger.debug("[INIT TASK] loading profiles took {} ms", (endTimeMillis - startTimeMillis)); } } }); } return null; } @Override protected void succeeded() { super.succeeded(); updateMessage(""); lblStatus.textProperty().unbind(); } @Override protected void cancelled() { super.cancelled(); logger.error("task cancelled", getException()); updateMessage(""); lblStatus.textProperty().unbind(); } @Override protected void failed() { super.failed(); logger.error("task failed", getException()); updateMessage(""); lblStatus.textProperty().unbind(); } }; lblStatus.textProperty().bind(t.messageProperty()); new Thread(t).start(); } catch (Exception exc) { logger.error("can't load configuration", exc); String msg = "Verify that the user has access to the directory '" + configFile + "' under " + System.getProperty("user.home") + "."; Alert alert = new Alert(Alert.AlertType.ERROR, msg); alert.setHeaderText("Can't load config file"); alert.showAndWait(); Platform.exit(); } }
From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java
private void setupCurrency(Country country, TradeCurrency currency) { if (CountryUtil.getAllSepaEuroCountries().contains(country)) { currencyTextField.setVisible(true); currencyTextField.setManaged(true); currencyComboBox.setVisible(false); currencyComboBox.setManaged(false); sepaAccount.setSingleTradeCurrency(currency); currencyTextField.setText("Currency: " + currency.getNameAndCode()); } else {/*ww w . jav a 2 s. c o m*/ currencyComboBox.setVisible(true); currencyComboBox.setManaged(true); currencyTextField.setVisible(false); currencyTextField.setManaged(false); currencyComboBox.setItems( FXCollections.observableArrayList(currency, CurrencyUtil.getFiatCurrency("EUR").get())); currencyComboBox.setOnAction(e2 -> { sepaAccount.setSingleTradeCurrency(currencyComboBox.getSelectionModel().getSelectedItem()); updateCountriesSelection(true, euroCountryCheckBoxes); autoFillNameTextField(); }); currencyComboBox.setConverter(new StringConverter<TradeCurrency>() { @Override public String toString(TradeCurrency currency) { return currency.getNameAndCode(); } @Override public TradeCurrency fromString(String string) { return null; } }); currencyComboBox.getSelectionModel().select(0); } }
From source file:de.perdoctus.ebikeconnect.gui.ActivitiesOverviewController.java
@FXML public void initialize() { logger.info("Init!"); NUMBER_FORMAT.setMaximumFractionDigits(2); webEngine = webView.getEngine();//from w w w. j a v a 2s . co m webEngine.load(getClass().getResource("/html/googleMap.html").toExternalForm()); // Activity Headers activityDaysHeaderService.setOnSucceeded(event -> { activitiesTable.setItems(FXCollections.observableArrayList(activityDaysHeaderService.getValue())); activitiesTable.getSortOrder().add(tcDate); tcDate.setSortable(true); }); activityDaysHeaderService.setOnFailed( event -> logger.error("Failed to obtain ActivityList!", activityDaysHeaderService.getException())); final ProgressDialog activityHeadersProgressDialog = new ProgressDialog(activityDaysHeaderService); activityHeadersProgressDialog.initModality(Modality.APPLICATION_MODAL); // Activity Details activityDetailsGroupService.setOnSucceeded( event -> this.currentActivityDetailsGroup.setValue(activityDetailsGroupService.getValue())); activityDetailsGroupService.setOnFailed(event -> logger.error("Failed to obtain ActivityDetails!", activityDaysHeaderService.getException())); final ProgressDialog activityDetailsProgressDialog = new ProgressDialog(activityDetailsGroupService); activityDetailsProgressDialog.initModality(Modality.APPLICATION_MODAL); // Gpx Export gpxExportService.setOnSucceeded(event -> gpxExportFinished()); gpxExportService .setOnFailed(event -> handleError("Failed to generate GPX File", gpxExportService.getException())); tcxExportService.setOnSucceeded(event -> gpxExportFinished()); tcxExportService .setOnFailed(event -> handleError("Failed to generate TCX File", tcxExportService.getException())); // ActivityTable tcDate.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDate())); tcDate.setCellFactory(param -> new LocalDateCellFactory()); tcDate.setSortType(TableColumn.SortType.DESCENDING); tcDistance.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDistance() / 1000)); tcDistance.setCellFactory(param -> new NumberCellFactory(1, "km")); tcDuration.setCellValueFactory(param -> new SimpleObjectProperty<>(param.getValue().getDrivingTime())); tcDuration.setCellFactory(param -> new DurationCellFactory()); activitiesTable.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE); activitiesTable.getSelectionModel().getSelectedItems() .addListener((ListChangeListener<ActivityHeaderGroup>) c -> { while (c.next()) { if (c.wasRemoved()) { for (ActivityHeaderGroup activityHeaderGroup : c.getRemoved()) { lstSegments.getItems().removeAll(activityHeaderGroup.getActivityHeaders()); } } if (c.wasAdded()) { for (ActivityHeaderGroup activityHeaderGroup : c.getAddedSubList()) { if (activityHeaderGroup != null) { // WTF? Why can this be null!? lstSegments.getItems().addAll(activityHeaderGroup.getActivityHeaders()); } } } } lstSegments.getItems().sort((o1, o2) -> o1.getStartTime().isAfter(o2.getStartTime()) ? 1 : 0); }); activitiesTable.setOnMouseClicked(event -> { if (event.getClickCount() == 2) { lstSegments.getCheckModel().checkAll(); openSelectedSections(); } }); // Segment List lstSegments .setCellFactory(listView -> new CheckBoxListCell<>(item -> lstSegments.getItemBooleanProperty(item), new StringConverter<ActivityHeader>() { @Override public ActivityHeader fromString(String arg0) { return null; } @Override public String toString(ActivityHeader activityHeader) { final String startTime = activityHeader.getStartTime().format(DATE_TIME_FORMATTER); final String endTime = activityHeader.getEndTime().format(TIME_FORMATTER); final double distance = activityHeader.getDistance() / 1000; return startTime + " - " + endTime + " (" + NUMBER_FORMAT.format(distance) + " km)"; } })); // -- Chart chartRangeSlider.setLowValue(0); chartRangeSlider.setHighValue(chartRangeSlider.getMax()); xAxis.setAutoRanging(false); xAxis.lowerBoundProperty().bind(chartRangeSlider.lowValueProperty()); xAxis.upperBoundProperty().bind(chartRangeSlider.highValueProperty()); xAxis.tickUnitProperty().bind( chartRangeSlider.highValueProperty().subtract(chartRangeSlider.lowValueProperty()).divide(20)); xAxis.setTickLabelFormatter(new StringConverter<Number>() { @Override public String toString(Number object) { final Duration duration = Duration.of(object.intValue(), ChronoUnit.SECONDS); return String.valueOf(DurationFormatter.formatHhMmSs(duration)); } @Override public Number fromString(String string) { return null; } }); chart.getChart().setOnScroll(event -> { final double scrollAmount = event.getDeltaY(); chartRangeSlider.setLowValue(chartRangeSlider.getLowValue() + scrollAmount); chartRangeSlider.setHighValue(chartRangeSlider.getHighValue() - scrollAmount); }); xAxis.setOnMouseMoved(event -> { if (getCurrentActivityDetailsGroup() == null) { return; } final Number valueForDisplay = xAxis.getValueForDisplay(event.getX()); final List<Coordinate> trackpoints = getCurrentActivityDetailsGroup().getJoinedTrackpoints(); final int index = valueForDisplay.intValue(); if (index >= 0 && index < trackpoints.size()) { final Coordinate coordinate = trackpoints.get(index); if (coordinate.isValid()) { final LatLng latLng = new LatLng(coordinate); try { webEngine.executeScript( "updateMarkerPosition(" + objectMapper.writeValueAsString(latLng) + ");"); } catch (JsonProcessingException e) { e.printStackTrace(); //TODO clean up ugly code!!!!-------------- } } } }); // -- Current ActivityDetails this.currentActivityDetailsGroup.addListener((observable, oldValue, newValue) -> { if (newValue != null) { activityGroupChanged(newValue); } }); }
From source file:retsys.client.controller.PurchaseOrderConfirmController.java
/** * Initializes the controller class./*from w w w.j a v a 2 s . c o m*/ */ @Override public void initialize(URL url, ResourceBundle rb) { po_date.setValue(LocalDate.now()); loc_of_material.setCellValueFactory(new PropertyValueFactory<POItem, String>("location")); material_name.setCellValueFactory(new PropertyValueFactory<POItem, String>("name")); brand_name.setCellValueFactory(new PropertyValueFactory<POItem, String>("brand")); model_code.setCellValueFactory(new PropertyValueFactory<POItem, String>("model")); quantity.setCellValueFactory(new PropertyValueFactory<POItem, Integer>("quantity")); confirm.setCellValueFactory(new PropertyValueFactory<POItem, Boolean>("confirm")); confirm.setCellFactory(CheckBoxTableCell.forTableColumn(confirm)); billNo.setCellValueFactory(new PropertyValueFactory<POItem, String>("billNo")); billNo.setCellFactory(TextFieldTableCell.forTableColumn()); supervisor.setCellValueFactory(new PropertyValueFactory<POItem, String>("supervisor")); supervisor.setCellFactory(TextFieldTableCell.forTableColumn()); receivedDate.setCellValueFactory(new PropertyValueFactory<POItem, LocalDate>("receivedDate")); receivedDate.setCellFactory(new Callback<TableColumn<POItem, LocalDate>, TableCell<POItem, LocalDate>>() { @Override public TableCell<POItem, LocalDate> call(TableColumn<POItem, LocalDate> param) { TableCell<POItem, LocalDate> cell = new TableCell<POItem, LocalDate>() { @Override protected void updateItem(LocalDate item, boolean empty) { super.updateItem(item, empty); //To change body of generated methods, choose Tools | Templates. if (empty || item == null) { setText(null); setGraphic(null); } else { setText(formatter.format(item)); } } @Override public void startEdit() { super.startEdit(); System.out.println("start edit"); DatePicker dateControl = null; if (this.getItem() != null) { dateControl = new DatePicker(this.getItem()); } else { dateControl = new DatePicker(); } dateControl.valueProperty().addListener(new ChangeListener<LocalDate>() { @Override public void changed(ObservableValue<? extends LocalDate> observable, LocalDate oldValue, LocalDate newValue) { if (newValue == null) { cancelEdit(); } else { commitEdit(newValue); } } }); this.setGraphic(dateControl); } @Override public void cancelEdit() { super.cancelEdit(); System.out.println("cancel edit"); setGraphic(null); if (this.getItem() != null) { setText(formatter.format(this.getItem())); } else { setText(null); } } @Override public void commitEdit(LocalDate newValue) { super.commitEdit(newValue); System.out.println("commit edit"); setGraphic(null); setText(formatter.format(newValue)); } }; return cell; } }); poDetail.getColumns().setAll(loc_of_material, material_name, brand_name, model_code, quantity, confirm, receivedDate, billNo, supervisor); AutoCompletionBinding<PurchaseOrder> bindForTxt_name = TextFields.bindAutoCompletion(project, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<PurchaseOrder>>() { @Override public Collection<PurchaseOrder> call(AutoCompletionBinding.ISuggestionRequest param) { List<PurchaseOrder> list = null; try { LovHandler lovHandler = new LovHandler("purchaseorders", "name"); String response = lovHandler.getSuggestions(param.getUserText()); list = (List<PurchaseOrder>) new JsonHelper().convertJsonStringToObject(response, new TypeReference<List<PurchaseOrder>>() { }); } catch (IOException ex) { Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex); } return list; } }, new StringConverter<PurchaseOrder>() { @Override public String toString(PurchaseOrder object) { System.out.println("here..." + object); String strDate = DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).format( LocalDateTime.ofInstant(object.getDate().toInstant(), ZoneId.systemDefault())); return "Project:" + object.getProject().getName() + " PO Date:" + strDate + " PO No.:" + object.getId(); } @Override public PurchaseOrder fromString(String string) { throw new UnsupportedOperationException(); } }); bindForTxt_name .setOnAutoCompleted(new EventHandler<AutoCompletionBinding.AutoCompletionEvent<PurchaseOrder>>() { @Override public void handle(AutoCompletionBinding.AutoCompletionEvent<PurchaseOrder> event) { populateData(event.getCompletion()); } }); AutoCompletionBinding<Vendor> bindForVendor = TextFields.bindAutoCompletion(vendor, new Callback<AutoCompletionBinding.ISuggestionRequest, Collection<Vendor>>() { @Override public Collection<Vendor> call(AutoCompletionBinding.ISuggestionRequest param) { List<Vendor> list = null; try { LovHandler lovHandler = new LovHandler("vendors", "name"); String response = lovHandler.getSuggestions(param.getUserText()); list = (List<Vendor>) new JsonHelper().convertJsonStringToObject(response, new TypeReference<List<Vendor>>() { }); } catch (IOException ex) { Logger.getLogger(ProjectController.class.getName()).log(Level.SEVERE, null, ex); } return list; } }, new StringConverter<Vendor>() { @Override public String toString(Vendor object) { return object.getName() + " (ID:" + object.getId() + ")"; } @Override public Vendor fromString(String string) { throw new UnsupportedOperationException(); } }); }
From source file:io.bitsquare.gui.components.paymentmethods.BankForm.java
@Override public void addFormForAddAccount() { gridRowFrom = gridRow + 1;/*from w ww . jav a2 s .com*/ Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:"); ComboBox<Region> regionComboBox = tuple3.second; regionComboBox.setPromptText("Select region"); regionComboBox.setConverter(new StringConverter<Region>() { @Override public String toString(Region region) { return region.name; } @Override public Region fromString(String s) { return null; } }); regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions())); ComboBox<Country> countryComboBox = tuple3.third; countryComboBox.setVisibleRowCount(15); countryComboBox.setDisable(true); countryComboBox.setPromptText("Select country"); countryComboBox.setConverter(new StringConverter<Country>() { @Override public String toString(Country country) { return country.name + " (" + country.code + ")"; } @Override public Country fromString(String s) { return null; } }); countryComboBox.setOnAction(e -> { Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); if (selectedItem != null) { if (selectedItem.code.equals("US")) { new Popup<>().information( "Bank transfer with WIRE or ACH is not supported for the US because WIRE is too expensive and ACH has a high chargeback risk.\n\n" + "Please use payment methods \"ClearXchange\", \"US Postal Money Order\" or \"Cash/ATM Deposit\" instead.") .onClose(() -> closeHandler.run()).show(); } else { getCountryBasedPaymentAccount().setCountry(selectedItem); String countryCode = selectedItem.code; TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode); paymentAccount.setSingleTradeCurrency(currency); currencyComboBox.setDisable(false); currencyComboBox.getSelectionModel().select(currency); bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode)); branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode)); accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode)); accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode)); bankNameInputTextField.setText(""); bankIdInputTextField.setText(""); branchIdInputTextField.setText(""); accountNrInputTextField.setText(""); accountTypeComboBox.getSelectionModel().clearSelection(); accountTypeComboBox.setItems( FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode))); if (BankUtil.useValidation(countryCode) && !validatorsApplied) { validatorsApplied = true; if (useHolderID) holderIdInputTextField.setValidator(inputValidator); bankNameInputTextField.setValidator(inputValidator); bankIdInputTextField.setValidator(new BankIdValidator(countryCode)); branchIdInputTextField.setValidator(new BranchIdValidator(countryCode)); accountNrInputTextField.setValidator(new AccountNrValidator(countryCode)); } else { validatorsApplied = false; if (useHolderID) holderIdInputTextField.setValidator(null); bankNameInputTextField.setValidator(null); bankIdInputTextField.setValidator(null); branchIdInputTextField.setValidator(null); accountNrInputTextField.setValidator(null); } holderNameInputTextField.resetValidation(); bankNameInputTextField.resetValidation(); bankIdInputTextField.resetValidation(); branchIdInputTextField.resetValidation(); accountNrInputTextField.resetValidation(); boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode); if (requiresHolderId) { holderNameInputTextField.minWidthProperty().unbind(); holderNameInputTextField.setMinWidth(300); } else { holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty()); } if (useHolderID) { if (!requiresHolderId) holderIdInputTextField.setText(""); holderIdInputTextField.resetValidation(); holderIdInputTextField.setVisible(requiresHolderId); holderIdInputTextField.setManaged(requiresHolderId); holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode)); holderIdLabel.setVisible(requiresHolderId); holderIdLabel.setManaged(requiresHolderId); } boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode); bankNameTuple.first.setVisible(bankNameRequired); bankNameTuple.first.setManaged(bankNameRequired); bankNameInputTextField.setVisible(bankNameRequired); bankNameInputTextField.setManaged(bankNameRequired); boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode); bankIdTuple.first.setVisible(bankIdRequired); bankIdTuple.first.setManaged(bankIdRequired); bankIdInputTextField.setVisible(bankIdRequired); bankIdInputTextField.setManaged(bankIdRequired); boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode); branchIdTuple.first.setVisible(branchIdRequired); branchIdTuple.first.setManaged(branchIdRequired); branchIdInputTextField.setVisible(branchIdRequired); branchIdInputTextField.setManaged(branchIdRequired); boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode); accountNrTuple.first.setVisible(accountNrRequired); accountNrTuple.first.setManaged(accountNrRequired); accountNrInputTextField.setVisible(accountNrRequired); accountNrInputTextField.setManaged(accountNrRequired); boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode); accountTypeTuple.first.setVisible(accountTypeRequired); accountTypeTuple.first.setManaged(accountTypeRequired); accountTypeTuple.second.setVisible(accountTypeRequired); accountTypeTuple.second.setManaged(accountTypeRequired); updateFromInputs(); onCountryChanged(); } } }); regionComboBox.setOnAction(e -> { Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem(); if (selectedItem != null) { countryComboBox.setDisable(false); countryComboBox.setItems( FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem))); } }); currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Currency:").second; currencyComboBox.setPromptText("Select currency"); currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies())); currencyComboBox.setOnAction(e -> { TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem(); FiatCurrency defaultCurrency = CurrencyUtil .getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code); if (!defaultCurrency.equals(selectedItem)) { new Popup<>().warning( "Are you sure you want to choose a currency other than the country's default currency?") .actionButtonText("Yes").onAction(() -> { paymentAccount.setSingleTradeCurrency(selectedItem); autoFillNameTextField(); }).closeButtonText("No, restore default currency") .onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show(); } else { paymentAccount.setSingleTradeCurrency(selectedItem); autoFillNameTextField(); } }); currencyComboBox.setConverter(new StringConverter<TradeCurrency>() { @Override public String toString(TradeCurrency currency) { return currency.getNameAndCode(); } @Override public TradeCurrency fromString(String string) { return null; } }); currencyComboBox.setDisable(true); addAcceptedBanksForAddAccount(); addHolderNameAndId(); bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:"); bankNameInputTextField = bankNameTuple.second; bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { bankAccountContractData.setBankName(newValue); updateFromInputs(); }); bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel("")); bankIdLabel = bankIdTuple.first; bankIdInputTextField = bankIdTuple.second; bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { bankAccountContractData.setBankId(newValue); updateFromInputs(); }); branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel("")); branchIdLabel = branchIdTuple.first; branchIdInputTextField = branchIdTuple.second; branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { bankAccountContractData.setBranchId(newValue); updateFromInputs(); }); accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel("")); accountNrLabel = accountNrTuple.first; accountNrInputTextField = accountNrTuple.second; accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { bankAccountContractData.setAccountNr(newValue); updateFromInputs(); }); accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, ""); accountTypeLabel = accountTypeTuple.first; accountTypeComboBox = accountTypeTuple.second; accountTypeComboBox.setPromptText("Select account type"); accountTypeComboBox.setOnAction(e -> { if (BankUtil.isAccountTypeRequired(bankAccountContractData.getCountryCode())) { bankAccountContractData.setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem()); updateFromInputs(); } }); addAllowedPeriod(); addAccountNameTextFieldWithAutoFillCheckBox(); updateFromInputs(); }
From source file:io.bitsquare.gui.components.paymentmethods.CashDepositForm.java
@Override public void addFormForAddAccount() { gridRowFrom = gridRow + 1;/*from ww w . ja v a2 s .c o m*/ Tuple3<Label, ComboBox, ComboBox> tuple3 = addLabelComboBoxComboBox(gridPane, ++gridRow, "Country:"); ComboBox<Region> regionComboBox = tuple3.second; regionComboBox.setPromptText("Select region"); regionComboBox.setConverter(new StringConverter<Region>() { @Override public String toString(Region region) { return region.name; } @Override public Region fromString(String s) { return null; } }); regionComboBox.setItems(FXCollections.observableArrayList(CountryUtil.getAllRegions())); ComboBox<Country> countryComboBox = tuple3.third; countryComboBox.setVisibleRowCount(15); countryComboBox.setDisable(true); countryComboBox.setPromptText("Select country"); countryComboBox.setConverter(new StringConverter<Country>() { @Override public String toString(Country country) { return country.name + " (" + country.code + ")"; } @Override public Country fromString(String s) { return null; } }); countryComboBox.setOnAction(e -> { Country selectedItem = countryComboBox.getSelectionModel().getSelectedItem(); if (selectedItem != null) { getCountryBasedPaymentAccount().setCountry(selectedItem); String countryCode = selectedItem.code; TradeCurrency currency = CurrencyUtil.getCurrencyByCountryCode(countryCode); paymentAccount.setSingleTradeCurrency(currency); currencyComboBox.setDisable(false); currencyComboBox.getSelectionModel().select(currency); bankIdLabel.setText(BankUtil.getBankIdLabel(countryCode)); branchIdLabel.setText(BankUtil.getBranchIdLabel(countryCode)); accountNrLabel.setText(BankUtil.getAccountNrLabel(countryCode)); accountTypeLabel.setText(BankUtil.getAccountTypeLabel(countryCode)); bankNameInputTextField.setText(""); bankIdInputTextField.setText(""); branchIdInputTextField.setText(""); accountNrInputTextField.setText(""); accountTypeComboBox.getSelectionModel().clearSelection(); accountTypeComboBox .setItems(FXCollections.observableArrayList(BankUtil.getAccountTypeValues(countryCode))); if (BankUtil.useValidation(countryCode) && !validatorsApplied) { validatorsApplied = true; if (useHolderID) holderIdInputTextField.setValidator(inputValidator); bankNameInputTextField.setValidator(inputValidator); bankIdInputTextField.setValidator(new BankIdValidator(countryCode)); branchIdInputTextField.setValidator(new BranchIdValidator(countryCode)); accountNrInputTextField.setValidator(new AccountNrValidator(countryCode)); } else { validatorsApplied = false; if (useHolderID) holderIdInputTextField.setValidator(null); bankNameInputTextField.setValidator(null); bankIdInputTextField.setValidator(null); branchIdInputTextField.setValidator(null); accountNrInputTextField.setValidator(null); } holderNameInputTextField.resetValidation(); holderEmailInputTextField.resetValidation(); bankNameInputTextField.resetValidation(); bankIdInputTextField.resetValidation(); branchIdInputTextField.resetValidation(); accountNrInputTextField.resetValidation(); boolean requiresHolderId = BankUtil.isHolderIdRequired(countryCode); if (requiresHolderId) { holderNameInputTextField.minWidthProperty().unbind(); holderNameInputTextField.setMinWidth(300); } else { holderNameInputTextField.minWidthProperty().bind(currencyComboBox.widthProperty()); } if (useHolderID) { if (!requiresHolderId) holderIdInputTextField.setText(""); holderIdInputTextField.resetValidation(); holderIdInputTextField.setVisible(requiresHolderId); holderIdInputTextField.setManaged(requiresHolderId); holderIdLabel.setText(BankUtil.getHolderIdLabel(countryCode)); holderIdLabel.setVisible(requiresHolderId); holderIdLabel.setManaged(requiresHolderId); } boolean bankNameRequired = BankUtil.isBankNameRequired(countryCode); bankNameTuple.first.setVisible(bankNameRequired); bankNameTuple.first.setManaged(bankNameRequired); bankNameInputTextField.setVisible(bankNameRequired); bankNameInputTextField.setManaged(bankNameRequired); boolean bankIdRequired = BankUtil.isBankIdRequired(countryCode); bankIdTuple.first.setVisible(bankIdRequired); bankIdTuple.first.setManaged(bankIdRequired); bankIdInputTextField.setVisible(bankIdRequired); bankIdInputTextField.setManaged(bankIdRequired); boolean branchIdRequired = BankUtil.isBranchIdRequired(countryCode); branchIdTuple.first.setVisible(branchIdRequired); branchIdTuple.first.setManaged(branchIdRequired); branchIdInputTextField.setVisible(branchIdRequired); branchIdInputTextField.setManaged(branchIdRequired); boolean accountNrRequired = BankUtil.isAccountNrRequired(countryCode); accountNrTuple.first.setVisible(accountNrRequired); accountNrTuple.first.setManaged(accountNrRequired); accountNrInputTextField.setVisible(accountNrRequired); accountNrInputTextField.setManaged(accountNrRequired); boolean accountTypeRequired = BankUtil.isAccountTypeRequired(countryCode); accountTypeTuple.first.setVisible(accountTypeRequired); accountTypeTuple.first.setManaged(accountTypeRequired); accountTypeTuple.second.setVisible(accountTypeRequired); accountTypeTuple.second.setManaged(accountTypeRequired); updateFromInputs(); onCountryChanged(); } }); regionComboBox.setOnAction(e -> { Region selectedItem = regionComboBox.getSelectionModel().getSelectedItem(); if (selectedItem != null) { countryComboBox.setDisable(false); countryComboBox.setItems( FXCollections.observableArrayList(CountryUtil.getAllCountriesForRegion(selectedItem))); } }); currencyComboBox = addLabelComboBox(gridPane, ++gridRow, "Currency:").second; currencyComboBox.setPromptText("Select currency"); currencyComboBox.setItems(FXCollections.observableArrayList(CurrencyUtil.getAllSortedFiatCurrencies())); currencyComboBox.setOnAction(e -> { TradeCurrency selectedItem = currencyComboBox.getSelectionModel().getSelectedItem(); FiatCurrency defaultCurrency = CurrencyUtil .getCurrencyByCountryCode(countryComboBox.getSelectionModel().getSelectedItem().code); if (!defaultCurrency.equals(selectedItem)) { new Popup<>().warning( "Are you sure you want to choose a currency other than the country's default currency?") .actionButtonText("Yes").onAction(() -> { paymentAccount.setSingleTradeCurrency(selectedItem); autoFillNameTextField(); }).closeButtonText("No, restore default currency") .onClose(() -> currencyComboBox.getSelectionModel().select(defaultCurrency)).show(); } else { paymentAccount.setSingleTradeCurrency(selectedItem); autoFillNameTextField(); } }); currencyComboBox.setConverter(new StringConverter<TradeCurrency>() { @Override public String toString(TradeCurrency currency) { return currency.getNameAndCode(); } @Override public TradeCurrency fromString(String string) { return null; } }); currencyComboBox.setDisable(true); addAcceptedBanksForAddAccount(); addHolderNameAndId(); bankNameTuple = addLabelInputTextField(gridPane, ++gridRow, "Bank name:"); bankNameInputTextField = bankNameTuple.second; bankNameInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { cashDepositAccountContractData.setBankName(newValue); updateFromInputs(); }); bankIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBankIdLabel("")); bankIdLabel = bankIdTuple.first; bankIdInputTextField = bankIdTuple.second; bankIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { cashDepositAccountContractData.setBankId(newValue); updateFromInputs(); }); branchIdTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getBranchIdLabel("")); branchIdLabel = branchIdTuple.first; branchIdInputTextField = branchIdTuple.second; branchIdInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { cashDepositAccountContractData.setBranchId(newValue); updateFromInputs(); }); accountNrTuple = addLabelInputTextField(gridPane, ++gridRow, BankUtil.getAccountNrLabel("")); accountNrLabel = accountNrTuple.first; accountNrInputTextField = accountNrTuple.second; accountNrInputTextField.textProperty().addListener((ov, oldValue, newValue) -> { cashDepositAccountContractData.setAccountNr(newValue); updateFromInputs(); }); accountTypeTuple = addLabelComboBox(gridPane, ++gridRow, ""); accountTypeLabel = accountTypeTuple.first; accountTypeComboBox = accountTypeTuple.second; accountTypeComboBox.setPromptText("Select account type"); accountTypeComboBox.setOnAction(e -> { if (BankUtil.isAccountTypeRequired(cashDepositAccountContractData.getCountryCode())) { cashDepositAccountContractData .setAccountType(accountTypeComboBox.getSelectionModel().getSelectedItem()); updateFromInputs(); } }); TextArea requirementsTextArea = addLabelTextArea(gridPane, ++gridRow, "Extra requirements:", "").second; requirementsTextArea.setMinHeight(30); requirementsTextArea.setMaxHeight(30); requirementsTextArea.textProperty().addListener((ov, oldValue, newValue) -> { cashDepositAccountContractData.setRequirements(newValue); updateFromInputs(); }); addAllowedPeriod(); addAccountNameTextFieldWithAutoFillCheckBox(); updateFromInputs(); }