use of com.exalttech.trex.ui.views.models.AssignedProfile 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.getPortByIndex(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;
}
}
}
use of com.exalttech.trex.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method doUpdateAssignedProfile.
/**
* Update current port
*/
private void doUpdateAssignedProfile() {
try {
if (needReassignProfile) {
needReassignProfile = false;
String assignedProfile = String.valueOf(profileListBox.getValue());
assignProfile(assignedProfile, multiplierView.getSliderValue(), true, lastSelectedPortIndex);
} else {
serverRPCMethods.updateTraffic(lastSelectedPortIndex, false, MultiplierType.pps.name(), multiplierView.getPPSValue());
// update assigned profile multiplier
AssignedProfile assignedProf = assignedPortProfileMap.get(lastSelectedPortIndex);
updateMultiplierValues(assignedProf);
}
updateHeaderBtnStat();
} catch (TrafficException ex) {
LOG.error("Error updating port", ex);
}
enableUpdateBtn(false, false);
}
use of com.exalttech.trex.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method updateCurrentProfile.
/**
* Update current loaded profile
*/
private void updateCurrentProfile() {
// TODO get rid of this method and implement with tryUpdateProfile(...)
profileLoaded = false;
AssignedProfile assignedProf = assignedPortProfileMap.get(lastSelectedPortIndex);
if (assignedProf != null) {
assignedProf.setHasDuration(multiplierView.isDurationEnable());
updateMultiplierValues(assignedProf);
}
if (isWaitingUpdate()) {
tryUpdateProfile(false, true);
}
}
use of com.exalttech.trex.ui.views.models.AssignedProfile in project trex-stateless-gui by cisco-system-traffic-generator.
the class MainViewController method assignProfile.
/**
* Assign profile to selected port
*
* @param profileName
*/
private void assignProfile(String profileName, double currentBandwidth, boolean assignPrevBandwidth, int portID) {
try {
// update selected profile
AssignedProfile assignedProf = assignedPortProfileMap.get(portID);
if (assignedProf == null) {
return;
}
assignedProf.setProfileName(profileName);
assignedProf.setAllStreamsWithLatency(allStreamWithLatency);
PortModel port = PortsManager.getInstance().getPortModel(portID);
String portState = port.getPortStatus();
StreamValidation streamValidationGraph = serverRPCMethods.assignTrafficProfile(portID, loadedProfiles);
portManager.getPortModel(portID).setStreamLoaded(true);
startStream.setDisable(false);
// update current multiplier data
assignedProf.setRate(streamValidationGraph.getResult().getRate());
multiplierView.assignNewProfile(assignedProf);
// update multiplier value according to previous bandwidth value
if (assignPrevBandwidth) {
multiplierView.setSliderValue(currentBandwidth);
}
updateMultiplierValues(assignedProf);
if (portState.equalsIgnoreCase("tx")) {
startTraffic(portID);
}
} catch (IOException | InvalidRPCResponseException | IncorrectRPCMethodException ex) {
startStream.setDisable(true);
portManager.getPortModel(portID).setStreamLoaded(false);
LOG.error("Failed to load Stream", ex);
} catch (Exception ex) {
java.util.logging.Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex);
} finally {
portManager.updatedPorts(Arrays.asList(portID));
}
}
Aggregations