Search in sources :

Example 1 with ChartPanelView

use of com.tagtraum.perf.gcviewer.view.ChartPanelView in project GCViewer by chewiebug.

the class Export method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final GCDocument gcDocument = gcViewer.getSelectedGCDocument();
    for (int i = 0; i < gcDocument.getChartPanelViewCount(); i++) {
        final ChartPanelView chartPanelView = gcDocument.getChartPanelView(i);
        final File file = new File(chartPanelView.getGCResource().getResourceName());
        saveDialog.setCurrentDirectory(file.getParentFile());
        saveDialog.setSelectedFile(file);
        final int val = saveDialog.showSaveDialog(gcViewer);
        if (val == JFileChooser.APPROVE_OPTION) {
            ExportExtensionFileFilter fileFilter = (ExportExtensionFileFilter) saveDialog.getFileFilter();
            // On OS/X if you don't select one of the filters and just press "Save" the filter may be null. Use the CSV one then
            if (fileFilter == null) {
                fileFilter = (ExportExtensionFileFilter) saveDialog.getChoosableFileFilters()[0];
            }
            exportFile(chartPanelView.getGCResource().getModel(), saveDialog.getSelectedFile(), fileFilter.getExtension(), fileFilter.getDataWriterType());
        } else if (val == JFileChooser.ERROR_OPTION) {
            JOptionPane.showMessageDialog(gcViewer, LocalisationHelper.getString("fileexport_dialog_error_occured"), LocalisationHelper.getString("fileexport_dialog_write_file_failed"), JOptionPane.ERROR_MESSAGE);
        }
    }
}
Also used : ChartPanelView(com.tagtraum.perf.gcviewer.view.ChartPanelView) GCDocument(com.tagtraum.perf.gcviewer.view.GCDocument) File(java.io.File)

Example 2 with ChartPanelView

use of com.tagtraum.perf.gcviewer.view.ChartPanelView in project GCViewer by chewiebug.

the class GCDocumentController method addGCResource.

public void addGCResource(GCModelLoader loader, ViewMenuController viewMenuController) {
    ChartPanelView chartPanelView = new ChartPanelView(gcDocument.getPreferences(), loader.getGcResource());
    ((ModelChartImpl) chartPanelView.getModelChart()).addPropertyChangeListener(viewMenuController);
    ((ModelChartImpl) chartPanelView.getModelChart()).addTimeOffsetChangeListener(new TimeOffsetPanelController(gcDocument));
    gcDocument.addChartPanelView(chartPanelView);
    loader.addPropertyChangeListener(this);
    loader.addPropertyChangeListener(chartPanelView.getModelLoaderView());
}
Also used : ChartPanelView(com.tagtraum.perf.gcviewer.view.ChartPanelView) ModelChartImpl(com.tagtraum.perf.gcviewer.view.ModelChartImpl)

Aggregations

ChartPanelView (com.tagtraum.perf.gcviewer.view.ChartPanelView)2 GCDocument (com.tagtraum.perf.gcviewer.view.GCDocument)1 ModelChartImpl (com.tagtraum.perf.gcviewer.view.ModelChartImpl)1 File (java.io.File)1