Skip to content

Instantly share code, notes, and snippets.

@bjonnh

bjonnh/MyApp.kt Secret

Last active January 28, 2019 22:01
Show Gist options
  • Select an option

  • Save bjonnh/57374b79203f14ae88b0e3451512118c to your computer and use it in GitHub Desktop.

Select an option

Save bjonnh/57374b79203f14ae88b0e3451512118c to your computer and use it in GitHub Desktop.
class MyApp : App(MainView::class) {
override fun start(stage: Stage) {
super.start(stage)
//stage.minWidth = 800.0
//stage.minHeight = 600.0
val splash = find<SplashScreen>()
splash.openModal(stageStyle = StageStyle.UTILITY, modality = Modality.APPLICATION_MODAL)
splash.setWindowMinSize(300.0, 100.0)
// When selecting a citation, we gather and display its content
runAsync {
exceptionController = ExceptionController()
splash.updateStatus("Setting up the exception controller")
splash.updateStatus("Loading configuration")
configurationController = ConfigurationManager()
configurationController.addStatementsFromFile("config/main.ttl")
// Local config is optional and just used to not leak info in git
try {
configurationController.addStatementsFromFile("config/local.ttl")
} catch (e: FileNotFoundException) {
}
configurationController.getDBConfigurations().map {
splash.updateStatus("Setting up the LegacyDB connector for ${it.subject}")
legacyDBConnector = LegacyDBConnector(it.connection)
splash.updateStatus("Setting up the LegacyDB controller")
legacyDBController =
LegacyDBController(
legacyDBConnector
)
fire(LegacyDBReady(it.label ?: "Unnamed DB", legacyDBController))
}
configurationController.getSparqlConfigurations().map {
splash.updateStatus("Setting up the SPARQL connector for ${it.subject}")
val sparqlConnector = SparqlConnector(it.connection)
splash.updateStatus("Setting up the SPARQL controller")
val sparqlController =
SparqlController(
sparqlConnector
)
fire(SparqlReady(it.label ?: "Unnamed SPARQL", sparqlController))
}
splash.updateStatus("Setting up the CrossRef Client")
crossRefConnector = CrossRefConnector(OfficialCrossRef())
fire(CrossRefReady())
splash.updateStatus("Starting the GUI")
splash.done.set(true)
stage.minWidth = 800.0
stage.minHeight = 600.0
}
}
override fun shouldShowPrimaryStage() = false
}
fun main(args: Array<String>) {
launch<MyApp>(args)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment