X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=15540797f635b3b7e64e4bcc235fcf22a0041a6f;hb=2810f6cc6d3d820dde63b324efb1c8119ec2a818;hp=6b7a278a678c556569446944429874b1ff0acb6d;hpb=a4aa14220a6a53391ca8e171bc774cef908057a3;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 6b7a278..1554079 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -46,7 +46,6 @@ import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.util.UrlConstants; -import jalview.util.dialogrunner.RunResponse; import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ParamManager; import jalview.ws.utils.UrlDownloadClient; @@ -89,7 +88,6 @@ import java.util.ArrayList; import java.util.Hashtable; import java.util.List; import java.util.ListIterator; -import java.util.StringTokenizer; import java.util.Vector; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -346,12 +344,13 @@ public class Desktop extends jalview.jbgui.GDesktop */ public Desktop() { + super(); /** * A note to implementors. It is ESSENTIAL that any activities that might block * are spawned off as threads rather than waited for during this constructor. */ instance = this; - if (!Jalview.isJS()) + if (!Platform.isJS()) { doVamsasClientCheck(); } @@ -375,12 +374,9 @@ public class Desktop extends jalview.jbgui.GDesktop // getContentPane().add(sp, BorderLayout.CENTER); // BH 2018 - just an experiment to try unclipped JInternalFrames. - // Must set for all three to be active: - if (Jalview.isJS()) + if (Platform.isJS()) { getRootPane().putClientProperty("swingjs.overflow.hidden", "false"); - ((JComponent) getContentPane()).putClientProperty("swingjs.overflow.hidden", "false"); - desktop.putClientProperty("swingjs.overflow.hidden", "false"); } getContentPane().add(desktop, BorderLayout.CENTER); @@ -389,8 +385,8 @@ public class Desktop extends jalview.jbgui.GDesktop // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised desktop.setDesktopManager(new MyDesktopManager( - (Platform.isWindows() ? new DefaultDesktopManager() - : Platform.isAMac() + (Platform.isWindowsAndNotJS() ? new DefaultDesktopManager() + : Platform.isAMacAndNotJS() ? new AquaInternalFrameManager( desktop.getDesktopManager()) : desktop.getDesktopManager()))); @@ -408,7 +404,7 @@ public class Desktop extends jalview.jbgui.GDesktop setBounds(xPos, yPos, 900, 650); } - boolean doFullLoad = /** @j2sNative ! */true; + boolean doFullLoad = !Platform.isJS(); if (doFullLoad) { @@ -886,8 +882,7 @@ public class Desktop extends jalview.jbgui.GDesktop frame.setResizable(resizable); frame.setMaximizable(resizable); frame.setIconifiable(resizable); - frame.setOpaque(/** @j2sNative true || */ - false); + frame.setOpaque(Platform.isJS()); // BH this should not be necessary if (frame.getX() < 1 && frame.getY() < 1) { @@ -1125,9 +1120,8 @@ public class Desktop extends jalview.jbgui.GDesktop MessageManager.getString("label.open_local_file")); chooser.setToolTipText(MessageManager.getString("action.open")); - chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION) + chooser.setResponseHandler(0, new Runnable() { - @Override public void run() { @@ -1183,7 +1177,7 @@ public class Desktop extends jalview.jbgui.GDesktop */ JComponent history; String urlBase = "http://www."; - if (Jalview.isJS()) + if (Platform.isJS()) { history = new JTextField(urlBase, 35); } @@ -1207,11 +1201,11 @@ public class Desktop extends jalview.jbgui.GDesktop Object[] options = new Object[] { MessageManager.getString("action.ok"), MessageManager.getString("action.cancel") }; - RunResponse action = new RunResponse(JvOptionPane.OK_OPTION) { + Runnable action = new Runnable() { @Override public void run() { - String url = Jalview.isJS() ? ((JTextField) history).getText() + String url = Platform.isJS() ? ((JTextField) history).getText() : ((JComboBox) history).getSelectedItem() .toString(); @@ -1263,7 +1257,7 @@ public class Desktop extends jalview.jbgui.GDesktop }}; String dialogOption = MessageManager .getString("label.input_alignment_from_url"); - JvOptionPane.newOptionDialog(desktop).addResponse(action) + JvOptionPane.newOptionDialog(desktop).setResponseHandler(0, action) .showInternalDialog(panel, dialogOption, JvOptionPane.YES_NO_CANCEL_OPTION, JvOptionPane.PLAIN_MESSAGE, null, options, @@ -1436,7 +1430,7 @@ public class Desktop extends jalview.jbgui.GDesktop { try { - if (Jalview.isJS()) + if (Platform.isJS()) { BrowserLauncher.openURL("http://www.jalview.org/help.html"); } @@ -1746,14 +1740,14 @@ public class Desktop extends jalview.jbgui.GDesktop "Jalview Project"); chooser.setFileView(new JalviewFileView()); chooser.setDialogTitle(MessageManager.getString("label.restore_state")); - chooser.addResponse(new RunResponse(JalviewFileChooser.APPROVE_OPTION) + chooser.setResponseHandler(0, new Runnable() { @Override public void run() { File selectedFile = chooser.getSelectedFile(); setProjectFile(selectedFile); - final String choice = selectedFile.getAbsolutePath(); + String choice = selectedFile.getAbsolutePath(); Cache.setProperty("LAST_DIRECTORY", selectedFile.getParent()); new Thread(new Runnable() { @@ -1767,7 +1761,7 @@ public class Desktop extends jalview.jbgui.GDesktop } else { - new jalview.project.Jalview2XML().loadJalviewAlign(choice); + new jalview.project.Jalview2XML().loadJalviewAlign(selectedFile); } } catch (OutOfMemoryError oom) { @@ -2092,7 +2086,7 @@ public class Desktop extends jalview.jbgui.GDesktop /** * import file into a new vamsas session (uses jalview.gui.VamsasApplication) * - * @param file + * @param fileName * @return true if import was a success and a session was started. */ public boolean vamsasImport(URL url) @@ -3481,7 +3475,7 @@ public class Desktop extends jalview.jbgui.GDesktop } else { - if (Platform.isAMac()) + if (Platform.isAMacAndNotJS()) { System.err.println( "Please ignore plist error - occurs due to problem with java 8 on OSX"); @@ -3598,8 +3592,7 @@ public class Desktop extends jalview.jbgui.GDesktop } } } - if (Platform.isWindows()) - + if (Platform.isWindowsAndNotJS()) { Cache.log.debug("Scanning dropped content for Windows Link Files");