use of javafx.stage.Window in project Gargoyle by callakrsos.
the class JavaProcessMonitor method menuThreadDumpOnAction.
/**
* Thread Dump
* @작성자 : KYJ
* @작성일 : 2017. 1. 23.
* @param e
* @throws Exception
*/
public void menuThreadDumpOnAction(ActionEvent e) {
ApplicationModel selectedItem = getSelectedItem(item -> item);
if (selectedItem == null) {
Window window = FxUtil.getWindow(this.getParent(), () -> {
return SharedMemory.getPrimaryStage();
});
DialogUtil.showMessageDialog(window, "덤프를 출력할 프로세스를 선택.");
return;
}
Integer selectedProcessId = selectedItem.getProcessId();
String applicationName = selectedItem.getApplicationName();
ByteArrayOutputStream out = new ByteArrayOutputStream();
Monitors.runStackTool(selectedProcessId, out);
ThreadDumpTextArea parent = new ThreadDumpTextArea();
parent.setContent(out.toString());
FxUtil.createStageAndShow(parent, stage -> {
stage.initOwner(getParent().getScene().getWindow());
stage.setWidth(1200d);
stage.setHeight(800d);
stage.setTitle("App - " + applicationName);
});
// FxUtil.createSimpleTextAreaAndShow(out.toString(), stage -> {
//
//
// });
}
use of javafx.stage.Window in project trex-stateless-gui by cisco-system-traffic-generator.
the class TrafficProfileDialogController method hanldeExportToJSONBtnClicked.
/**
* Handle export to JSON button clicked
*
* @param event
*/
@FXML
public void hanldeExportToJSONBtnClicked(ActionEvent event) {
try {
String data = trafficProfile.convertTrafficProfileToJson(currentLoadedProfilesList, -1, "NONE");
String fileName = selectedFile.getName().substring(0, selectedFile.getName().indexOf(".")) + ".json";
Window owner = ((Button) (event.getSource())).getScene().getWindow();
FileManager.exportFile("Save JSON File", fileName, data, owner, FileType.JSON);
} catch (Exception ex) {
LOG.error("Error during generate JSON file", ex);
}
}
use of javafx.stage.Window in project trex-stateless-gui by cisco-system-traffic-generator.
the class PayloadView method selectPatternFile.
private void selectPatternFile() {
try {
String loadFolderPath = PreferencesManager.getInstance().getLoadLocation();
Window owner = importPatternButton.getScene().getWindow();
File loadedFile = FileManager.getSelectedFile("Open Pcap File", "", owner, FileType.TXT, loadFolderPath, false);
if (loadedFile != null) {
// read the file and save the string in the pattern
String data = FileManager.getFileContent(loadedFile).replaceAll(" ", "");
if (Util.isHex(data)) {
pattern.setText(data);
} else {
Alert errorMsg = Util.getAlert(Alert.AlertType.ERROR);
errorMsg.setContentText("Invalid payload pattern");
errorMsg.showAndWait();
}
}
} catch (Exception ex) {
}
}
use of javafx.stage.Window in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketTableView method handleExportPcapFile.
/**
* Export stream to pcap file
*/
public void handleExportPcapFile() {
try {
Profile p = tabledata.getProfiles().get(streamPacketTableView.getSelectionModel().getSelectedIndex());
String packetBinary = p.getStream().getPacket().getBinary();
byte[] pkt = Base64.decodeBase64(packetBinary);
Packet packet = EthernetPacket.newPacket(pkt, 0, pkt.length);
File pcapFile = File.createTempFile("temp-file-name", ".pcap");
PcapHandle handle = Pcaps.openDead(DataLinkType.EN10MB, 65536);
PcapDumper dumper = handle.dumpOpen(pcapFile.getAbsolutePath());
Timestamp ts = new Timestamp(0);
dumper.dump(packet, ts);
dumper.close();
handle.close();
String fileName = p.getName() + ".pcap";
Window owner = streamPacketTableView.getScene().getWindow();
FileManager.exportFile("Save Pcap File", fileName, pcapFile, owner, FileType.PCAP);
} catch (IllegalRawDataException | IOException | PcapNativeException | NotOpenException ex) {
LOG.error("Error during generate JSON file", ex);
}
}
use of javafx.stage.Window in project trex-stateless-gui by cisco-system-traffic-generator.
the class PacketTableView method handleExportToYaml.
/**
* Export current load profile to yaml
*/
private void handleExportToYaml() {
Window owner = this.getScene().getWindow();
Profile[] profilesList = tabledata.getProfiles().toArray(new Profile[tabledata.getProfiles().size()]);
trafficProfile.exportProfileToYaml(owner, profilesList, profileName);
}
Aggregations