Renamed MainWindowPresenter to BankingPresenter

This commit is contained in:
dankl 2020-01-26 13:03:32 +01:00 committed by dankito
parent beb2dca2a9
commit f1494d485a
21 changed files with 55 additions and 56 deletions

View File

@ -7,7 +7,7 @@ import net.dankito.banking.ui.javafx.RouterJavaFx
import net.dankito.banking.ui.javafx.controls.AccountTransactionsView
import net.dankito.banking.ui.javafx.controls.AccountsView
import net.dankito.banking.ui.javafx.dialogs.mainwindow.controls.MainMenuBar
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import tornadofx.*
import tornadofx.FX.Companion.messages
import java.io.File
@ -18,7 +18,7 @@ class MainWindow : View(messages["application.title"]) {
private val dataFolder = File("data", "accounts")
// private val presenter = MainWindowPresenter(fints4javaBankingClientCreator(OkHttpWebClient(), Base64ServiceJava8()), dataFolder, BankingPersistenceJson(File(dataFolder, "accounts.json")), RouterJavaFx())
private val presenter = MainWindowPresenter(hbci4jBankingClientCreator(), dataFolder, BankingPersistenceJson(File(dataFolder, "accounts.json")), RouterJavaFx())
private val presenter = BankingPresenter(hbci4jBankingClientCreator(), dataFolder, BankingPersistenceJson(File(dataFolder, "accounts.json")), RouterJavaFx())

View File

@ -4,12 +4,12 @@ import javafx.beans.property.SimpleBooleanProperty
import javafx.scene.input.KeyCode
import javafx.scene.input.KeyCodeCombination
import javafx.scene.input.KeyCombination
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.javafx.ui.extensions.fixedHeight
import tornadofx.*
open class MainMenuBar(protected val presenter: MainWindowPresenter) : View() {
open class MainMenuBar(protected val presenter: BankingPresenter) : View() {
protected val areAccountsThatCanTransferMoneyAdded = SimpleBooleanProperty()

View File

@ -11,7 +11,7 @@ import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult
import net.dankito.banking.ui.model.tan.EnterTanResult
import net.dankito.banking.ui.model.tan.TanChallenge
import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import tornadofx.FX
import tornadofx.FX.Companion.messages
import tornadofx.get
@ -21,11 +21,11 @@ import java.util.concurrent.atomic.AtomicReference
open class RouterJavaFx : IRouter {
override fun showAddAccountDialog(presenter: MainWindowPresenter) {
override fun showAddAccountDialog(presenter: BankingPresenter) {
AddAccountDialog(presenter).show(messages["add.account.dialog.title"])
}
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult {
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: BankingPresenter): EnterTanResult {
val enteredTan = AtomicReference<EnterTanResult>(null)
val tanEnteredLatch = CountDownLatch(1)
@ -45,7 +45,7 @@ open class RouterJavaFx : IRouter {
return EnterTanGeneratorAtcResult.userDidNotEnterTan()
}
override fun showTransferMoneyDialog(presenter: MainWindowPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?) {
override fun showTransferMoneyDialog(presenter: BankingPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?) {
TransferMoneyDialog(presenter, preselectedBankAccount, preselectedValues).show(messages["transfer.money.dialog.title"])
}

View File

@ -4,7 +4,7 @@ import javafx.beans.property.SimpleBooleanProperty
import javafx.beans.property.SimpleStringProperty
import javafx.geometry.Insets
import javafx.geometry.Pos
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.javafx.ui.controls.UpdateButton
import net.dankito.utils.javafx.ui.controls.addButton
import net.dankito.utils.javafx.ui.controls.searchtextfield
@ -14,7 +14,7 @@ import tornadofx.*
open class AccountTransactionsControlView(
protected val presenter: MainWindowPresenter,
protected val presenter: BankingPresenter,
protected val transactionsFilter: SimpleStringProperty,
protected val balance: SimpleStringProperty
) : View() {

View File

@ -6,14 +6,13 @@ import javafx.collections.ObservableList
import javafx.geometry.Insets
import javafx.geometry.Pos
import javafx.scene.control.ContentDisplay
import javafx.scene.control.ContextMenu
import javafx.scene.control.TableColumn
import javafx.scene.control.TableView
import javafx.scene.layout.Priority
import javafx.scene.paint.Color
import javafx.util.Callback
import net.dankito.banking.ui.model.AccountTransaction
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.javafx.ui.extensions.ensureOnlyUsesSpaceIfVisible
import tornadofx.*
import tornadofx.FX.Companion.messages
@ -21,7 +20,7 @@ import java.text.DateFormat
open class AccountTransactionsTable @JvmOverloads constructor(
protected val presenter: MainWindowPresenter,
protected val presenter: BankingPresenter,
transactions: ObservableList<AccountTransaction> = FXCollections.emptyObservableList<AccountTransaction>()
) : TableView<AccountTransaction>(transactions) {

View File

@ -11,11 +11,11 @@ import net.dankito.banking.ui.model.AccountTransaction
import net.dankito.banking.ui.model.BankAccount
import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import tornadofx.*
open class AccountTransactionsView(private val presenter: MainWindowPresenter) : View() {
open class AccountTransactionsView(private val presenter: BankingPresenter) : View() {
protected val isAccountSelected = SimpleBooleanProperty(false)

View File

@ -8,14 +8,14 @@ import javafx.scene.layout.Priority
import net.dankito.banking.ui.javafx.model.AccountsAccountTreeItem
import net.dankito.banking.ui.javafx.model.AccountsBankAccountTreeItem
import net.dankito.banking.ui.javafx.model.AccountsRootTreeItem
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.javafx.ui.controls.addButton
import net.dankito.utils.javafx.ui.extensions.fixedHeight
import net.dankito.utils.javafx.ui.extensions.fixedWidth
import tornadofx.*
open class AccountsView(protected val presenter: MainWindowPresenter) : View() {
open class AccountsView(protected val presenter: BankingPresenter) : View() {
protected val accounts = FXCollections.observableArrayList(presenter.accounts)

View File

@ -12,7 +12,7 @@ import javafx.scene.paint.Color
import javafx.scene.text.Font
import javafx.scene.text.FontWeight
import net.dankito.banking.ui.model.responses.AddAccountResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.model.BankInfo
import net.dankito.utils.javafx.ui.controls.UpdateButton
import net.dankito.utils.javafx.ui.dialogs.Window
@ -22,7 +22,7 @@ import net.dankito.utils.javafx.ui.extensions.setBackgroundToColor
import tornadofx.*
open class AddAccountDialog(protected val presenter: MainWindowPresenter) : Window() {
open class AddAccountDialog(protected val presenter: BankingPresenter) : Window() {
companion object {
private val LabelMargins = Insets(6.0, 4.0, 6.0, 4.0)
@ -237,7 +237,7 @@ open class AddAccountDialog(protected val presenter: MainWindowPresenter) : Wind
val userSelection = dialogService.showDialog(Alert.AlertType.CONFIRMATION, message, null, currentStage, ButtonType.YES, ButtonType.NO)
when (userSelection) {
ButtonType.YES -> { presenter.getAccountTransactionsAsync(response.account) { } }
ButtonType.YES -> presenter.getAccountTransactionsAsync(response.account) { }
else -> { } // nothing to do then, simply close dialog
}

View File

@ -11,7 +11,7 @@ import net.dankito.banking.ui.javafx.dialogs.JavaFxDialogService
import net.dankito.banking.ui.model.BankAccount
import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.messages.segmente.implementierte.sepa.ISepaMessageCreator
import net.dankito.fints.messages.segmente.implementierte.sepa.SepaMessageCreator
import net.dankito.fints.model.BankInfo
@ -23,7 +23,7 @@ import tornadofx.*
open class TransferMoneyDialog @JvmOverloads constructor(
protected val presenter: MainWindowPresenter,
protected val presenter: BankingPresenter,
preselectedBankAccount: BankAccount? = null,
preselectedValues: TransferMoneyData? = null
) : Window() {

View File

@ -10,7 +10,7 @@ import net.dankito.banking.ui.javafx.dialogs.tan.controls.TanImageView
import net.dankito.banking.ui.model.Account
import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.model.tan.*
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.javafx.ui.dialogs.Window
import tornadofx.*
@ -18,7 +18,7 @@ import tornadofx.*
open class EnterTanDialog(
protected val account: Account,
protected val challenge: TanChallenge,
protected val presenter: MainWindowPresenter,
protected val presenter: BankingPresenter,
protected val tanEnteredCallback: (EnterTanResult) -> Unit
) : Window() {

View File

@ -7,17 +7,17 @@ import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult
import net.dankito.banking.ui.model.tan.EnterTanResult
import net.dankito.banking.ui.model.tan.TanChallenge
import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
interface IRouter {
fun showAddAccountDialog(presenter: MainWindowPresenter)
fun showAddAccountDialog(presenter: BankingPresenter)
fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult
fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: BankingPresenter): EnterTanResult
fun getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult
fun showTransferMoneyDialog(presenter: MainWindowPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?)
fun showTransferMoneyDialog(presenter: BankingPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?)
}

View File

@ -28,7 +28,7 @@ import java.util.*
import kotlin.collections.ArrayList
open class MainWindowPresenter(
open class BankingPresenter(
protected val bankingClientCreator: IBankingClientCreator,
protected val dataFolder: File,
protected val persister: IBankingPersistence,
@ -39,7 +39,7 @@ open class MainWindowPresenter(
companion object {
protected const val OneDayMillis = 24 * 60 * 60 * 1000
private val log = LoggerFactory.getLogger(MainWindowPresenter::class.java)
private val log = LoggerFactory.getLogger(BankingPresenter::class.java)
}
@ -68,7 +68,7 @@ open class MainWindowPresenter(
saveAccountOnNextEnterTanInvocation = false
}
val result = router.getTanFromUserFromNonUiThread(account, tanChallenge, this@MainWindowPresenter)
val result = router.getTanFromUserFromNonUiThread(account, tanChallenge, this@BankingPresenter)
if (result.changeTanProcedureTo != null || result.changeTanMediumTo != null) { // then either selected TAN medium or procedure will change -> save account on next call to enterTan() as then changes will be visible
saveAccountOnNextEnterTanInvocation = true

View File

@ -20,7 +20,7 @@ import net.dankito.banking.fints4java.android.util.Base64ServiceAndroid
import net.dankito.banking.fints4javaBankingClientCreator
import net.dankito.banking.persistence.BankingPersistenceJson
import net.dankito.banking.ui.model.Account
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.web.client.OkHttpWebClient
import org.slf4j.LoggerFactory
import java.io.File
@ -40,7 +40,7 @@ class MainActivity : AppCompatActivity() {
private lateinit var floatingActionMenuButton: MainActivityFloatingActionMenuButton
lateinit var presenter: MainWindowPresenter
lateinit var presenter: BankingPresenter
override fun onCreate(savedInstanceState: Bundle?) {
@ -48,7 +48,7 @@ class MainActivity : AppCompatActivity() {
val dataFolder = File(this.filesDir, "data/accounts")
presenter = MainWindowPresenter(fints4javaBankingClientCreator(OkHttpWebClient(), Base64ServiceAndroid()), dataFolder,
presenter = BankingPresenter(fints4javaBankingClientCreator(OkHttpWebClient(), Base64ServiceAndroid()), dataFolder,
BankingPersistenceJson(File(dataFolder, "accounts.json")), RouterAndroid(this))
initUi()

View File

@ -13,18 +13,18 @@ import net.dankito.banking.ui.model.tan.EnterTanGeneratorAtcResult
import net.dankito.banking.ui.model.tan.EnterTanResult
import net.dankito.banking.ui.model.tan.TanChallenge
import net.dankito.banking.ui.model.tan.TanGeneratorTanMedium
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import java.util.concurrent.CountDownLatch
import java.util.concurrent.atomic.AtomicReference
open class RouterAndroid(protected val activity: AppCompatActivity) : IRouter {
override fun showAddAccountDialog(presenter: MainWindowPresenter) {
override fun showAddAccountDialog(presenter: BankingPresenter) {
AddAccountDialog().show(activity, presenter)
}
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult {
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: BankingPresenter): EnterTanResult {
val enteredTan = AtomicReference<EnterTanResult>(null)
val tanEnteredLatch = CountDownLatch(1)
@ -56,7 +56,7 @@ open class RouterAndroid(protected val activity: AppCompatActivity) : IRouter {
return result.get()
}
override fun showTransferMoneyDialog(presenter: MainWindowPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?) {
override fun showTransferMoneyDialog(presenter: BankingPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?) {
TransferMoneyDialog().show(activity, presenter, preselectedBankAccount, preselectedValues)
}

View File

@ -8,14 +8,14 @@ import android.widget.Filter
import android.widget.Filterable
import kotlinx.android.synthetic.main.list_item_bank_info.view.*
import net.dankito.banking.fints4java.android.R
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.banking.fints4java.android.ui.adapter.filter.BankInfoFilter
import net.dankito.fints.model.BankInfo
import net.dankito.utils.android.extensions.setTintColor
import net.dankito.utils.android.ui.adapter.ListAdapter
open class BankListAdapter(protected val presenter: MainWindowPresenter) : ListAdapter<BankInfo>(), Filterable {
open class BankListAdapter(protected val presenter: BankingPresenter) : ListAdapter<BankInfo>(), Filterable {
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View? {

View File

@ -1,11 +1,11 @@
package net.dankito.banking.fints4java.android.ui.adapter.filter
import android.widget.Filter
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.model.BankInfo
open class BankInfoFilter(protected val presenter: MainWindowPresenter,
open class BankInfoFilter(protected val presenter: BankingPresenter,
protected val publishResultsCallback: (List<BankInfo>) -> Unit) : Filter() {

View File

@ -17,7 +17,7 @@ import kotlinx.android.synthetic.main.dialog_add_account.view.*
import net.dankito.banking.fints4java.android.R
import net.dankito.banking.fints4java.android.ui.adapter.BankListAdapter
import net.dankito.banking.ui.model.responses.AddAccountResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.model.BankInfo
import net.dankito.utils.android.extensions.asActivity
@ -29,14 +29,14 @@ open class AddAccountDialog : DialogFragment() {
}
protected lateinit var presenter: MainWindowPresenter
protected lateinit var presenter: BankingPresenter
protected lateinit var adapter: BankListAdapter
protected var selectedBank: BankInfo? = null
fun show(activity: AppCompatActivity, presenter: MainWindowPresenter, fullscreen: Boolean = false) {
fun show(activity: AppCompatActivity, presenter: BankingPresenter, fullscreen: Boolean = false) {
this.presenter = presenter
presenter.preloadBanksAsync()

View File

@ -21,7 +21,7 @@ import net.dankito.banking.fints4java.android.ui.listener.ListItemSelectedListen
import net.dankito.banking.ui.model.Account
import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.model.tan.*
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
open class EnterTanDialog : DialogFragment() {
@ -37,14 +37,14 @@ open class EnterTanDialog : DialogFragment() {
protected lateinit var tanChallenge: TanChallenge
protected lateinit var presenter: MainWindowPresenter
protected lateinit var presenter: BankingPresenter
protected lateinit var tanEnteredCallback: (EnterTanResult) -> Unit
protected val tanMediumAdapter = TanMediumAdapter()
open fun show(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter, activity: AppCompatActivity,
open fun show(account: Account, tanChallenge: TanChallenge, presenter: BankingPresenter, activity: AppCompatActivity,
fullscreen: Boolean = false, tanEnteredCallback: (EnterTanResult) -> Unit) {
this.account = account

View File

@ -17,7 +17,7 @@ import net.dankito.banking.fints4java.android.ui.listener.ListItemSelectedListen
import net.dankito.banking.ui.model.BankAccount
import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.BankingClientResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.fints.messages.segmente.implementierte.sepa.ISepaMessageCreator
import net.dankito.fints.messages.segmente.implementierte.sepa.SepaMessageCreator
import net.dankito.fints.model.BankInfo
@ -32,7 +32,7 @@ open class TransferMoneyDialog : DialogFragment() {
}
protected lateinit var presenter: MainWindowPresenter
protected lateinit var presenter: BankingPresenter
protected var preselectedBankAccount: BankAccount? = null
@ -43,11 +43,11 @@ open class TransferMoneyDialog : DialogFragment() {
protected val sepaMessageCreator: ISepaMessageCreator = SepaMessageCreator()
open fun show(activity: AppCompatActivity, presenter: MainWindowPresenter, preselectedBankAccount: BankAccount?, fullscreen: Boolean = false) {
open fun show(activity: AppCompatActivity, presenter: BankingPresenter, preselectedBankAccount: BankAccount?, fullscreen: Boolean = false) {
show(activity, presenter, preselectedBankAccount, null, fullscreen)
}
open fun show(activity: AppCompatActivity, presenter: MainWindowPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?, fullscreen: Boolean = false) {
open fun show(activity: AppCompatActivity, presenter: BankingPresenter, preselectedBankAccount: BankAccount?, preselectedValues: TransferMoneyData?, fullscreen: Boolean = false) {
this.presenter = presenter
this.preselectedBankAccount = preselectedBankAccount
this.preselectedValues = preselectedValues

View File

@ -18,7 +18,7 @@ import net.dankito.banking.fints4java.android.ui.adapter.AccountTransactionAdapt
import net.dankito.banking.ui.model.AccountTransaction
import net.dankito.banking.ui.model.parameters.TransferMoneyData
import net.dankito.banking.ui.model.responses.GetTransactionsResponse
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
import net.dankito.utils.android.extensions.asActivity
@ -38,7 +38,7 @@ class HomeFragment : Fragment() {
protected var appliedTransactionsFilter = ""
private lateinit var presenter: MainWindowPresenter
private lateinit var presenter: BankingPresenter
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -4,10 +4,10 @@ import android.support.v7.app.AppCompatActivity
import com.github.clans.fab.FloatingActionButton
import com.github.clans.fab.FloatingActionMenu
import kotlinx.android.synthetic.main.view_floating_action_button_main.view.*
import net.dankito.banking.ui.presenter.MainWindowPresenter
import net.dankito.banking.ui.presenter.BankingPresenter
open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: MainWindowPresenter)
open class MainActivityFloatingActionMenuButton(floatingActionMenu: FloatingActionMenu, protected val presenter: BankingPresenter)
: FloatingActionMenuButton(floatingActionMenu) {
protected lateinit var fabTransferMoney: FloatingActionButton