use of jgnash.uifx.util.FXMLUtils in project jgnash by ccavanaugh.
the class ReconcileSettingsDialogController method handleOkayAction.
@FXML
private void handleOkayAction() {
final LocalDate statementDate = datePicker.getValue();
final BigDecimal openingBalance = openingBalanceTextField.getDecimal();
final BigDecimal closingBalance = closingBalanceTextField.getDecimal();
final FXMLUtils.Pair<ReconcileDialogController> pair = FXMLUtils.load(ReconcileDialogController.class.getResource("ReconcileDialog.fxml"), ResourceUtils.getString("Button.Reconcile") + " - " + account.get().getPathName());
pair.getController().initialize(account.get(), statementDate, openingBalance, closingBalance);
// Override the defaults set by FXMLUtils
pair.getStage().initModality(Modality.NONE);
pair.getStage().initOwner(null);
JavaFXUtils.runLater(() -> {
pair.getStage().show();
pair.getStage().setMinWidth(pair.getStage().getWidth());
pair.getStage().setMinHeight(pair.getStage().getHeight());
});
// push account updates outside the UI thread to improve performance
new Thread(() -> {
ReconcileManager.setAccountDateAttribute(accountProperty().get(), Account.RECONCILE_LAST_ATTEMPT_DATE, LocalDate.now());
ReconcileManager.setAccountDateAttribute(accountProperty().get(), Account.RECONCILE_LAST_STATEMENT_DATE, statementDate);
ReconcileManager.setAccountBigDecimalAttribute(accountProperty().get(), Account.RECONCILE_LAST_OPENING_BALANCE, openingBalance);
ReconcileManager.setAccountBigDecimalAttribute(accountProperty().get(), Account.RECONCILE_LAST_CLOSING_BALANCE, closingBalance);
}).start();
// close the dialog
handleCloseAction();
}
Aggregations