Fixed that banks have been searched in two different places

This commit is contained in:
dankito 2020-06-14 19:56:49 +02:00
parent 1c049b4bf3
commit b1bb1767af
1 changed files with 3 additions and 16 deletions

View File

@ -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