corefx - small tweaks to node/link details page
This commit is contained in:
parent
9b485c8209
commit
5b671ccb00
4 changed files with 35 additions and 51 deletions
|
@ -44,10 +44,9 @@ public class LinkDetails extends ScrollPane {
|
||||||
public void setLink(CoreLink link) {
|
public void setLink(CoreLink link) {
|
||||||
NetworkGraph graph = controller.getNetworkGraph();
|
NetworkGraph graph = controller.getNetworkGraph();
|
||||||
ICoreClient coreClient = controller.getCoreClient();
|
ICoreClient coreClient = controller.getCoreClient();
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
|
|
||||||
addSeparator();
|
addSeparator();
|
||||||
|
|
||||||
CoreNode nodeOne = graph.getVertex(link.getNodeOne());
|
CoreNode nodeOne = graph.getVertex(link.getNodeOne());
|
||||||
CoreInterface interfaceOne = link.getInterfaceOne();
|
CoreInterface interfaceOne = link.getInterfaceOne();
|
||||||
addLabel(nodeOne.getName());
|
addLabel(nodeOne.getName());
|
||||||
|
@ -55,7 +54,6 @@ public class LinkDetails extends ScrollPane {
|
||||||
addInterface(interfaceOne);
|
addInterface(interfaceOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
CoreNode nodeTwo = graph.getVertex(link.getNodeTwo());
|
CoreNode nodeTwo = graph.getVertex(link.getNodeTwo());
|
||||||
CoreInterface interfaceTwo = link.getInterfaceTwo();
|
CoreInterface interfaceTwo = link.getInterfaceTwo();
|
||||||
addLabel(nodeTwo.getName());
|
addLabel(nodeTwo.getName());
|
||||||
|
@ -63,7 +61,6 @@ public class LinkDetails extends ScrollPane {
|
||||||
addInterface(interfaceTwo);
|
addInterface(interfaceTwo);
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
addLabel("Properties");
|
addLabel("Properties");
|
||||||
JFXTextField bandwidthField = addRow("Bandwidth (bps)", link.getOptions().getBandwidth());
|
JFXTextField bandwidthField = addRow("Bandwidth (bps)", link.getOptions().getBandwidth());
|
||||||
JFXTextField delayField = addRow("Delay (us)", link.getOptions().getDelay());
|
JFXTextField delayField = addRow("Delay (us)", link.getOptions().getDelay());
|
||||||
|
@ -127,14 +124,15 @@ public class LinkDetails extends ScrollPane {
|
||||||
|
|
||||||
private void addInterface(CoreInterface coreInterface) {
|
private void addInterface(CoreInterface coreInterface) {
|
||||||
addRow("Interface", coreInterface.getName(), true);
|
addRow("Interface", coreInterface.getName(), true);
|
||||||
if (coreInterface.getMac() != null) {
|
|
||||||
addRow("MAC", coreInterface.getMac(), true);
|
addRow("MAC", coreInterface.getMac(), true);
|
||||||
}
|
addAddress("IP4", coreInterface.getIp4());
|
||||||
addIp4Address(coreInterface.getIp4());
|
addAddress("IP6", coreInterface.getIp6());
|
||||||
addIp6Address(coreInterface.getIp6());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRow(String labelText, String value, boolean disabled) {
|
private void addRow(String labelText, String value, boolean disabled) {
|
||||||
|
if (value == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Label label = new Label(labelText);
|
Label label = new Label(labelText);
|
||||||
JFXTextField textField = new JFXTextField(value);
|
JFXTextField textField = new JFXTextField(value);
|
||||||
textField.setDisable(disabled);
|
textField.setDisable(disabled);
|
||||||
|
@ -156,18 +154,11 @@ public class LinkDetails extends ScrollPane {
|
||||||
return textField;
|
return textField;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addIp4Address(IPAddress ip) {
|
private void addAddress(String label, IPAddress ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addRow("IP4", ip.toString(), true);
|
addRow(label, ip.toString(), true);
|
||||||
}
|
|
||||||
|
|
||||||
private void addIp6Address(IPAddress ip) {
|
|
||||||
if (ip == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
addRow("IP6", ip.toString(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear() {
|
private void clear() {
|
||||||
|
|
|
@ -44,31 +44,28 @@ public class NodeDetails extends ScrollPane {
|
||||||
public void setNode(CoreNode node) {
|
public void setNode(CoreNode node) {
|
||||||
clear();
|
clear();
|
||||||
title.setText(node.getName());
|
title.setText(node.getName());
|
||||||
|
|
||||||
addSeparator();
|
addSeparator();
|
||||||
|
|
||||||
addLabel("Properties");
|
addLabel("Properties");
|
||||||
|
addRow("ID", node.getId().toString(), true);
|
||||||
if (node.getType() == NodeType.DEFAULT) {
|
if (node.getType() == NodeType.DEFAULT) {
|
||||||
addRow("Model", node.getModel(), true);
|
addRow("Model", node.getModel(), true);
|
||||||
} else {
|
} else {
|
||||||
addRow("Type", node.getNodeType().getDisplay(), true);
|
addRow("Type", node.getNodeType().getDisplay(), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.getEmane() != null) {
|
|
||||||
addRow("EMANE", node.getEmane(), true);
|
addRow("EMANE", node.getEmane(), true);
|
||||||
}
|
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
addLabel("Position");
|
|
||||||
if (node.getPosition().getX() != null) {
|
|
||||||
addRow("X", node.getPosition().getX().toString(), true);
|
addRow("X", node.getPosition().getX().toString(), true);
|
||||||
}
|
|
||||||
if (node.getPosition().getY() != null) {
|
|
||||||
addRow("Y", node.getPosition().getY().toString(), true);
|
addRow("Y", node.getPosition().getY().toString(), true);
|
||||||
|
|
||||||
|
addLabel("Interfaces");
|
||||||
|
boolean firstInterface = true;
|
||||||
|
for (CoreLink link : controller.getNetworkGraph().getGraph().getIncidentEdges(node)) {
|
||||||
|
if (firstInterface) {
|
||||||
|
firstInterface = false;
|
||||||
|
} else {
|
||||||
|
addSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
addLabel("Interfaces");
|
|
||||||
for (CoreLink link : controller.getNetworkGraph().getGraph().getIncidentEdges(node)) {
|
|
||||||
CoreNode linkedNode;
|
CoreNode linkedNode;
|
||||||
CoreInterface coreInterface;
|
CoreInterface coreInterface;
|
||||||
if (node.getId().equals(link.getNodeOne())) {
|
if (node.getId().equals(link.getNodeOne())) {
|
||||||
|
@ -83,7 +80,6 @@ public class NodeDetails extends ScrollPane {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
addSeparator();
|
|
||||||
if (linkedNode.getType() == NodeType.EMANE) {
|
if (linkedNode.getType() == NodeType.EMANE) {
|
||||||
String emaneModel = linkedNode.getEmane();
|
String emaneModel = linkedNode.getEmane();
|
||||||
String linkedLabel = String.format("%s - %s", linkedNode.getName(), emaneModel);
|
String linkedLabel = String.format("%s - %s", linkedNode.getName(), emaneModel);
|
||||||
|
@ -109,8 +105,8 @@ public class NodeDetails extends ScrollPane {
|
||||||
if (services.isEmpty()) {
|
if (services.isEmpty()) {
|
||||||
services = controller.getDefaultServices().getOrDefault(node.getModel(), Collections.emptySet());
|
services = controller.getDefaultServices().getOrDefault(node.getModel(), Collections.emptySet());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!services.isEmpty()) {
|
if (!services.isEmpty()) {
|
||||||
addSeparator();
|
|
||||||
addLabel("Services");
|
addLabel("Services");
|
||||||
JFXListView<String> listView = new JFXListView<>();
|
JFXListView<String> listView = new JFXListView<>();
|
||||||
listView.setMouseTransparent(true);
|
listView.setMouseTransparent(true);
|
||||||
|
@ -145,32 +141,26 @@ public class NodeDetails extends ScrollPane {
|
||||||
private void addInterface(CoreInterface coreInterface, CoreNode linkedNode) {
|
private void addInterface(CoreInterface coreInterface, CoreNode linkedNode) {
|
||||||
addRow("Linked To", linkedNode.getName(), true);
|
addRow("Linked To", linkedNode.getName(), true);
|
||||||
addRow("Interface", coreInterface.getName(), true);
|
addRow("Interface", coreInterface.getName(), true);
|
||||||
if (coreInterface.getMac() != null) {
|
|
||||||
addRow("MAC", coreInterface.getMac(), true);
|
addRow("MAC", coreInterface.getMac(), true);
|
||||||
}
|
addAddress("IP4", coreInterface.getIp4());
|
||||||
addIp4Address(coreInterface.getIp4());
|
addAddress("IP6", coreInterface.getIp6());
|
||||||
addIp6Address(coreInterface.getIp6());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRow(String labelText, String value, boolean disabled) {
|
private void addRow(String labelText, String value, boolean disabled) {
|
||||||
|
if (value == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Label label = new Label(labelText);
|
Label label = new Label(labelText);
|
||||||
JFXTextField textField = new JFXTextField(value);
|
JFXTextField textField = new JFXTextField(value);
|
||||||
textField.setDisable(disabled);
|
textField.setDisable(disabled);
|
||||||
gridPane.addRow(index++, label, textField);
|
gridPane.addRow(index++, label, textField);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addIp4Address(IPAddress ip) {
|
private void addAddress(String label, IPAddress ip) {
|
||||||
if (ip == null) {
|
if (ip == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addRow("IP4", ip.toString(), true);
|
addRow(label, ip.toString(), true);
|
||||||
}
|
|
||||||
|
|
||||||
private void addIp6Address(IPAddress ip) {
|
|
||||||
if (ip == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
addRow("IP6", ip.toString(), true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clear() {
|
private void clear() {
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<children>
|
<children>
|
||||||
<Label styleClass="details-title" text="Link Details" GridPane.columnSpan="2147483647">
|
<Label styleClass="details-title" text="Link Details" GridPane.columnSpan="2147483647">
|
||||||
|
|
|
@ -19,13 +19,16 @@
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
|
||||||
</rowConstraints>
|
</rowConstraints>
|
||||||
<padding>
|
<padding>
|
||||||
<Insets bottom="10.0" left="10.0" right="10.0" top="10.0" />
|
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0" />
|
||||||
</padding>
|
</padding>
|
||||||
<children>
|
<children>
|
||||||
<Label fx:id="title" styleClass="details-title" text="Node Details" GridPane.columnSpan="2147483647">
|
<Label fx:id="title" styleClass="details-title" text="Node Details" GridPane.columnSpan="2147483647">
|
||||||
<font>
|
<font>
|
||||||
<Font name="System Bold" size="17.0" />
|
<Font name="System Bold" size="17.0" />
|
||||||
</font>
|
</font>
|
||||||
|
<GridPane.margin>
|
||||||
|
<Insets />
|
||||||
|
</GridPane.margin>
|
||||||
</Label>
|
</Label>
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
|
|
Loading…
Add table
Reference in a new issue