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