Search in sources :

Example 1 with PortState

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

the class MainViewController method updateHeaderBtnStat.

/**
     * Update header stream buttons state
     */
private void updateHeaderBtnStat() {
    int portIndex = getSelectedPortIndex();
    resetBtnState();
    if (portIndex != -1) {
        Port port = portManager.getPortList().get(portIndex);
        PortState state = PortState.getPortStatus(port.getStatus());
        // enable state btn btn according to owner 
        boolean isOwner = portManager.isCurrentUserOwner(portIndex);
        switch(state) {
            case STREAMS:
                startStream.setDisable(!isOwner || !portManager.getPortModel(portIndex).isStreamLoaded());
                break;
            case TX:
                pauseStream.setDisable(!isOwner);
                stopStream.setDisable(!isOwner);
                break;
            case PAUSE:
                startStream.setDisable(!isOwner);
                pauseStream.setDisable(!isOwner);
                stopStream.setDisable(!isOwner);
                pauseStream.getStyleClass().add("pauseIconPressed");
                break;
            case IDLE:
                AssignedProfile portProfile = assignedPortProfileMap.get(portIndex);
                if (portProfile != null) {
                    startStream.setDisable(!(isOwner && portProfile.isProfileAssigned()));
                }
                break;
            default:
                break;
        }
    }
}
Also used : AssignedProfile(com.exalttech.trex.ui.views.models.AssignedProfile) PortState(com.exalttech.trex.ui.PortState) Port(com.exalttech.trex.ui.models.Port)

Example 2 with PortState

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

the class MainViewController method stopAllTransitBtnCLicked.

/**
     * stop all transit btn clicked
     *
     * @param event
     */
@FXML
public void stopAllTransitBtnCLicked(MouseEvent event) {
    LOG.trace("Clicked on the Stop All Transit Button ");
    portManager.getPortList().stream().forEach(port -> {
        PortState portState = PortState.getPortStatus(port.getStatus());
        if (portManager.isCurrentUserOwner(port.getIndex()) && portState == PortState.TX) {
            serverRPCMethods.stopPortTraffic(port.getIndex());
            portManager.updatedPorts(Arrays.asList(port.getIndex()));
        }
    });
    enableUpdateBtn(false, false);
}
Also used : PortState(com.exalttech.trex.ui.PortState) FXML(javafx.fxml.FXML)

Example 3 with PortState

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

the class StatisticLabelCell method updateStatusCell.

/**
     * Update status cell value
     *
     * @param newValue
     */
private void updateStatusCell(String newValue) {
    PortState portState = PortState.getPortStatus(newValue);
    getStyleClass().add(portState.getTextColor());
}
Also used : PortState(com.exalttech.trex.ui.PortState)

Aggregations

PortState (com.exalttech.trex.ui.PortState)3 Port (com.exalttech.trex.ui.models.Port)1 AssignedProfile (com.exalttech.trex.ui.views.models.AssignedProfile)1 FXML (javafx.fxml.FXML)1