@Override public JFrame getParentFrame() { return desktop.getMainFrame(); }
/** * Default constructor. */ public CytoscapeImporter() { this(OVTK2Desktop.getInstance().getMainFrame()); }
@Override public Dimension getParentSize() { return desktop.getMainFrame().getSize(); }
/** * Returns the component containing the accumulated error messages. */ private void getErrors(String errors) { errorReport.setText(errors.substring(1, errors.length())); // show possible errors if (errorReport.getText().length() > 0) { JOptionPane.showMessageDialog(OVTK2Desktop.getInstance() .getMainFrame(), new JScrollPane(errorReport), "The following warnings were created during import...", JOptionPane.WARNING_MESSAGE); } }
private ErrorDialog(boolean running, Throwable throwable, Thread thread) { super(running ? OVTK2Desktop.getInstance().getMainFrame() : null, "Error"); this.throwable = throwable; this.thread = thread; this.running = running; setupGUI(); boolean debug = Boolean.parseBoolean(Config.config.getProperty("flags.debug")); if (debug) throwable.printStackTrace(); }
@Override public void actionPerformed(ActionEvent e) { if (box.getSelectedItem() instanceof AttributeName) { AttributeName an = (AttributeName) box.getSelectedItem(); Class<?> clazz = an.getDataType(); if (!Comparable.class.isAssignableFrom(clazz)) { JOptionPane .showMessageDialog( OVTK2Desktop.getInstance().getMainFrame(), "Selected values are not comparable. Please make a different selection.", "Error in value selection", JOptionPane.ERROR_MESSAGE); } } }
@Override public void warning(TranscoderException arg0) throws TranscoderException { JOptionPane.showMessageDialog(OVTK2Desktop.getInstance().getMainFrame(), arg0.getMessage(), "Warning", JOptionPane.WARNING_MESSAGE); } }
public void actionPerformed(ActionEvent arg0) { if (ovtk2layouter != null && viewer != null) { VisualisationUtils.relayout(viewer, OVTK2Desktop.getInstance().getMainFrame()); } }
/** * Shows a file open dialog with the given filter file extensions. * * @param extensions * used to filter filenames * @return File */ public static File showOpenDialog(String[] extensions) { File dir = (Config.lastOpenedFile == null) ? new File(System.getProperty("user.dir")) : new File(Config.lastOpenedFile); JFileChooser fc = new JFileChooser(dir); fc.addChoosableFileFilter(new CustomFileFilter(extensions)); fc.setFileSelectionMode(JFileChooser.FILES_ONLY); OVTK2Desktop desktop = OVTK2Desktop.getInstance(); // in response to a button click: int returnVal = fc.showOpenDialog(desktop.getMainFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { File file = fc.getSelectedFile(); Config.lastOpenedFile = file.getAbsolutePath(); if (Config.lastSavedFile == null) Config.lastSavedFile = Config.lastOpenedFile; System.out.println("Opening: " + file.getName() + "."); return file; } System.out.println("Open command cancelled by user."); return null; }
/** * Shows a file save dialog with the given filter file extensions. * * @param extensions * used to filter filenames * @return File */ public static File showSaveDialog(String[] extensions) { File dir = (Config.lastSavedFile == null) ? new File(System.getProperty("user.dir")) : new File(Config.lastSavedFile); JFileChooser fc = new JFileChooser(dir); fc.addChoosableFileFilter(new CustomFileFilter(extensions)); OVTK2Desktop desktop = OVTK2Desktop.getInstance(); ChooserAccessory accessory = new ChooserAccessory(); fc.setAccessory(accessory); // in response to a button click: int returnVal = fc.showSaveDialog(desktop.getMainFrame()); if (returnVal == JFileChooser.APPROVE_OPTION) { accessory.perform(desktop); File file = fc.getSelectedFile(); Config.lastSavedFile = file.getAbsolutePath(); System.out.println("Saving: " + file.getName() + "."); return file; } System.out.println("Save command cancelled by user."); return null; }
OVTKProgressMonitor.start(OVTK2Desktop.getInstance().getMainFrame(), "Searching graph", search);
OVTK2Desktop.getInstance().getMainFrame(), "All pairs shortest path filter", filter);
OVTKProgressMonitor.start(OVTK2Desktop.getInstance().getMainFrame(), Config.language.getProperty("Progress.ReadingFile"), p); JOptionPane.showMessageDialog(OVTK2Desktop.getInstance().getMainFrame(), Config.language.getProperty("Dialog.File.NotFound"), Config.language.getProperty("Dialog.File.NotFoundTitle"), JOptionPane.ERROR_MESSAGE);
@Override public void fireCommandEvent(CommandEvent evt) { CommandProcess m = new CommandProcess(this, evt); m.start(); JFrame parent = null; if (!Config.isApplet) parent = OVTK2Desktop.getInstance().getMainFrame(); OVTKProgressMonitor.start(parent, "Please wait...", m); }
if (parent == null) { new CDOptionsDialog(OVTK2Desktop.getInstance().getMainFrame(), pluginOrder, name2activation); } else {
OVTKProgressMonitor.start(OVTK2Desktop.getInstance().getMainFrame(), Config.language.getProperty("Progress.SavingFile"), p);
/** * Method for compatibility with previous versions * * @param title * @param process */ public static void start(String title, final Monitorable process) { // running in Desktop version if (OVTK2Desktop.getDesktopResources().getSelectedViewer() instanceof OVTK2Viewer) start(OVTK2Desktop.getInstance().getMainFrame(), title, process); else start(null, title, process); }
public void run() { try { // start OXL import process imp.start(); if (imp.isCancelled()) return; // wrap into indefinite process IndeterminateProcessAdapter p = new IndeterminateProcessAdapter() { public void task() { // display the graph DesktopUtils.displayGraphOnDesktop(aog, imp.getAnnotations()); } }; // display graph OVTKProgressMonitor.start(OVTK2Desktop.getInstance().getMainFrame(), Config.language.getProperty("Progress.AddingToDesktop"), p); p.start(); } catch (Exception e) { ErrorDialog.show(e); } } };
OVTKProgressMonitor.start(OVTK2Desktop.getInstance().getMainFrame(), "Initialising taxonomy lookup", p); } else if (n == JOptionPane.CANCEL_OPTION) { loadNCBI = false;
public static void colourByContexts(OVTK2PropertiesAggregator viewer) { ONDEXGraph graph = viewer.getONDEXJUNGGraph(); Color color = JColorChooser.showDialog(OVTK2Desktop.getInstance().getMainFrame(), "Choose Background Color", Color.blue); if (color == null) return; System.err.println(color); PickedState<ONDEXConcept> state = viewer.getVisualizationViewer().getPickedVertexState(); Set<ONDEXConcept> set = state.getPicked(); for (ONDEXConcept n : set) { ONDEXConcept context = graph.getConcept(n.getId()); Annotation.setColor(viewer, context, color); for (ONDEXConcept c : graph.getConceptsOfTag(context)) { Annotation.setColor(viewer, c, color); } } }