use of javafx.fxml.FXML in project jgnash by ccavanaugh.
the class RemoteConnectionDialogController method handleOkAction.
@FXML
private void handleOkAction() {
result = true;
final Preferences preferences = Preferences.userNodeForPackage(RemoteConnectionDialogController.class);
preferences.put(LAST_HOST, hostTextField.getText());
preferences.putInt(LAST_PORT, portTextField.getInteger());
((Stage) parent.get().getWindow()).close();
}
use of javafx.fxml.FXML in project jgnash by ccavanaugh.
the class AddRemoveCurrencyController method initialize.
@FXML
@SuppressWarnings("unchecked")
void initialize() {
availableList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
selectedList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
selectedList.setCellFactory(param -> new LockedCommodityListCell<>());
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
newCurrencyTextField.textProperty().addListener((observable, oldValue, newValue) -> validProperty.set(engine.getCurrency(newCurrencyTextField.getText()) == null));
addButton.disableProperty().bind(newCurrencyTextField.textProperty().isEmpty().or(validProperty.not()));
loadModel();
}
use of javafx.fxml.FXML in project jgnash by ccavanaugh.
the class StartupShutdownTabController method initialize.
@FXML
private void initialize() {
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
backupCountSpinner.setValueFactory(new SpinnerValueFactory.IntegerSpinnerValueFactory(1, 1000, 1, 1));
if (engine != null) {
backupCountSpinner.getValueFactory().setValue(engine.getRetainedBackupLimit());
createBackupsCheckBox.setSelected(engine.createBackups());
removeOldBackupsCheckBox.setSelected(engine.removeOldBackups());
backupCountSpinner.valueProperty().addListener((observable, oldValue, newValue) -> engine.setRetainedBackupLimit(newValue));
createBackupsCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> engine.setCreateBackups(newValue));
removeOldBackupsCheckBox.selectedProperty().addListener((observable, oldValue, newValue) -> engine.setRemoveOldBackups(newValue));
} else {
backupCountSpinner.setDisable(true);
createBackupsCheckBox.setDisable(true);
removeOldBackupsCheckBox.setDisable(true);
}
updateSecurities.setSelected(UpdateFactory.getUpdateOnStartup());
updateCurrencies.setSelected(CurrencyUpdateFactory.getUpdateOnStartup());
updateSecurities.selectedProperty().addListener((observable, oldValue, newValue) -> UpdateFactory.setUpdateOnStartup(newValue));
updateCurrencies.selectedProperty().addListener((observable, oldValue, newValue) -> CurrencyUpdateFactory.setUpdateOnStartup(newValue));
openLastCheckBox.selectedProperty().bindBidirectional(Options.openLastProperty());
checkForUpdatesCheckBox.selectedProperty().bindBidirectional(Options.checkForUpdatesProperty());
}
use of javafx.fxml.FXML in project jgnash by ccavanaugh.
the class CreateModifySecuritiesController method handleApplyAction.
@FXML
private void handleApplyAction() {
// always ensure a positive scale is entered
if (scaleTextField.getInteger() <= 0) {
scaleTextField.setInteger((int) reportedCurrencyComboBox.getValue().getScale());
}
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
final SecurityNode newNode = buildSecurityNode();
if (selectedSecurityNode.get() != null) {
if (!engine.updateCommodity(selectedSecurityNode.get(), newNode)) {
StaticUIMethods.displayError(ResourceUtils.getString("Message.Error.SecurityUpdate", newNode.getSymbol()));
}
} else {
if (!engine.addSecurity(newNode)) {
StaticUIMethods.displayError(ResourceUtils.getString("Message.Error.SecurityAdd", newNode.getSymbol()));
}
}
clearForm();
}
use of javafx.fxml.FXML in project jgnash by ccavanaugh.
the class AddRemoveCurrencyController method handleNewCurrencyAction.
@FXML
private void handleNewCurrencyAction() {
final Engine engine = EngineFactory.getEngine(EngineFactory.DEFAULT);
Objects.requireNonNull(engine);
final CurrencyNode node = DefaultCurrencies.buildCustomNode(newCurrencyTextField.getText());
// the add could fail if the commodity symbol is a duplicate
if (engine.addCurrency(node)) {
selectedList.getItems().add(new LockedCommodityNode<>(node, false));
FXCollections.sort(selectedList.getItems());
newCurrencyTextField.clear();
}
}
Aggregations