();
+ progressBars = new Hashtable<>();
+ progressBarHandlers = new Hashtable<>();
}
- if (progressBars.get(new Long(id)) != null)
+ if (progressBars.get(Long.valueOf(id)) != null)
{
- JPanel panel = progressBars.remove(new Long(id));
- if (progressBarHandlers.contains(new Long(id)))
+ JPanel panel = progressBars.remove(Long.valueOf(id));
+ if (progressBarHandlers.contains(Long.valueOf(id)))
{
- progressBarHandlers.remove(new Long(id));
+ progressBarHandlers.remove(Long.valueOf(id));
}
removeProgressPanel(panel);
}
else
{
- progressBars.put(new Long(id), addProgressPanel(message));
+ progressBars.put(Long.valueOf(id), addProgressPanel(message));
}
}
@@ -2532,18 +2528,18 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* @see jalview.gui.IProgressIndicator#registerHandler(long,
* jalview.gui.IProgressIndicatorHandler)
*/
+ @Override
public void registerHandler(final long id,
final IProgressIndicatorHandler handler)
{
if (progressBarHandlers == null
- || !progressBars.containsKey(new Long(id)))
+ || !progressBars.containsKey(Long.valueOf(id)))
{
- throw new Error(
- MessageManager
- .getString("error.call_setprogressbar_before_registering_handler"));
+ throw new Error(MessageManager.getString(
+ "error.call_setprogressbar_before_registering_handler"));
}
- progressBarHandlers.put(new Long(id), handler);
- final JPanel progressPanel = progressBars.get(new Long(id));
+ progressBarHandlers.put(Long.valueOf(id), handler);
+ final JPanel progressPanel = progressBars.get(Long.valueOf(id));
if (handler.canCancel())
{
JButton cancel = new JButton(
@@ -2552,13 +2548,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements
cancel.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
handler.cancelActivity(id);
- us.setProgressBar(MessageManager.formatMessage(
- "label.cancelled_params",
- new Object[] { ((JLabel) progressPanel.getComponent(0))
- .getText() }), id);
+ us.setProgressBar(MessageManager
+ .formatMessage("label.cancelled_params", new Object[]
+ { ((JLabel) progressPanel.getComponent(0)).getText() }),
+ id);
}
});
progressPanel.add(cancel, BorderLayout.EAST);
@@ -2591,7 +2588,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
if (desktop != null)
{
- AlignmentPanel[] aps = getAlignmentPanels(viewport.getSequenceSetId());
+ AlignmentPanel[] aps = getAlignmentPanels(
+ viewport.getSequenceSetId());
for (int panel = 0; aps != null && panel < aps.length; panel++)
{
if (aps[panel] != null && aps[panel].av == viewport)
@@ -2605,7 +2603,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
public VamsasApplication getVamsasApplication()
{
- return v_client;
+ // TODO: JAL-3311 remove remaining code from Jalview relating to VAMSAS
+ return null;
}
@@ -2660,13 +2659,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
if (Cache.getDefault("SHOW_JWS2_SERVICES", true))
{
- if (jalview.ws.jws2.Jws2Discoverer.getDiscoverer().isRunning())
- {
- jalview.ws.jws2.Jws2Discoverer.getDiscoverer().setAborted(true);
- }
- t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer().startDiscoverer(
- changeSupport);
-
+ t2 = jalview.ws.jws2.Jws2Discoverer.getDiscoverer()
+ .startDiscoverer(changeSupport);
}
Thread t3 = null;
{
@@ -2682,8 +2676,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
} catch (Exception e)
{
}
- alive = (t1 != null && t1.isAlive())
- || (t2 != null && t2.isAlive())
+ alive = (t1 != null && t1.isAlive()) || (t2 != null && t2.isAlive())
|| (t3 != null && t3.isAlive())
|| (t0 != null && t0.isAlive());
}
@@ -2710,6 +2703,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
// only run if we aren't already displaying one of these.
addDialogThread(serviceChangedDialog = new Runnable()
{
+ @Override
public void run()
{
@@ -2737,20 +2731,16 @@ public class Desktop extends jalview.jbgui.GDesktop implements
*
* jd.waitForInput();
*/
- JOptionPane
- .showConfirmDialog(
- Desktop.desktop,
- new JLabel(
- ""
- + "It may be that you have invalid JABA URLs
in your web service preferences,"
- + "
or as a command-line argument, or mis-configured HTTP proxy settings.
"
- + "Check the Connections and Web services tab
of the"
- + " Tools->Preferences dialog box to change them.
"),
- "Web Service Configuration Problem",
- JOptionPane.DEFAULT_OPTION,
- JOptionPane.ERROR_MESSAGE);
+ JvOptionPane.showConfirmDialog(Desktop.desktop,
+ new JLabel(""
+ + "It may be that you have invalid JABA URLs
in your web service preferences,"
+ + "
or as a command-line argument, or mis-configured HTTP proxy settings.
"
+ + "Check the Connections and Web services tab
of the"
+ + " Tools->Preferences dialog box to change them.
"),
+ "Web Service Configuration Problem",
+ JvOptionPane.DEFAULT_OPTION,
+ JvOptionPane.ERROR_MESSAGE);
serviceChangedDialog = null;
}
@@ -2759,8 +2749,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
else
{
- Cache.log
- .error("Errors reported by JABA discovery service. Check web services preferences.\n"
+ Cache.log.error(
+ "Errors reported by JABA discovery service. Check web services preferences.\n"
+ ermsg);
}
}
@@ -2793,24 +2783,25 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
new Thread(new Runnable()
{
+ @Override
public void run()
{
try
{
if (progress != null)
{
- progress.setProgressBar(MessageManager.formatMessage(
- "status.opening_params", new Object[] { url }), this
- .hashCode());
+ progress.setProgressBar(MessageManager
+ .formatMessage("status.opening_params", new Object[]
+ { url }), this.hashCode());
}
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager
.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
- JOptionPane.WARNING_MESSAGE);
+ JvOptionPane.WARNING_MESSAGE);
ex.printStackTrace();
}
@@ -2857,8 +2848,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
}
else
{
- System.err.println("Couldn't handle string " + url
- + " as a URL.");
+ System.err.println(
+ "Couldn't handle string " + url + " as a URL.");
}
}
// ignore any exceptions due to dud links.
@@ -2882,6 +2873,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements
*/
private java.util.concurrent.Semaphore block = new Semaphore(0);
+ private static groovy.ui.Console groovyConsole;
+
/**
* add another dialog thread to the queue
*
@@ -2891,6 +2884,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements
{
dialogExecutor.submit(new Runnable()
{
+ @Override
public void run()
{
if (dialogPause)
@@ -2901,7 +2895,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements
} catch (InterruptedException x)
{
}
- ;
}
if (instance == null)
{
@@ -2926,27 +2919,39 @@ public class Desktop extends jalview.jbgui.GDesktop implements
block.release();
}
+ /**
+ * Outputs an image of the desktop to file in EPS format, after prompting the
+ * user for choice of Text or Lineart character rendering (unless a preference
+ * has been set). The file name is generated as
+ *
+ *
+ * Jalview_snapshot_nnnnn.eps where nnnnn is the current timestamp in milliseconds
+ *
+ */
@Override
protected void snapShotWindow_actionPerformed(ActionEvent e)
{
+ // currently the menu option to do this is not shown
invalidate();
- File of;
- ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS,
- "View of Desktop", getWidth(), getHeight(), of = new File(
- "Jalview_snapshot" + System.currentTimeMillis()
- + ".eps"), "View of desktop");
- try
- {
- paintAll(im.getGraphics());
- im.writeImage();
- } catch (Exception q)
+
+ int width = getWidth();
+ int height = getHeight();
+ File of = new File(
+ "Jalview_snapshot_" + System.currentTimeMillis() + ".eps");
+ ImageWriterI writer = new ImageWriterI()
{
- Cache.log.error("Couldn't write snapshot to " + of.getAbsolutePath(),
- q);
- return;
- }
- Cache.log.info("Successfully written snapshot to file "
- + of.getAbsolutePath());
+ @Override
+ public void exportImage(Graphics g) throws Exception
+ {
+ paintAll(g);
+ Cache.log.info("Successfully written snapshot to file "
+ + of.getAbsolutePath());
+ }
+ };
+ String title = "View of desktop";
+ ImageExporter exporter = new ImageExporter(writer, null, TYPE.EPS,
+ title);
+ exporter.doExport(of, this, width, height, title);
}
/**
@@ -3047,9 +3052,9 @@ public class Desktop extends jalview.jbgui.GDesktop implements
AlignFrame myBottomFrame = (AlignFrame) source.getBottomFrame();
myTopFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(),
source.getY(), myTopFrame.getWidth(), myTopFrame.getHeight()));
- myBottomFrame.viewport.setExplodedGeometry(new Rectangle(source.getX(),
- source.getY(), myBottomFrame.getWidth(), myBottomFrame
- .getHeight()));
+ myBottomFrame.viewport
+ .setExplodedGeometry(new Rectangle(source.getX(), source.getY(),
+ myBottomFrame.getWidth(), myBottomFrame.getHeight()));
myTopFrame.viewport.setGatherViewsHere(true);
myBottomFrame.viewport.setGatherViewsHere(true);
String topViewId = myTopFrame.viewport.getSequenceSetId();
@@ -3074,10 +3079,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements
gatherThis = true;
topPanel.av.setGatherViewsHere(false);
bottomPanel.av.setGatherViewsHere(false);
- topPanel.av.setExplodedGeometry(new Rectangle(sf.getLocation(),
- topFrame.getSize()));
- bottomPanel.av.setExplodedGeometry(new Rectangle(sf
- .getLocation(), bottomFrame.getSize()));
+ topPanel.av.setExplodedGeometry(
+ new Rectangle(sf.getLocation(), topFrame.getSize()));
+ bottomPanel.av.setExplodedGeometry(
+ new Rectangle(sf.getLocation(), bottomFrame.getSize()));
myTopFrame.addAlignmentPanel(topPanel, false);
myBottomFrame.addAlignmentPanel(bottomPanel, false);
}
@@ -3096,17 +3101,313 @@ public class Desktop extends jalview.jbgui.GDesktop implements
* The dust settles...give focus to the tab we did this from.
*/
myTopFrame.setDisplayedView(myTopFrame.alignPanel);
+ }
+
+ public static groovy.ui.Console getGroovyConsole()
+ {
+ return groovyConsole;
+ }
+
+ /**
+ * handles the payload of a drag and drop event.
+ *
+ * TODO refactor to desktop utilities class
+ *
+ * @param files
+ * - Data source strings extracted from the drop event
+ * @param protocols
+ * - protocol for each data source extracted from the drop event
+ * @param evt
+ * - the drop event
+ * @param t
+ * - the payload from the drop event
+ * @throws Exception
+ */
+ public static void transferFromDropTarget(List