Search in sources :

Example 6 with Window

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 -> {
//
//
//		});
}
Also used : Window(javafx.stage.Window) ThreadDumpTextArea(com.kyj.fx.voeditor.visual.component.text.ThreadDumpTextArea) ApplicationModel(com.kyj.bci.monitor.ApplicationModel) ByteArrayOutputStream(org.apache.commons.io.output.ByteArrayOutputStream)

Example 7 with Window

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);
    }
}
Also used : Window(javafx.stage.Window) IOException(java.io.IOException) FXML(javafx.fxml.FXML)

Example 8 with Window

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) {
    }
}
Also used : Window(javafx.stage.Window) Alert(javafx.scene.control.Alert) File(java.io.File)

Example 9 with Window

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);
    }
}
Also used : Window(javafx.stage.Window) DialogWindow(com.exalttech.trex.ui.dialog.DialogWindow) Packet(org.pcap4j.packet.Packet) EthernetPacket(org.pcap4j.packet.EthernetPacket) IllegalRawDataException(org.pcap4j.packet.IllegalRawDataException) IOException(java.io.IOException) Timestamp(java.sql.Timestamp) TableProfile(com.exalttech.trex.ui.views.models.TableProfile) Profile(com.exalttech.trex.remote.models.profiles.Profile) TrafficProfile(com.exalttech.trex.util.TrafficProfile) File(java.io.File)

Example 10 with Window

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);
}
Also used : Window(javafx.stage.Window) DialogWindow(com.exalttech.trex.ui.dialog.DialogWindow) TableProfile(com.exalttech.trex.ui.views.models.TableProfile) Profile(com.exalttech.trex.remote.models.profiles.Profile) TrafficProfile(com.exalttech.trex.util.TrafficProfile)

Aggregations

Window (javafx.stage.Window)27 Scene (javafx.scene.Scene)11 Stage (javafx.stage.Stage)6 FXML (javafx.fxml.FXML)4 Point2D (javafx.geometry.Point2D)4 Button (javafx.scene.control.Button)4 TextField (javafx.scene.control.TextField)4 SkinManager (com.kyj.fx.voeditor.visual.momory.SkinManager)3 File (java.io.File)3 IOException (java.io.IOException)3 Optional (java.util.Optional)3 ObservableList (javafx.collections.ObservableList)3 Node (javafx.scene.Node)3 TextArea (javafx.scene.control.TextArea)3 Tooltip (javafx.scene.control.Tooltip)3 BorderPane (javafx.scene.layout.BorderPane)3 Profile (com.exalttech.trex.remote.models.profiles.Profile)2 DialogWindow (com.exalttech.trex.ui.dialog.DialogWindow)2 TableProfile (com.exalttech.trex.ui.views.models.TableProfile)2 TrafficProfile (com.exalttech.trex.util.TrafficProfile)2