Implemented sorting account that support money transfer by display index
This commit is contained in:
parent
d13ccaf871
commit
77a4273179
|
@ -108,7 +108,7 @@ open class TransferMoneyDialog : DialogFragment() {
|
|||
}
|
||||
|
||||
protected open fun setupUI(rootView: View) {
|
||||
val accountsSupportingTransferringMoney = presenter.accountsSupportingTransferringMoney
|
||||
val accountsSupportingTransferringMoney = presenter.accountsSupportingTransferringMoneySortedByDisplayIndex
|
||||
account = preselectedValues?.account ?: accountsSupportingTransferringMoney.first()
|
||||
|
||||
if (accountsSupportingTransferringMoney.size > 1) {
|
||||
|
|
|
@ -47,7 +47,7 @@ open class TransferMoneyDialog @JvmOverloads constructor(
|
|||
}
|
||||
|
||||
|
||||
protected val bankAccountsSupportingTransferringMoney = FXCollections.observableArrayList(presenter.allAccounts.filter { it.supportsTransferringMoney })
|
||||
protected val bankAccountsSupportingTransferringMoney = FXCollections.observableArrayList(presenter.accountsSupportingTransferringMoneySortedByDisplayIndex)
|
||||
|
||||
protected val selectedBankAccount = SimpleObjectProperty<TypedBankAccount>(preselectedValues?.account ?: bankAccountsSupportingTransferringMoney.firstOrNull())
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package net.dankito.banking.ui.comparator
|
||||
|
||||
import net.dankito.banking.ui.model.TypedBankAccount
|
||||
|
||||
|
||||
open class BankAccountComparator : Comparator<TypedBankAccount> {
|
||||
|
||||
override fun compare(a: TypedBankAccount, b: TypedBankAccount): Int {
|
||||
if (a.bank.displayIndex == b.bank.displayIndex) {
|
||||
return a.displayIndex.compareTo(b.displayIndex)
|
||||
}
|
||||
|
||||
return a.bank.displayIndex.compareTo(b.bank.displayIndex)
|
||||
}
|
||||
|
||||
}
|
|
@ -15,6 +15,7 @@ import net.dankito.banking.bankfinder.BankInfo
|
|||
import net.dankito.banking.search.ITransactionPartySearcher
|
||||
import net.dankito.banking.search.NoOpTransactionPartySearcher
|
||||
import net.dankito.banking.search.TransactionParty
|
||||
import net.dankito.banking.ui.comparator.BankAccountComparator
|
||||
import net.dankito.banking.ui.model.mapper.DefaultModelCreator
|
||||
import net.dankito.banking.ui.model.mapper.IModelCreator
|
||||
import net.dankito.banking.ui.model.moneytransfer.ExtractTransferMoneyDataFromPdfResult
|
||||
|
@ -750,6 +751,10 @@ open class BankingPresenter(
|
|||
open val accountsSupportingTransferringMoney: List<TypedBankAccount>
|
||||
get() = allAccounts.filter { it.supportsTransferringMoney }
|
||||
|
||||
open val accountsSupportingTransferringMoneySortedByDisplayIndex: List<TypedBankAccount>
|
||||
get() = accountsSupportingTransferringMoney
|
||||
.sortedWith(BankAccountComparator())
|
||||
|
||||
open val hasAccountsSupportTransferringMoney: Boolean
|
||||
get() = doAccountsSupportTransferringMoney(allAccounts)
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct TransferMoneyDialog: View {
|
|||
|
||||
|
||||
init() {
|
||||
self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoney
|
||||
self.accountsSupportingTransferringMoney = self.presenter.accountsSupportingTransferringMoneySortedByDisplayIndex
|
||||
|
||||
self.showAccounts = self.accountsSupportingTransferringMoney.count > 1
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue