From b1bb1767af17cd218d6e0f0c87889ccf541626fb Mon Sep 17 00:00:00 2001 From: dankito Date: Sun, 14 Jun 2020 19:56:49 +0200 Subject: [PATCH] Fixed that banks have been searched in two different places --- .../ui/javafx/dialogs/AddAccountDialog.kt | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt index 05656c98..95756f5e 100755 --- a/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt +++ b/ui/BankingJavaFxControls/src/main/kotlin/net/dankito/banking/ui/javafx/dialogs/AddAccountDialog.kt @@ -67,7 +67,7 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window( init { - bankCode.addListener { _, _, newValue -> checkIsEnteredBankCodeValid(newValue) } + bankCode.addListener { _, _, newValue -> searchBanks(newValue) } customerId.addListener { _, _, _ -> checkIfRequiredDataHasBeenEntered() } @@ -87,8 +87,6 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window( txtfldBankCode = autocompletionsearchtextfield(bankCode) { prefHeight = TextFieldHeight - textProperty().addListener { _, _, newValue -> searchBanks(newValue) } - onAutoCompletion = { bankSelected(it) } listCellFragment = BankInfoListCellFragment::class @@ -204,6 +202,8 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window( withContext(Dispatchers.Main) { txtfldBankCode.setAutoCompleteList(filteredBanks) + + checkIfRequiredDataHasBeenEntered() } } } @@ -229,19 +229,6 @@ open class AddAccountDialog(protected val presenter: BankingPresenter) : Window( } - protected open fun checkIsEnteredBankCodeValid(enteredBankCode: String?) { - enteredBankCode?.let { - val banksSearchResult = presenter.searchBanksByNameBankCodeOrCity(enteredBankCode) - - // TODO: show banksSearchResult in AutoCompleteListView - - val uniqueBankCodes = banksSearchResult.map { it.bankCode }.toSet() - selectedBank = if (uniqueBankCodes.size == 1) banksSearchResult.first() else null - - checkIfRequiredDataHasBeenEntered() - } - } - protected open fun checkIfRequiredDataHasBeenEntered() { requiredDataHasBeenEntered.value = selectedBank != null && selectedBank?.supportsFinTs3_0 == true