use of com.tagtraum.perf.gcviewer.view.GCDocument in project GCViewer by chewiebug.
the class GCViewerGuiController method closeAllButSelectedDocument.
private void closeAllButSelectedDocument(GCViewerGui gui) {
if (gui.getSelectedGCDocument() != null) {
GCDocument selected = gui.getSelectedGCDocument();
for (int i = gui.getDesktopPane().getComponentCount() - 1; i > 0; --i) {
if (gui.getDesktopPane().getComponent(i) != selected) {
((JInternalFrame) gui.getDesktopPane().getComponent(i)).dispose();
}
}
gui.getSelectedGCDocument().doDefaultCloseAction();
}
}
use of com.tagtraum.perf.gcviewer.view.GCDocument 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);
}
}
}
use of com.tagtraum.perf.gcviewer.view.GCDocument in project GCViewer by chewiebug.
the class GCModelLoaderControllerImpl method openGCResource.
private void openGCResource(GCResource gcResource, GCModelLoader loader) {
GCDocument document = new GCDocument(gcViewerGui.getPreferences(), gcResource.getResourceName());
document.setDropTarget(new DropTarget(document, DnDConstants.ACTION_COPY, new FileDropTargetListener(this, DropFlavor.ADD)));
document.addInternalFrameListener(new GCViewerGuiInternalFrameController());
gcViewerGui.addDocument(document);
GCDocumentController docController = new GCDocumentController(document);
docController.addGCResource(loader, getViewMenuController());
loader.execute();
}
use of com.tagtraum.perf.gcviewer.view.GCDocument in project GCViewer by chewiebug.
the class Watch method start.
private void start() {
GCDocument gcDocument = gcViewer.getSelectedGCDocument();
TimerInfo timerInfo = new TimerInfo(new RefreshWatchDog(controller, gcDocument), new GCDocumentCloseListener(gcDocument));
gcDocument.setWatched(true);
gcDocument.addInternalFrameListener(timerInfo.closeListener);
timerMap.put(gcDocument, timerInfo);
timerInfo.refreshWatchDog.start();
putValue(SMALL_ICON, CLOCK_ICON);
}
Aggregations