Search in sources :

Example 1 with PacketBuilderHomeController

use of com.exalttech.trex.ui.controllers.PacketBuilderHomeController in project trex-stateless-gui by cisco-system-traffic-generator.

the class PacketTableView method openStreamDialog.

/**
     * open stream properties
     */
private void openStreamDialog(StreamBuilderType type) {
    try {
        TableProfileStream data = streamPacketTableView.getSelectionModel().getSelectedItem();
        if ("0".equals(data.getLength()) && !Util.isConfirmed("Problem reading file, Do you want to continue anyway ?")) {
            return;
        }
        setStreamEditingWindowOpen(true);
        Stage currentStage = (Stage) streamPacketTableView.getScene().getWindow();
        String windowTitle = "Edit Stream (" + data.getName() + ")";
        DialogWindow srteamWindow = new DialogWindow("PacketBuilderHome.fxml", windowTitle, 40, 30, false, currentStage);
        PacketBuilderHomeController controller = (PacketBuilderHomeController) srteamWindow.getController();
        boolean streaminited = false;
        switch(type) {
            case EDIT_STREAM:
                streaminited = controller.initStreamBuilder(data.getPcapBinary(), tabledata.getProfiles(), streamPacketTableView.getSelectionModel().getSelectedIndex(), tabledata.getYamlFileName(), StreamBuilderType.EDIT_STREAM);
                break;
            case ADD_STREAM:
                streaminited = controller.initStreamBuilder(null, tabledata.getProfiles(), streamPacketTableView.getSelectionModel().getSelectedIndex(), tabledata.getYamlFileName(), StreamBuilderType.ADD_STREAM);
                break;
            case BUILD_STREAM:
                streaminited = controller.initStreamBuilder(null, tabledata.getProfiles(), streamPacketTableView.getSelectionModel().getSelectedIndex(), tabledata.getYamlFileName(), StreamBuilderType.BUILD_STREAM);
                break;
            default:
                break;
        }
        if (streaminited) {
            srteamWindow.show(true);
        } else {
            LOG.error("Error while initing editor dialog");
        }
    } catch (IOException ex) {
        LOG.error("Error opening file", ex);
    }
}
Also used : PacketBuilderHomeController(com.exalttech.trex.ui.controllers.PacketBuilderHomeController) TableProfileStream(com.exalttech.trex.ui.views.models.TableProfileStream) Stage(javafx.stage.Stage) IOException(java.io.IOException) DialogWindow(com.exalttech.trex.ui.dialog.DialogWindow)

Aggregations

PacketBuilderHomeController (com.exalttech.trex.ui.controllers.PacketBuilderHomeController)1 DialogWindow (com.exalttech.trex.ui.dialog.DialogWindow)1 TableProfileStream (com.exalttech.trex.ui.views.models.TableProfileStream)1 IOException (java.io.IOException)1 Stage (javafx.stage.Stage)1