use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketBuilderHomeController method handleCloseDialog.
@FXML
public void handleCloseDialog(final MouseEvent event) {
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
stage.hide();
}
use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketBuilderHomeController method saveProfileBtnClicked.
@FXML
public void saveProfileBtnClicked(ActionEvent event) {
if (saveStream()) {
// close the dialog
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
stage.hide();
}
}
use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.
the class TestPortConfiguration method checkPortConfiguration.
@Test
public void checkPortConfiguration() {
acquirePortViaToolbar("Port 0");
clickOn("Configuration");
Node tabContent = lookup("#layerConfig").query();
Button applyBtn = lookup("#applyBtn").query();
Assert.assertFalse(tabContent.isDisabled());
tryCall(() -> {
clearLogs();
setText("#l2Destination", "de:ad:be:ef:de:ad");
clickOn("Apply");
}, () -> applyBtn.getText().equalsIgnoreCase("Apply"));
Assert.assertTrue(checkResultInLogs("L2 mode configured"));
tryCall(() -> {
acquirePortViaToolbar("Port 1");
clickOn("Configuration");
clickOn("#l3Mode");
setText("#l3Source", "192.168.50.156");
setText("#l3Destination", "192.168.50.155");
clickOn("Apply");
}, () -> applyBtn.getText().equalsIgnoreCase("Apply"));
tryCall(() -> {
clearLogs();
clickOn("Port 0");
clickOn("Configuration");
clickOn("#l3Mode");
setText("#l3Source", "192.168.50.155");
setText("#l3Destination", "192.168.50.156");
clickOn("Apply");
}, () -> applyBtn.getText().equalsIgnoreCase("Apply"));
Label arpStatus = lookup("#arpStatus").query();
Assert.assertTrue(arpStatus.getText().equalsIgnoreCase("resolved"));
resetPort("Port 0");
}
use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.
the class ConnectDialogController method handleConnectButton.
/**
* Handle connect button clicking
*
* @param event
*/
@FXML
public void handleConnectButton(ActionEvent event) {
Node node = (Node) event.getSource();
Stage stage = (Stage) node.getScene().getWindow();
doConnect(stage);
}
use of javafx.scene.Node in project trex-stateless-gui by cisco-system-traffic-generator.
the class StatsTableGenerator method generateXStatPane.
public GridPane generateXStatPane(boolean full, Port port, boolean notempty, String filter, boolean resetCounters) {
if (full) {
statXTable.getChildren().clear();
Util.optimizeMemory();
}
Map<String, Long> xstatsList = port.getXstats();
Map<String, Long> xstatsListPinned = port.getXstatsPinned();
String pinnedChar = "✖";
String notPinnedChar = "✚";
/*String pinnedChar = "☑";
String notPinnedChar = "☐";*/
rowIndex = 0;
addHeaderCell(statXTable, "xstats-header0", "Counter", 0, WIDTH_COL_0 * 1.5);
addHeaderCell(statXTable, "xstats-header1", "Value", 1, WIDTH_COL_1);
addHeaderCell(statXTable, "xstats-header2", "Pin", 2, WIDTH_COL_PIN);
rowIndex = 1;
odd = true;
xstatsListPinned.forEach((k, v) -> {
if (v != null) {
if (resetCounters) {
fixCounter(port.getIndex(), k, v);
}
Node check = new Label(pinnedChar);
GridPane.setHalignment(check, HPos.CENTER);
addXstatRow(statXTable, (event) -> xstatsListPinned.remove(k, v), "xstat-red", "xstat-green", new Tooltip("Click '" + pinnedChar + "' to un-pin the counter."), "xstats-val-0-" + rowIndex, k, WIDTH_COL_0 * 1.5, 0, "xstats-val-1-" + rowIndex, String.valueOf(v - getShadowCounter(port.getIndex(), k)), WIDTH_COL_1, 1, "xstats-val-2-" + rowIndex, pinnedChar, WIDTH_COL_PIN, 2);
}
});
xstatsList.forEach((k, v) -> {
if (v != null && (!notempty || (notempty && (v - getShadowCounter(port.getIndex(), k) != 0))) && xstatsListPinned.get(k) == null) {
if ((filter == null || filter.trim().length() == 0) || k.contains(filter)) {
if (resetCounters) {
fixCounter(port.getIndex(), k, v);
}
Node check = new Label(notPinnedChar);
GridPane.setHalignment(check, HPos.CENTER);
addXstatRow(statXTable, (event) -> xstatsListPinned.put(k, v), "xstat-green", "xstat-red", new Tooltip("Click '" + notPinnedChar + "' to pin the counter.\nPinned counter is always visible."), "xstats-val-0-" + rowIndex, k, WIDTH_COL_0 * 1.5, 0, "xstats-val-1-" + rowIndex, String.valueOf(v - getShadowCounter(port.getIndex(), k)), WIDTH_COL_1, 1, "xstats-val-2-" + rowIndex, notPinnedChar, WIDTH_COL_PIN, 2);
}
}
});
GridPane gp = new GridPane();
gp.setGridLinesVisible(false);
gp.add(statXTable, 1, 1, 1, 2);
return gp;
}
Aggregations