/** Read an Entry from the given EntrySource and make a new EntryEdit component for the Entry. */ private void getEntryEditFromEntrySource(final EntrySource entry_source) { SwingWorker entryWorker = new SwingWorker() { EntryEdit entry_edit; public Object construct() { try { final Entry entry = entry_source.getEntry(true); if (entry == null) return null; final EntryGroup entry_group = new SimpleEntryGroup(entry.getBases()); entry_group.add(entry); entry_edit = new EntryEdit(entry_group); } catch (OutOfRangeException e) { new MessageDialog( ArtemisMain.this, "read failed: one of the features in " + " the entry has an out of range " + "location: " + e.getMessage()); } catch (NoSequenceException e) { new MessageDialog(ArtemisMain.this, "read failed: entry contains no sequence"); } catch (IOException e) { new MessageDialog(ArtemisMain.this, "read failed due to IO error: " + e); } return null; } public void finished() { if (entry_edit != null) entry_edit.setVisible(true); } }; entryWorker.start(); }
/** Launch database manager window */ private void launchDatabaseJFrame() { SwingWorker entryWorker = new SwingWorker() { public Object construct() { getStatusLabel().setText("Connecting ..."); DatabaseEntrySource entry_source = new DatabaseEntrySource(); boolean promptUser = true; if (System.getProperty("read_only") != null) promptUser = false; if (!entry_source.setLocation(promptUser)) return null; JFrame frame = new JFrame("Organism List"); final DatabaseJPanel pane = new DatabaseJPanel(entry_source, ArtemisMain.this); frame.getContentPane().add(pane); frame.pack(); Utilities.rightJustifyFrame(frame); frame.setVisible(true); // frame.setJMenuBar(pane.makeMenuBar(entry_source, ArtemisMain.this)); getStatusLabel().setText(""); return null; } }; entryWorker.start(); }