Started MainWindow
This commit is contained in:
parent
a8f2fceb9a
commit
fb70a4176d
|
@ -0,0 +1,23 @@
|
|||
package net.dankito.banking.ui.javafx
|
||||
|
||||
import javafx.application.Application
|
||||
import net.dankito.banking.javafx.dialogs.mainwindow.MainWindow
|
||||
import net.dankito.utils.javafx.ui.Utf8App
|
||||
|
||||
|
||||
open class BankingJavaFXApplication : Utf8App("Messages", MainWindow::class) {
|
||||
|
||||
|
||||
@Throws(Exception::class)
|
||||
override fun stop() {
|
||||
super.stop()
|
||||
System.exit(0) // otherwise Window would be closed but application still running in background
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
Application.launch(BankingJavaFXApplication::class.java, *args)
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package net.dankito.banking.javafx.dialogs.mainwindow
|
||||
|
||||
import net.dankito.banking.fints4javaBankingClientCreator
|
||||
import net.dankito.banking.ui.javafx.RouterJavaFx
|
||||
import net.dankito.banking.ui.javafx.dialogs.mainwindow.controls.MainMenuBar
|
||||
import net.dankito.banking.ui.javafx.util.Base64ServiceJava8
|
||||
import net.dankito.banking.ui.presenter.MainWindowPresenter
|
||||
import tornadofx.FX.Companion.messages
|
||||
import tornadofx.View
|
||||
import tornadofx.borderpane
|
||||
import tornadofx.get
|
||||
|
||||
|
||||
class MainWindow : View(messages["main.window.title"]) {
|
||||
|
||||
private val presenter = MainWindowPresenter(fints4javaBankingClientCreator(), Base64ServiceJava8(), RouterJavaFx())
|
||||
|
||||
|
||||
|
||||
override val root = borderpane {
|
||||
prefHeight = 620.0
|
||||
prefWidth = 1150.0
|
||||
|
||||
top = MainMenuBar().root
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package net.dankito.banking.ui.javafx.dialogs.mainwindow.controls
|
||||
|
||||
import javafx.scene.input.KeyCode
|
||||
import javafx.scene.input.KeyCodeCombination
|
||||
import javafx.scene.input.KeyCombination
|
||||
import tornadofx.*
|
||||
|
||||
|
||||
open class MainMenuBar : View() {
|
||||
|
||||
override val root =
|
||||
menubar {
|
||||
minHeight = 30.0
|
||||
maxHeight = 30.0
|
||||
|
||||
menu(messages["main.window.menu.file"]) {
|
||||
|
||||
item(messages["main.window.menu.file.quit"], KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN)) {
|
||||
action { primaryStage.close() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
main.window.title=Banking
|
||||
|
||||
main.window.menu.file=File
|
||||
main.window.menu.file.quit=Quit
|
|
@ -0,0 +1,4 @@
|
|||
main.window.title=Banking
|
||||
|
||||
main.window.menu.file=Datei
|
||||
main.window.menu.file.quit=Beenden
|
|
@ -0,0 +1,36 @@
|
|||
<configuration>
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>DEBUG</level>
|
||||
</filter>
|
||||
|
||||
</appender>
|
||||
|
||||
<!-- Insert the current time formatted as "yyyyMMdd'T'HHmmss" under
|
||||
the key "bySecond" into the logger context. This value will be
|
||||
available to all subsequent configuration elements. -->
|
||||
<timestamp key="bySecond" datePattern="yyyyMMdd'T'HHmmss"/>
|
||||
|
||||
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
|
||||
<file>data/logs/Banking-${bySecond}.log</file>
|
||||
<!-- encoders are assigned the type
|
||||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
|
||||
<encoder>
|
||||
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
|
||||
</encoder>
|
||||
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>DEBUG</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root level="ALL">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
</root>
|
||||
</configuration>
|
|
@ -0,0 +1,26 @@
|
|||
package net.dankito.banking.ui.javafx
|
||||
|
||||
import net.dankito.banking.ui.IRouter
|
||||
import net.dankito.banking.ui.model.Account
|
||||
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
|
||||
|
||||
|
||||
open class RouterJavaFx : IRouter {
|
||||
|
||||
override fun showAddAccountDialog(presenter: MainWindowPresenter) {
|
||||
|
||||
}
|
||||
|
||||
override fun getTanFromUserFromNonUiThread(account: Account, tanChallenge: TanChallenge, presenter: MainWindowPresenter): EnterTanResult {
|
||||
return EnterTanResult.userDidNotEnterTan()
|
||||
}
|
||||
|
||||
override fun getAtcFromUserFromNonUiThread(tanMedium: TanGeneratorTanMedium): EnterTanGeneratorAtcResult {
|
||||
return EnterTanGeneratorAtcResult.userDidNotEnterTan()
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package net.dankito.banking.ui.javafx.util
|
||||
|
||||
import net.dankito.banking.util.IBase64Service
|
||||
import java.nio.charset.Charset
|
||||
import java.util.*
|
||||
|
||||
|
||||
// TODO: use version from JavaFxUtils
|
||||
open class Base64ServiceJava8 : IBase64Service {
|
||||
|
||||
override fun encode(text: String, charset: Charset): String {
|
||||
return Base64.getEncoder().encodeToString(text.toByteArray(charset))
|
||||
}
|
||||
|
||||
override fun decode(base64: String, charset: Charset): String {
|
||||
val decodedBytes = Base64.getDecoder().decode(base64)
|
||||
|
||||
return String(decodedBytes, charset)
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue