From: Jim Procter Date: Fri, 28 Nov 2014 13:58:51 +0000 (+0000) Subject: JAL-1583 refactored addInternalFrame to allow webservice job frame to be added but... X-Git-Tag: Jalview_2_9~136^2~12 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9702a30021c1387018378b61948b639358213942;p=jalview.git JAL-1583 refactored addInternalFrame to allow webservice job frame to be added but not automatically made visible --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index fea381d..b8f629a 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -631,38 +631,85 @@ public class Desktop extends jalview.jbgui.GDesktop implements * Adds and opens the given frame to the desktop * * @param frame - * DOCUMENT ME! + * Frame to show * @param title - * DOCUMENT ME! + * Visible Title * @param w - * DOCUMENT ME! + * width * @param h - * DOCUMENT ME! + * height */ public static synchronized void addInternalFrame( final JInternalFrame frame, String title, int w, int h) { - addInternalFrame(frame, title, w, h, true); + addInternalFrame(frame, title, true, w, h, true); } + /** - * DOCUMENT ME! + * Add an internal frame to the Jalview desktop * * @param frame - * DOCUMENT ME! + * Frame to show * @param title - * DOCUMENT ME! + * Visible Title + * @param makeVisible + * When true, display frame immediately, otherwise, caller must call + * setVisible themselves. * @param w - * DOCUMENT ME! + * width * @param h - * DOCUMENT ME! + * height + */ + public static synchronized void addInternalFrame( + final JInternalFrame frame, String title, boolean makeVisible, + int w, int h) + { + addInternalFrame(frame, title, makeVisible, w, h, true); + } + + /** + * Add an internal frame to the Jalview desktop and make it visible + * + * @param frame + * Frame to show + * @param title + * Visible Title + * @param w + * width + * @param h + * height * @param resizable - * DOCUMENT ME! + * Allow resize */ public static synchronized void addInternalFrame( final JInternalFrame frame, String title, int w, int h, boolean resizable) { + addInternalFrame(frame, title, true, w, h, resizable); + } + + /** + * Add an internal frame to the Jalview desktop + * + * @param frame + * Frame to show + * @param title + * Visible Title + * @param makeVisible + * When true, display frame immediately, otherwise, caller must call + * setVisible themselves. + * @param w + * width + * @param h + * height + * @param resizable + * Allow resize + */ + public static synchronized void addInternalFrame( + final JInternalFrame frame, String title, boolean makeVisible, + int w, int h, boolean resizable) + { // TODO: allow callers to determine X and Y position of frame (eg. via // bounds object). @@ -687,7 +734,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements openFrameCount++; - frame.setVisible(true); + frame.setVisible(makeVisible); frame.setClosable(true); frame.setResizable(resizable); frame.setMaximizable(resizable); diff --git a/src/jalview/gui/WebserviceInfo.java b/src/jalview/gui/WebserviceInfo.java index 8c06771..aaaca20 100644 --- a/src/jalview/gui/WebserviceInfo.java +++ b/src/jalview/gui/WebserviceInfo.java @@ -97,6 +97,13 @@ public class WebserviceInfo extends GWebserviceInfo implements JInternalFrame frame; + @Override + public void setVisible(boolean aFlag) + { + super.setVisible(aFlag); + frame.setVisible(aFlag); + }; + JTabbedPane subjobs = null; java.util.Vector jobPanes = null; @@ -230,9 +237,9 @@ public class WebserviceInfo extends GWebserviceInfo implements * @param info * reference or other human readable description */ - public WebserviceInfo(String title, String info) + public WebserviceInfo(String title, String info, boolean makeVisible) { - init(title, info, 520, 500); + init(title, info, 520, 500, makeVisible); } /** @@ -247,9 +254,10 @@ public class WebserviceInfo extends GWebserviceInfo implements * @param height * DOCUMENT ME! */ - public WebserviceInfo(String title, String info, int width, int height) + public WebserviceInfo(String title, String info, int width, int height, + boolean makeVisible) { - init(title, info, width, height); + init(title, info, width, height, makeVisible); } /** @@ -307,11 +315,12 @@ public class WebserviceInfo extends GWebserviceInfo implements * @param height * DOCUMENT ME! */ - void init(String title, String info, int width, int height) + void init(String title, String info, int width, int height, + boolean makeVisible) { frame = new JInternalFrame(); frame.setContentPane(this); - Desktop.addInternalFrame(frame, title, width, height); + Desktop.addInternalFrame(frame, title, makeVisible, width, height); frame.setClosable(false); this.title = title; diff --git a/src/jalview/ws/jws1/JPredClient.java b/src/jalview/ws/jws1/JPredClient.java index 1c506b8..df0e091 100644 --- a/src/jalview/ws/jws1/JPredClient.java +++ b/src/jalview/ws/jws1/JPredClient.java @@ -301,7 +301,7 @@ public class JPredClient extends WS1Client WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred"; WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle, - WebServiceReference); + WebServiceReference, true); return wsInfo; } diff --git a/src/jalview/ws/jws1/WS1Client.java b/src/jalview/ws/jws1/WS1Client.java index 210e520..9001c61 100644 --- a/src/jalview/ws/jws1/WS1Client.java +++ b/src/jalview/ws/jws1/WS1Client.java @@ -92,7 +92,8 @@ public abstract class WS1Client extends WSClient implements WebserviceInfo wsInfo = null; if (!headless) { - wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference); + wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference, + true); } return wsInfo; }