added functions in StartupViewController
This commit is contained in:
		@ -5,4 +5,10 @@ import tornadofx.App
 | 
			
		||||
 | 
			
		||||
class Main: App(StartupView::class){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -6,6 +6,7 @@ import com.jfoenix.controls.JFXTextField
 | 
			
		||||
import javafx.geometry.Insets
 | 
			
		||||
import javafx.geometry.Pos
 | 
			
		||||
import javafx.scene.control.Label
 | 
			
		||||
import javafx.scene.input.KeyCode
 | 
			
		||||
import javafx.scene.layout.Background
 | 
			
		||||
import javafx.scene.layout.BackgroundFill
 | 
			
		||||
import javafx.scene.layout.CornerRadii
 | 
			
		||||
@ -24,23 +25,36 @@ class StartupView : View() {
 | 
			
		||||
 | 
			
		||||
    val btnConnect = JFXButton("Manuell Verbinden")
 | 
			
		||||
 | 
			
		||||
   private  val svc: StartupViewController by inject()
 | 
			
		||||
 | 
			
		||||
    override val root = borderpane {
 | 
			
		||||
 | 
			
		||||
        center = vbox(50) {
 | 
			
		||||
            maxWidth = 150.0
 | 
			
		||||
            alignment = Pos.CENTER
 | 
			
		||||
 | 
			
		||||
            add(labelStatus).apply {
 | 
			
		||||
                labelStatus.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY))
 | 
			
		||||
            }
 | 
			
		||||
            add(labelStatus)
 | 
			
		||||
            add(spinnerStatus)
 | 
			
		||||
 | 
			
		||||
            labelStatus.apply {
 | 
			
		||||
                this.background = Background(BackgroundFill(Color.YELLOWGREEN, CornerRadii.EMPTY, Insets.EMPTY))
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            spinnerStatus.isVisible = false
 | 
			
		||||
 | 
			
		||||
            vbox(10){
 | 
			
		||||
                alignment = Pos.CENTER
 | 
			
		||||
 | 
			
		||||
                add(labelServerIP)
 | 
			
		||||
                add(tfServerIP)
 | 
			
		||||
                add(btnConnect)
 | 
			
		||||
 | 
			
		||||
                btnConnect.apply { action { svc.btnConnectAction(tfServerIP.text)} }
 | 
			
		||||
                tfServerIP.setOnKeyPressed {
 | 
			
		||||
                    if (it.code == KeyCode.ENTER){
 | 
			
		||||
                        svc.btnConnectAction(tfServerIP.text)
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,27 @@ import tornadofx.Controller
 | 
			
		||||
 | 
			
		||||
class StartupViewController : Controller() {
 | 
			
		||||
 | 
			
		||||
    fun btnConnectAction(txt:String){
 | 
			
		||||
        println("Connect BTN: $txt")
 | 
			
		||||
        //TODO check IP4
 | 
			
		||||
 | 
			
		||||
        spinnterStart()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun spinnterStart(){
 | 
			
		||||
        val startupView = find(StartupView::class)
 | 
			
		||||
        startupView.spinnerStatus.isVisible = true
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    fun spinnerStop(){
 | 
			
		||||
        val startupView = find(StartupView::class)
 | 
			
		||||
        startupView.spinnerStatus.isVisible = false
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fun labelStatusSetText (txt:String){
 | 
			
		||||
        val startupView = find(StartupView::class)
 | 
			
		||||
        startupView.labelStatus.text =  txt
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user