List of usage examples for javafx.util.converter LocalDateStringConverter LocalDateStringConverter
public LocalDateStringConverter(DateTimeFormatter formatter, DateTimeFormatter parser)
From source file:ua.com.ecotep.debtprevention.VnaklController.java
@Override public void initialize(URL url, ResourceBundle rb) { DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); dateFieldFormatter = new TextFormatter(new LocalDateStringConverter(dateTimeFormatter, null)); dateField.setTextFormatter(dateFieldFormatter); dateMaxFieldFormatter = new TextFormatter(new LocalDateStringConverter(dateTimeFormatter, null)); dateMaxField.setTextFormatter(dateMaxFieldFormatter); TableColumn numCol = new TableColumn("."); numCol.setPrefWidth(100);/*from w w w. j a v a2 s .c o m*/ numCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("num")); invTable.getColumns().add(numCol); TableColumn dateCol = new TableColumn(""); dateCol.setPrefWidth(90); dateCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("date")); dateCol.setCellFactory(CellDateBox.forTableColumn(dateCol, CellDateBox.DATE_NORMAL_VIEW)); invTable.getColumns().add(dateCol); TableColumn sumCol = new TableColumn(""); sumCol.setPrefWidth(90); sumCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("sum")); sumCol.setCellFactory(CellMoneyBox.forTableColumn(sumCol, " ", 2)); invTable.getColumns().add(sumCol); invTable.autosize(); invTable.getItems().addListener(new ListChangeListener<DebPrevDetailBean>() { @Override public void onChanged(ListChangeListener.Change<? extends DebPrevDetailBean> c) { double sumDpm = 0; for (DebPrevDetailBean bean : c.getList()) { sumDpm += bean.getSum(); } sumField.setText(String.format("%.2f ", sumDpm)); if (sumDpm > 0) { saveButon.setDisable(false); } else { saveButon.setDisable(true); } } }); TableColumn numVCol = new TableColumn("."); numVCol.setPrefWidth(100); numVCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("num")); vnaklTable.getColumns().add(numVCol); TableColumn dateVCol = new TableColumn(""); dateVCol.setPrefWidth(90); dateVCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("date")); dateVCol.setCellFactory(CellDateBox.forTableColumn(dateVCol, CellDateBox.DATE_NORMAL_VIEW)); vnaklTable.getColumns().add(dateVCol); TableColumn sumVCol = new TableColumn(""); sumVCol.setPrefWidth(90); sumVCol.setCellValueFactory(new PropertyValueFactory<DebPrevDetailBean, String>("sum")); sumVCol.setCellFactory(CellMoneyBox.forTableColumn(sumVCol, " ", 2)); vnaklTable.getColumns().add(sumVCol); vnaklTable.autosize(); TextMaxLengthFieldInstaller mlControl = new TextMaxLengthFieldInstaller(); mlControl.install(clientField, 150); try { dateFieldFormatter.setValue(currentDate); dateMaxFieldFormatter.setValue(currentDate); } catch (Exception ex) { Logger.getLogger(FilterController.class.getName()).log(Level.SEVERE, null, ex); AlertDialog.showSimpleMessage(" ? !", AlertDialog.ICON_ERROR, parentInterface.getCurrentWindow()); } }