mirror of
https://github.com/corda/corda.git
synced 2025-04-07 11:27:01 +00:00
DemoBench: upgrade to latest TornadoFX to get combobox width fix, and launch web browser once web server has started.
This commit is contained in:
parent
691b622cf0
commit
d3ed178e82
@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.tornadofx_version = '1.7.1'
|
||||
ext.tornadofx_version = '1.7.3'
|
||||
ext.jna_version = '4.1.0'
|
||||
ext.purejavacomm_version = '0.0.17'
|
||||
ext.controlsfx_version = '8.40.12'
|
||||
|
@ -194,7 +194,6 @@ class NodeTabView : Fragment() {
|
||||
|
||||
value = CityDatabase["London"]
|
||||
|
||||
// TODO: Upgrade to TornadoFX 1.7.3 to fix an issue where the combobox dropdown isn't wide enough.
|
||||
isEditable = true
|
||||
makeAutocompletable()
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.corda.demobench.views
|
||||
|
||||
import com.google.common.util.concurrent.RateLimiter
|
||||
import com.jediterm.terminal.TerminalColor
|
||||
import com.jediterm.terminal.TextStyle
|
||||
import com.jediterm.terminal.ui.settings.DefaultSettingsProvider
|
||||
@ -23,8 +24,12 @@ import net.corda.demobench.web.DBViewer
|
||||
import net.corda.demobench.web.WebServerController
|
||||
import tornadofx.*
|
||||
import java.awt.Dimension
|
||||
import java.io.IOException
|
||||
import java.net.SocketException
|
||||
import java.net.URL
|
||||
import java.util.logging.Level
|
||||
import javax.swing.SwingUtilities
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class NodeTerminalView : Fragment() {
|
||||
override val root by fxml<VBox>()
|
||||
@ -138,8 +143,30 @@ class NodeTerminalView : Fragment() {
|
||||
|
||||
webServer.open(config, onExit = {
|
||||
launchWebButton.isDisable = false
|
||||
app.hostServices.showDocument("http://localhost:${config.webPort}/")
|
||||
})
|
||||
|
||||
openBrowserWhenWebServerHasStarted(config)
|
||||
}
|
||||
}
|
||||
|
||||
private fun openBrowserWhenWebServerHasStarted(config: NodeConfig) {
|
||||
thread {
|
||||
log.info("Waiting for web server to start ...")
|
||||
val url = URL("http://localhost:${config.webPort}/")
|
||||
val rateLimiter = RateLimiter.create(1.0)
|
||||
while (true) {
|
||||
try {
|
||||
rateLimiter.acquire()
|
||||
val conn = url.openConnection()
|
||||
conn.connectTimeout = 1000 // msec
|
||||
conn.connect()
|
||||
log.info("Web server started")
|
||||
app.hostServices.showDocument(url.toString())
|
||||
break
|
||||
} catch(e: SocketException) {
|
||||
} catch(e: IOException) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user