Force all chosen port numbers to be different.

This commit is contained in:
Chris Rankin 2017-02-08 14:24:13 +00:00
parent f95b743426
commit d3cdb2af67

View File

@ -73,14 +73,21 @@ class NodeTabView : Fragment() {
error("Port number required")
} else if (it.contains(NOT_NUMBER)) {
error("Invalid port number")
} else if (!nodeController.isPortAvailable(it.toInt())) {
} else {
val port = it.toInt()
if (!nodeController.isPortAvailable(port)) {
error("Port $it is unavailable")
} else if (port == model.webPort.value) {
error("Clashes with web port")
} else if (port == model.h2Port.value) {
error("Clashes with database port")
} else {
null
}
}
}
}
}
field("Web Port") {
textfield(model.webPort, NumberStringConverter(INTEGER_FORMAT)) {
minWidth = 100.0
@ -90,14 +97,21 @@ class NodeTabView : Fragment() {
error("Port number required")
} else if (it.contains(NOT_NUMBER)) {
error("Invalid port number")
} else if (!nodeController.isPortAvailable(it.toInt())) {
} else {
val port = it.toInt()
if (!nodeController.isPortAvailable(port)) {
error("Port $it is unavailable")
} else if (port == model.artemisPort.value) {
error("Clashes with P2P port")
} else if (port == model.h2Port.value) {
error("Clashes with database port")
} else {
null
}
}
}
}
}
field("Database Port") {
textfield(model.h2Port, NumberStringConverter(INTEGER_FORMAT)) {
minWidth = 100.0
@ -107,8 +121,14 @@ class NodeTabView : Fragment() {
error("Port number required")
} else if (it.contains(NOT_NUMBER)) {
error("Invalid port number")
} else if (!nodeController.isPortAvailable(it.toInt())) {
} else {
val port = it.toInt()
if (!nodeController.isPortAvailable(port)) {
error("Port $it is unavailable")
} else if (port == model.artemisPort.value) {
error("Clashes with P2P port")
} else if (port == model.webPort.value) {
error("Clashes with web port")
} else {
null
}
@ -116,6 +136,7 @@ class NodeTabView : Fragment() {
}
}
}
}
fieldset("Services") {
listview(availableServices.observable()) {