use of com.exalttech.trex.ui.views.streams.binders.BuilderDataBinding in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketBuilderHomeController method initEditStream.
private void initEditStream(String pcapFileBinary) {
streamTabPane.setDisable(false);
saveButton.setDisable(false);
streamEditorModeBtn.setDisable(false);
Stream currentStream = selectedProfile.getStream();
streamEditorModeBtn.setText(currentStream.getAdvancedMode() ? "Simple mode" : "Advanced mode");
if (!Util.isNullOrEmpty(currentStream.getPacket().getMeta())) {
BuilderDataBinding dataBinding = getDataBinding();
if (dataBinding != null) {
initStreamBuilder(dataBinding);
return;
} else {
streamTabPane.setDisable(true);
saveButton.setDisable(true);
streamEditorModeBtn.setDisable(true);
}
} else {
isImportedStreamProperty.set(true);
}
if (isImportedStreamProperty.get()) {
streamTabPane.getTabs().remove(protocolDataTab);
streamTabPane.getTabs().remove(protocolSelectionTab);
streamTabPane.getTabs().remove(advanceSettingsTab);
streamTabPane.getTabs().remove(packetViewerWithTreeTab);
streamTabPane.getTabs().remove(packetEditorTab);
streamTabPane.getTabs().remove(fieldEngineTab);
}
if (pcapFileBinary != null) {
try {
isBuildPacket = false;
File pcapFile = trafficProfile.decodePcapBinary(pcapFileBinary);
parser.parseFile(pcapFile.getAbsolutePath(), packetInfo);
packetHex.setData(packetInfo);
} catch (IOException ex) {
LOG.error("Failed to load PCAP value", ex);
}
}
String base64UserModel = currentStream.getPacket().getModel();
if (!Strings.isNullOrEmpty(base64UserModel)) {
packetBuilderController.loadUserModel(base64UserModel);
}
}
use of com.exalttech.trex.ui.views.streams.binders.BuilderDataBinding in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketBuilderHomeController method initStreamBuilder.
public boolean initStreamBuilder(String pcapFileBinary, List<Profile> profileList, int selectedProfileIndex, String yamlFileName, StreamBuilderType type) {
selectedProfile = profileList.get(selectedProfileIndex);
this.profileList = profileList;
this.yamlFileName = yamlFileName;
currentSelectedProfileIndex = selectedProfileIndex;
if (selectedProfile.getStream().getAdvancedMode() && !ConnectionManager.getInstance().isScapyConnected()) {
boolean loop = true;
while (loop) {
eventBus.post(new ScapyClientNeedConnectEvent());
if (ConnectionManager.getInstance().isScapyConnected()) {
loop = false;
} else {
loop = alertWarning("Can't open packet editor in Advanced mode", "There is no connection to Scapy server." + "\nPlease refer to documentation about" + "\nScapy server and advanced mode.");
}
}
if (!ConnectionManager.getInstance().isScapyConnected()) {
return false;
}
}
packetBuilderController.reset();
streamPropertiesController.init(profileList, selectedProfileIndex);
updateNextPrevButtonState();
switch(type) {
case BUILD_STREAM:
initStreamBuilder(new BuilderDataBinding());
showSimpleModeTabs();
break;
case EDIT_STREAM:
initEditStream(pcapFileBinary);
if (selectedProfile.getStream().getAdvancedMode()) {
showAdvancedModeTabs();
} else {
showSimpleModeTabs();
}
break;
default:
break;
}
return true;
}
Aggregations