mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
CORDA-2556: Refactor World City database into a library module. (#4718)
* Refactor World City database into a library module. * Migrate CityDatabaseTest into worldmap module.
This commit is contained in:
parent
6cdd9f96b8
commit
7866dde91b
@ -45,6 +45,7 @@ include 'tools:shell'
|
|||||||
include 'tools:shell-cli'
|
include 'tools:shell-cli'
|
||||||
include 'tools:network-bootstrapper'
|
include 'tools:network-bootstrapper'
|
||||||
include 'tools:cliutils'
|
include 'tools:cliutils'
|
||||||
|
include 'tools:worldmap'
|
||||||
include 'example-code'
|
include 'example-code'
|
||||||
project(':example-code').projectDir = file("$settingsDir/docs/source/example-code")
|
project(':example-code').projectDir = file("$settingsDir/docs/source/example-code")
|
||||||
include 'samples:attachment-demo:contracts'
|
include 'samples:attachment-demo:contracts'
|
||||||
|
@ -43,10 +43,10 @@ configurations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(':tools:explorer')
|
|
||||||
compile project(':client:rpc')
|
compile project(':client:rpc')
|
||||||
compile project(':finance:contracts')
|
compile project(':finance:contracts')
|
||||||
compile project(':finance:workflows')
|
compile project(':finance:workflows')
|
||||||
|
compile project(':tools:worldmap')
|
||||||
|
|
||||||
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.
|
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.
|
||||||
compile "no.tornado:tornadofx:$tornadofx_version"
|
compile "no.tornado:tornadofx:$tornadofx_version"
|
||||||
|
@ -5,12 +5,12 @@ import javafx.beans.property.SimpleListProperty
|
|||||||
import javafx.beans.property.SimpleObjectProperty
|
import javafx.beans.property.SimpleObjectProperty
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
import javafx.collections.FXCollections.observableArrayList
|
import javafx.collections.FXCollections.observableArrayList
|
||||||
import net.corda.explorer.CityDatabase
|
import net.corda.worldmap.CityDatabase
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
object SuggestedDetails {
|
object SuggestedDetails {
|
||||||
val banks = listOf(
|
private val banks = listOf(
|
||||||
// Mike: Rome? Why Rome?
|
// Mike: Rome? Why Rome?
|
||||||
// Roger: Notaries public (also called "notaries", "notarial officers", or "public notaries") hold an office
|
// Roger: Notaries public (also called "notaries", "notarial officers", or "public notaries") hold an office
|
||||||
// which can trace its origins back to the ancient Roman Republic, when they were called scribae ("scribes"),
|
// which can trace its origins back to the ancient Roman Republic, when they were called scribae ("scribes"),
|
||||||
|
@ -18,12 +18,12 @@ import javafx.util.StringConverter
|
|||||||
import net.corda.core.internal.*
|
import net.corda.core.internal.*
|
||||||
import net.corda.demobench.model.*
|
import net.corda.demobench.model.*
|
||||||
import net.corda.demobench.ui.CloseableTab
|
import net.corda.demobench.ui.CloseableTab
|
||||||
import net.corda.explorer.CityDatabase
|
|
||||||
import net.corda.explorer.WorldMapLocation
|
|
||||||
import net.corda.finance.CHF
|
import net.corda.finance.CHF
|
||||||
import net.corda.finance.EUR
|
import net.corda.finance.EUR
|
||||||
import net.corda.finance.GBP
|
import net.corda.finance.GBP
|
||||||
import net.corda.finance.USD
|
import net.corda.finance.USD
|
||||||
|
import net.corda.worldmap.CityDatabase
|
||||||
|
import net.corda.worldmap.WorldMapLocation
|
||||||
import org.controlsfx.control.CheckListView
|
import org.controlsfx.control.CheckListView
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
@ -138,7 +138,7 @@ class NodeTabView : Fragment() {
|
|||||||
} else {
|
} else {
|
||||||
val notaryTypes = listOf(NotaryService(true), NotaryService(false))
|
val notaryTypes = listOf(NotaryService(true), NotaryService(false))
|
||||||
val notaryTypeToggleGroup = togglegroup()
|
val notaryTypeToggleGroup = togglegroup()
|
||||||
notaryTypeToggleGroup.selectedValueProperty<NotaryService>().addListener { observValue, oldValue, newValue ->
|
notaryTypeToggleGroup.selectedValueProperty<NotaryService>().addListener { _, oldValue, newValue ->
|
||||||
oldValue?.let {
|
oldValue?.let {
|
||||||
model.item.extraServices.removeAll(it)
|
model.item.extraServices.removeAll(it)
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ dependencies {
|
|||||||
compile project(':node-driver')
|
compile project(':node-driver')
|
||||||
compile project(':finance:contracts')
|
compile project(':finance:contracts')
|
||||||
compile project(':finance:workflows')
|
compile project(':finance:workflows')
|
||||||
|
compile project(':tools:worldmap')
|
||||||
|
|
||||||
// Capsule is a library for building independently executable fat JARs.
|
// Capsule is a library for building independently executable fat JARs.
|
||||||
// We only need this dependency to compile our Caplet against.
|
// We only need this dependency to compile our Caplet against.
|
||||||
|
@ -33,11 +33,11 @@ import net.corda.core.identity.Party
|
|||||||
import net.corda.core.node.NodeInfo
|
import net.corda.core.node.NodeInfo
|
||||||
import net.corda.core.transactions.WireTransaction
|
import net.corda.core.transactions.WireTransaction
|
||||||
import net.corda.core.utilities.toBase58String
|
import net.corda.core.utilities.toBase58String
|
||||||
import net.corda.explorer.CityDatabase
|
|
||||||
import net.corda.explorer.ScreenCoordinate
|
|
||||||
import net.corda.explorer.WorldMapLocation
|
|
||||||
import net.corda.explorer.formatters.PartyNameFormatter
|
import net.corda.explorer.formatters.PartyNameFormatter
|
||||||
import net.corda.explorer.model.CordaView
|
import net.corda.explorer.model.CordaView
|
||||||
|
import net.corda.worldmap.CityDatabase
|
||||||
|
import net.corda.worldmap.ScreenCoordinate
|
||||||
|
import net.corda.worldmap.WorldMapLocation
|
||||||
import tornadofx.*
|
import tornadofx.*
|
||||||
|
|
||||||
class Network : CordaView() {
|
class Network : CordaView() {
|
||||||
|
8
tools/worldmap/build.gradle
Normal file
8
tools/worldmap/build.gradle
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation project(':core')
|
||||||
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
|
||||||
|
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||||
|
testImplementation "junit:junit:$junit_version"
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package net.corda.explorer
|
package net.corda.worldmap
|
||||||
|
|
||||||
import net.corda.core.serialization.CordaSerializable
|
import net.corda.core.serialization.CordaSerializable
|
||||||
import java.util.*
|
import java.util.*
|
||||||
@ -51,7 +51,7 @@ data class WorldMapLocation(val coordinate: WorldCoordinate, val description: St
|
|||||||
* A simple lookup table of city names to their coordinates. Lookups are case insensitive.
|
* A simple lookup table of city names to their coordinates. Lookups are case insensitive.
|
||||||
*/
|
*/
|
||||||
object CityDatabase {
|
object CityDatabase {
|
||||||
private val matcher = Regex("^([a-zA-Z- ]*) \\((..)\\)$")
|
private val matcher = Regex("^([a-zA-Z- ]*) \\((..)\\)\$")
|
||||||
private val caseInsensitiveLookups = HashMap<String, WorldMapLocation>()
|
private val caseInsensitiveLookups = HashMap<String, WorldMapLocation>()
|
||||||
val cityMap = HashMap<String, WorldMapLocation>()
|
val cityMap = HashMap<String, WorldMapLocation>()
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package net.corda.explorer
|
package net.corda.worldmap
|
||||||
|
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Test
|
import org.junit.Test
|
Loading…
Reference in New Issue
Block a user