mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -04:00
progress dialog: forbid closing if can not cancel
This commit is contained in:
parent
0c616ebc8c
commit
ff6afd3863
@ -20,6 +20,7 @@ import de.bixilon.minosoft.protocol.network.connection.play.PlayConnection
|
||||
import de.bixilon.minosoft.protocol.network.connection.play.PlayConnectionStates
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import de.bixilon.minosoft.util.delegate.JavaFXDelegate.observeFX
|
||||
import javafx.event.EventHandler
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.control.Button
|
||||
import javafx.scene.control.ProgressBar
|
||||
@ -41,6 +42,9 @@ class ConnectingDialog(
|
||||
override fun init() {
|
||||
headerFX.text = HEADER
|
||||
cancelButtonFX.isDisable = true
|
||||
stage.onCloseRequest = EventHandler {
|
||||
it.consume()
|
||||
}
|
||||
connection::state.observeFX(this) { update(it) }
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import de.bixilon.minosoft.gui.eros.controller.DialogController
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.text
|
||||
import de.bixilon.minosoft.util.KUtil.toResourceLocation
|
||||
import javafx.event.EventHandler
|
||||
import javafx.fxml.FXML
|
||||
import javafx.scene.control.Button
|
||||
import javafx.scene.control.ProgressBar
|
||||
@ -52,6 +53,12 @@ open class ProgressDialog(
|
||||
override fun init() {
|
||||
headerFX.text = header
|
||||
cancelButtonFX.isDisable = onCancel == null
|
||||
|
||||
if (onCancel == null) {
|
||||
stage.onCloseRequest = EventHandler {
|
||||
it.consume()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun update() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user