Search in sources :

Example 1 with PacketTableView

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

the class MainViewController method initializeInlineComponent.

/**
 * Initialize in-line built component
 */
private void initializeInlineComponent() {
    updateBtn.setGraphic(new ImageView(new Image("/icons/apply.png")));
    newProfileBtn.setGraphic(new ImageView(new Image("/icons/add_profile.png")));
    duplicateProfileBtn.setGraphic(new ImageView(new Image("/icons/clone_profile.png")));
    stopUpdateBtn.setGraphic(new ImageView(new Image("/icons/stop_update.png")));
    devicesTreeArrowContainer.setImage(leftArrow);
    // mapped profiles enabling with property
    profileListBox.disableProperty().bind(disableProfileProperty);
    newProfileBtn.disableProperty().bind(disableProfileProperty);
    duplicateProfileBtn.disableProperty().bind(disableProfileProperty);
    profileDetailLabel.disableProperty().bind(disableProfileProperty);
    profileListBox.getItems().clear();
    profileListBox.setItems(FXCollections.observableArrayList(getProfilesNameList()));
    profileListBox.valueProperty().addListener(new UpdateProfileListener<>(profileListBox.getSelectionModel()));
    updateProfileListProperty.bind(ProfileManager.getInstance().getUpdatedProperty());
    updateProfileListProperty.addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
        List<String> profiles = getProfilesNameList();
        profileListBox.setItems(FXCollections.observableArrayList(profiles));
        if (!profiles.contains(currentSelectedProfile)) {
            tableView.reset();
            profileDetailContainer.setVisible(false);
        }
    });
    tableView = new PacketTableView(230, this, true);
    profileTableViewContainer.getChildren().add(tableView);
    serverStatusIcon.setImage(new Image("/icons/offline.png"));
    // initialize right click menu
    rightClickPortMenu = new ContextMenu();
    addMenuItem(rightClickPortMenu, "Acquire", ContextMenuClickType.ACQUIRE, false);
    addMenuItem(rightClickPortMenu, "Force Acquire", ContextMenuClickType.FORCE_ACQUIRE, false);
    addMenuItem(rightClickPortMenu, "Release Acquire", ContextMenuClickType.RELEASE_ACQUIRE, false);
    addMenuItem(rightClickPortMenu, "Enable Service Mode", ContextMenuClickType.ENABLE_SERVICE, false);
    addMenuItem(rightClickPortMenu, "Disable Service Mode", ContextMenuClickType.DISABLE_SERVICE, false);
    rightClickProfileMenu = new ContextMenu();
    addMenuItem(rightClickProfileMenu, "Play", ContextMenuClickType.PLAY, false);
    addMenuItem(rightClickProfileMenu, "Pause", ContextMenuClickType.PAUSE, false);
    addMenuItem(rightClickProfileMenu, "Stop", ContextMenuClickType.STOP, false);
    rightClickGlobalMenu = new ContextMenu();
    addMenuItem(rightClickGlobalMenu, "Release All Ports", ContextMenuClickType.RELEASE_ALL, false);
    addMenuItem(rightClickGlobalMenu, "Acquire All Ports", ContextMenuClickType.ACQUIRE_ALL, false);
    addMenuItem(rightClickGlobalMenu, "Force Acquire All Ports", ContextMenuClickType.FORCE_ACQUIRE_ALL, false);
    addMenuItem(rightClickGlobalMenu, "Re-Acquire my Ports", ContextMenuClickType.ACQUIRE_MY_PORT, false);
    // initialize multiplexer
    multiplierView = new MultiplierView(this);
    multiplierOptionContainer.getChildren().add(multiplierView);
    notificationPanel = new NotificationPanel();
    notificationPanel.setNotificationMsg(DISABLED_MULTIPLIER_MSG);
    notificationPanelHolder.getChildren().add(notificationPanel);
    // add close
    TrexApp.getPrimaryStage().setOnCloseRequest(new EventHandler<WindowEvent>() {

        @Override
        public void handle(WindowEvent event) {
            // handle aplpication close
            DialogManager.getInstance().closeAll();
            handleAppClose();
        }
    });
    TrexApp.getPrimaryStage().setOnShown(new EventHandler<WindowEvent>() {

        @Override
        public void handle(WindowEvent event) {
            TrexApp.getPrimaryStage().focusedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
                if (newValue && tableView.isStreamEditingWindowOpen()) {
                    tableView.setStreamEditingWindowOpen(false);
                    streamTableUpdated();
                }
            });
        }
    });
    TrexApp.getPrimaryStage().setOnCloseRequest(new EventHandler<WindowEvent>() {

        @Override
        public void handle(WindowEvent event) {
            System.exit(0);
        }
    });
    logContainer.getChildren().add(LogsController.getInstance().getView());
    // initialize countdown service
    countdownService = new CountdownService();
    countdownService.setPeriod(Duration.seconds(Constants.REFRESH_ONE_INTERVAL_SECONDS));
    countdownService.setRestartOnFailure(false);
    countdownService.setOnSucceeded((WorkerStateEvent event) -> {
        int count = (int) event.getSource().getValue();
        countdownValue.setText(String.valueOf(count) + " Sec");
        if (count == 0) {
            doUpdateAssignedProfile();
        }
    });
    devicesTree.getSelectionModel().selectedItemProperty().addListener(new ChangeListener() {

        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {
            handleTreeItemSelectionChanged();
        }
    });
}
Also used : ObservableValue(javafx.beans.value.ObservableValue) Image(javafx.scene.image.Image) NotificationPanel(com.exalttech.trex.ui.components.NotificationPanel) CountdownService(com.exalttech.trex.ui.views.services.CountdownService) MultiplierView(com.exalttech.trex.ui.views.MultiplierView) WindowEvent(javafx.stage.WindowEvent) WorkerStateEvent(javafx.concurrent.WorkerStateEvent) ChangeListener(javafx.beans.value.ChangeListener) JsonObject(com.google.gson.JsonObject) ImageView(javafx.scene.image.ImageView) PacketTableView(com.exalttech.trex.ui.views.PacketTableView)

Example 2 with PacketTableView

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

the class TrafficProfileDialogController method initialize.

/**
 * @param location
 * @param resources
 */
@Override
public void initialize(URL location, ResourceBundle resources) {
    tableView = new PacketTableView(TABLE_WIDTH);
    initializeProfileBtn();
    initializeProfileList();
}
Also used : PacketTableView(com.exalttech.trex.ui.views.PacketTableView)

Aggregations

PacketTableView (com.exalttech.trex.ui.views.PacketTableView)2 NotificationPanel (com.exalttech.trex.ui.components.NotificationPanel)1 MultiplierView (com.exalttech.trex.ui.views.MultiplierView)1 CountdownService (com.exalttech.trex.ui.views.services.CountdownService)1 JsonObject (com.google.gson.JsonObject)1 ChangeListener (javafx.beans.value.ChangeListener)1 ObservableValue (javafx.beans.value.ObservableValue)1 WorkerStateEvent (javafx.concurrent.WorkerStateEvent)1 Image (javafx.scene.image.Image)1 ImageView (javafx.scene.image.ImageView)1 WindowEvent (javafx.stage.WindowEvent)1