Search in sources :

Example 51 with Node

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();
}
Also used : Node(javafx.scene.Node) Stage(javafx.stage.Stage) FXML(javafx.fxml.FXML)

Example 52 with Node

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();
    }
}
Also used : Node(javafx.scene.Node) Stage(javafx.stage.Stage) FXML(javafx.fxml.FXML)

Example 53 with Node

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");
}
Also used : Button(javafx.scene.control.Button) MouseButton(javafx.scene.input.MouseButton) Node(javafx.scene.Node) Label(javafx.scene.control.Label) Test(org.junit.Test)

Example 54 with Node

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);
}
Also used : Node(javafx.scene.Node) Stage(javafx.stage.Stage) FXML(javafx.fxml.FXML)

Example 55 with Node

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;
}
Also used : GridPane(javafx.scene.layout.GridPane) Node(javafx.scene.Node) Tooltip(javafx.scene.control.Tooltip) Label(javafx.scene.control.Label)

Aggregations

Node (javafx.scene.Node)118 Label (javafx.scene.control.Label)18 Stage (javafx.stage.Stage)17 Parent (javafx.scene.Parent)16 Button (javafx.scene.control.Button)16 ArrayList (java.util.ArrayList)15 ObservableList (javafx.collections.ObservableList)14 FXML (javafx.fxml.FXML)14 List (java.util.List)12 BorderPane (javafx.scene.layout.BorderPane)12 HBox (javafx.scene.layout.HBox)11 IOException (java.io.IOException)10 Platform (javafx.application.Platform)10 Insets (javafx.geometry.Insets)10 Color (javafx.scene.paint.Color)10 FXCollections (javafx.collections.FXCollections)9 MouseEvent (javafx.scene.input.MouseEvent)9 VBox (javafx.scene.layout.VBox)9 FadeTransition (javafx.animation.FadeTransition)8 MenuItem (javafx.scene.control.MenuItem)8