@Override public void initialize(final URL location, final ResourceBundle resources) { final ObjectProperty<GfaNode> selectedNodeProperty = graphVisualizer.getSelectedSegmentProperty(); selectedNodeProperty.addListener((observable, oldValue, newValue) -> nodePosition.setText(newValue == null ? "" : String.valueOf(newValue.getSegmentIds()))); radius.textProperty().bind(graphDimensionsCalculator.getRadiusProperty().asString()); baseOffset.setTextFormatter(new TextFormatter<>(new IntegerStringConverter())); baseOffset.setText(String.valueOf(sequenceVisualizer.getOffsetProperty().get())); baseOffset.textProperty().addListener((observable, oldValue, newValue) -> updateBaseOffset(newValue)); sequenceVisualizer.getOffsetProperty().addListener((observable, oldValue, newValue) -> baseOffset.setText(String.valueOf(newValue))); saveButton.disableProperty().bind(selectedNodeProperty.isNull()); }
@Override public void initialize(final URL location, final ResourceBundle resources) { sequenceVisualizer.setCanvas(sequenceCanvas); setOffset.setTextFormatter(new TextFormatter<>(new IntegerStringConverter())); sequenceVisualizer.getOffsetProperty().addListener((observable, oldValue, newValue) -> { setOffset.setText(String.valueOf(newValue)); sequenceTextArea.positionCaret(newValue.intValue()); sequenceTextArea.selectPositionCaret(newValue.intValue() + 1); }); graphVisualizer.getSelectedSegmentProperty() .addListener((observable, oldNode, newNode) -> updateFields(newNode)); sequenceCanvas.widthProperty().bind(sequenceGrid.widthProperty().subtract(CANVAS_PADDING * 2)); sequenceViewPane.visibleProperty().bind(sequenceVisualizer.getVisibleProperty() .and(graphStore.getGfaFileProperty().isNotNull())); sequenceViewPane.managedProperty().bind(sequenceVisualizer.getVisibleProperty() .and(graphStore.getGfaFileProperty().isNotNull())); }
@Override protected void setupStage(Stage stage) { stage.getIcons().addAll(PlatformHelper.stageIcons(Images.NEWCERT32, Images.NEWCERT16)); stage.setTitle(CertOptionsI18N.formatSTR_STAGE_TITLE()); this.ctlAliasInput.textProperty().addListener((p, o, n) -> onAliasChanged(o, n)); this.ctlKeyAlgOption.valueProperty().addListener((p, o, n) -> onKeyAlgChanged(n)); this.ctlKeySizeOption.setConverter(new IntegerStringConverter()); this.ctlGeneratorOption.valueProperty().addListener((p, o, n) -> onGeneratorChanged(n)); this.ctlIssuerInput.valueProperty().addListener((p, o, n) -> onIssuerChanged(n)); this.cmdAddBasicConstraints.disableProperty().bind(this.basicConstraintsExtension.isNotNull()); this.cmdAddKeyUsage.disableProperty().bind(this.keyUsageExtension.isNotNull()); this.cmdAddExtendedKeyUsage.disableProperty().bind(this.extendedKeyUsageExtension.isNotNull()); this.cmdAddSubjectAlternativeName.disableProperty().bind(this.subjectAlternativeExtension.isNotNull()); this.cmdAddCRLDistributionPoints.disableProperty().bind(this.crlDistributionPointsExtension.isNotNull()); this.cmdEditExtension.disableProperty() .bind(this.ctlExtensionData.getSelectionModel().selectedItemProperty().isNull()); this.cmdDeleteExtension.disableProperty() .bind(this.ctlExtensionData.getSelectionModel().selectedItemProperty().isNull()); this.ctlExtensionDataCritical.setCellFactory(CheckBoxTableCell.forTableColumn(this.ctlExtensionDataCritical)); this.ctlExtensionDataCritical.setCellValueFactory(new PropertyValueFactory<>("critical")); this.ctlExtensionDataName.setCellValueFactory(new PropertyValueFactory<>("name")); this.ctlExtensionDataValue.setCellValueFactory(new PropertyValueFactory<>("value")); }
/** * Third entry. This if it returns a value actually creates the tab */ void showNewTabColumnsDialog(String name, int rows) { logger.info("showNewTabColumnsDialog was called with the data: " + name + " & " + rows); if (rows > 0) { finishNewTabDialogs(rows, 0, name); return; } TextInputDialog inputDialog = new TextInputDialog(); inputDialog.setContentText("Enter the number of columns to apply to the tab"); inputDialog.getEditor().setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); inputDialog.getEditor().setText("0"); inputDialog.setHeaderText(null); inputDialog.setTitle("New Tab Columns"); inputDialog.showAndWait() .filter(response -> !"".equals(response)) .ifPresent( response -> this.finishNewTabDialogs(rows, Integer.parseInt(response), name)); }
private TextFieldTableCell<ParkingTableViewRow, Integer> unsignedIntegerTextFieldTableCell() { TextFieldTableCell<ParkingTableViewRow, Integer> field = new TextFieldTableCell<>(); field.setConverter(new IntegerStringConverter() { @Override public Integer fromString(String value) { try { Integer intValue = Math.max(1, Math.min(99, super.fromString(value))); return intValue > 0 ? intValue : 1; } catch (NumberFormatException e) { field.cancelEdit(); } return Integer.MAX_VALUE; } }); return field; }
@Override public Node createVisualisation(SimpleObjectProperty<Integer> boundTo, boolean readonly) { TextField textField = new TextField(); TypedTextFieldHelper.setupIntegerTextField(textField); textField.textProperty().bindBidirectional(boundTo, new IntegerStringConverter()); textField.setEditable(!readonly); return textField; }
@Override protected void setupDialog(Dialog<UserCertStore> dialog) { dialog.setTitle(StorePreferencesI18N.formatSTR_STAGE_TITLE()); this.ctlDefKeyAlgOption.valueProperty().addListener((p, o, n) -> onDefKeyAlgChanged(n)); this.ctlDefKeySizeOption.setConverter(new IntegerStringConverter()); addButtonEventFilter(ButtonType.APPLY, this::onApply); }
@Override public TableCell<Anime, Integer> call(final TableColumn<Anime, Integer> arg0) { return new TextFieldTableCell<Anime, Integer>(new IntegerStringConverter()) { @Override public void updateItem(final Integer value, final boolean empty) { super.updateItem(value, empty); } }; }
/** * Second entry. This if it returns a value forwards to the third entry. */ void showNewTabRowsDialog(String name) { logger.info("showNewTabRowsDialog Was called with the string: " + name); TextInputDialog inputDialog = new TextInputDialog(); inputDialog.getEditor().setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); inputDialog.setContentText("Enter the number of rows, or 0 to choose columns instead"); inputDialog.getEditor().setText("0"); inputDialog.setHeaderText(null); inputDialog.setTitle("New Tab Rows"); inputDialog.showAndWait() .filter(response -> !"".equals(response)) .ifPresent( response -> showNewTabColumnsDialog(name, Integer.parseInt(response))); //NOSONAR }
Stage createStage() { Stage newStage = new Stage(); newStage.setScene(new Scene(root)); newStage.setTitle("Add Timer"); daysTextField.setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); hoursTextField.setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); minutesTextField.setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); secondsTextField.setTextFormatter(new TextFormatter<Integer>(new IntegerStringConverter())); return newStage; }
/** * Create various columns for the table * * @param filePathCol full path of the song file * @param fileNameCol name of the song file * @param titleCol title of the song * @param artistCol artist of the song * @param albumCol album of the song * @param genreCol genre of the song * @param lengthCol length of the song * @param ratingCol rating of the song */ private void setTableColumnAttributes(TableColumn<Song, String> filePathCol, TableColumn<Song, String> fileNameCol, TableColumn<Song, String> titleCol, TableColumn<Song, String> artistCol, TableColumn<Song, String> albumCol, TableColumn<Song, String> genreCol, TableColumn<Song, String> lengthCol, TableColumn<Song, Integer> ratingCol) { filePathCol.setCellValueFactory((param) -> { Path absoluteFilePath = param.getValue().getFile().toPath(); Path centerFolderPath = m_model.getM_selectedCenterFolder().toPath(); Path relativePath = centerFolderPath.relativize(absoluteFilePath); String pathToShow = (relativePath.toFile().getParent() == null) ? "" : relativePath.toFile().getParent(); return new ReadOnlyObjectWrapper<>(FileTreeUtils.ELLIPSES_BREAK + File.separator + pathToShow); }); fileNameCol.setCellValueFactory((param) -> new ReadOnlyObjectWrapper<>(param.getValue().getFileName())); titleCol.setCellValueFactory(new PropertyValueFactory<>("m_title")); titleCol.setCellFactory(TextFieldTableCell.forTableColumn()); titleCol.setOnEditCommit((t) -> t.getTableView().getItems().get(t.getTablePosition().getRow()).setTitle(t.getNewValue())); artistCol.setCellValueFactory(new PropertyValueFactory<>("m_artist")); artistCol.setCellFactory(TextFieldTableCell.forTableColumn()); artistCol.setOnEditCommit((t) -> t.getTableView().getItems().get(t.getTablePosition().getRow()).setArtist(t.getNewValue())); albumCol.setCellValueFactory(new PropertyValueFactory<>("m_album")); albumCol.setCellFactory(TextFieldTableCell.forTableColumn()); albumCol.setOnEditCommit((t) -> t.getTableView().getItems().get(t.getTablePosition().getRow()).setAlbum(t.getNewValue())); genreCol.setCellValueFactory(new PropertyValueFactory<>("m_genre")); genreCol.setCellFactory(TextFieldTableCell.forTableColumn()); genreCol.setOnEditCommit((t) -> t.getTableView().getItems().get(t.getTablePosition().getRow()).setGenre(t.getNewValue())); lengthCol.setCellValueFactory((param) -> { Duration lengthOfSong = new Duration( param.getValue().getM_length() * MusicPlayerConstants.NUMBER_OF_MILISECONDS_IN_SECOND); return new ReadOnlyObjectWrapper<>(UserInterfaceUtils.convertDurationToTimeString(lengthOfSong)); }); ratingCol.setCellValueFactory(new PropertyValueFactory<>("m_rating")); ratingCol.setCellFactory(TextFieldTableCell.forTableColumn(new IntegerStringConverter())); ratingCol.setOnEditCommit((t) -> { try { t.getTableView().getItems().get(t.getTablePosition().getRow()).setRating(t.getNewValue()); } catch (IllegalArgumentException ex) { PromptUI.customPromptError("Error", "", "Rating should be in range 0 to 5"); m_model.notifyCenterFolderObservers(); } }); }
/** * Initializes the controller class. * * @param url * @param rb */ @Override public void initialize(URL url, ResourceBundle rb) { //"hidde" the companyHBox companyHBox.setDisable(bussines); //fill the choiseBoxs genderChoiseBox.setConverter(new StringConverter<Sex>() { @Override public Sex fromString(String string) { throw new UnsupportedOperationException("Invalid operation for Convert a String into a Sex."); } @Override public String toString(Sex myClassinstance) { return myClassinstance.getSign(); } }); genderChoiseBox.getItems().addAll(Sex.values()); sourceChoiseBox.setConverter(new StringConverter<Source>() { @Override public Source fromString(String personString) { throw new UnsupportedOperationException("Invalid operation for Convert a String into a Source."); } @Override public String toString(Source sour) { if ( sour == null ) { return null; } else { return sour.getName(); } } }); sourceChoiseBox.getItems().addAll(Source.values()); //get overwriten in accept() lastNameTextField.setText(""); streetTextField.setText(""); //button behavior //enable the save and "saveAndEnhanceUI" button only on filled TextFields saveAndCloseButton.disableProperty().bind( Bindings.createBooleanBinding(() -> lastNameTextField.getText().trim().isEmpty(), lastNameTextField.textProperty() ).or( Bindings.createBooleanBinding(() -> streetTextField.getText().trim().isEmpty(), streetTextField.textProperty() ) )); saveAndEnhanceUIButton.disableProperty().bind( Bindings.createBooleanBinding(() -> lastNameTextField.getText().trim().isEmpty(), lastNameTextField.textProperty() ).or( Bindings.createBooleanBinding(() -> streetTextField.getText().trim().isEmpty(), streetTextField.textProperty() ) )); // force the zipcode field to be numeric only, becuase the ledger get saved as an int zipcodeTextField.textFormatterProperty().set( new TextFormatter<>(new IntegerStringConverter(), 0, change -> { String newText = change.getControlNewText(); if ( Pattern.compile("-?((\\d*))").matcher(newText).matches() ) { return change; } else { return null; } }) ); }
public OnlyIntegerFormatter(Integer defaultValue) { super(new IntegerStringConverter(), defaultValue, new IntegerFilter()); }