From: BobHanson Date: Tue, 16 Jun 2020 04:23:26 +0000 (-0500) Subject: JAL-3446 CommandLineOperation test X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1688c73aeb8156c46871371e30c4dc04afde01e5;p=jalview.git JAL-3446 CommandLineOperation test - cleaner headless check when adding JInternalFrame to Desktop instance. --- diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index d4f479a..2f76eba 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -121,7 +121,6 @@ import jalview.util.BrowserLauncher; import jalview.util.ImageMaker.TYPE; import jalview.util.MessageManager; import jalview.util.Platform; -import jalview.util.ShortcutKeyMaskExWrapper; import jalview.util.UrlConstants; import jalview.viewmodel.AlignmentViewport; import jalview.ws.params.ParamManager; @@ -842,12 +841,7 @@ public class Desktop extends GDesktop { // 58 classes - setFrame(frame, title, w, h); - - // Headless operation has no Desktop instance, only the static class. - - if (getInstance() != null) - getInstance().addFrame(frame, Desktop.FRAME_MAKE_VISIBLE, + addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h, FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300); } @@ -875,9 +869,18 @@ public class Desktop extends GDesktop final JInternalFrame frame, String title, boolean makeVisible, int w, int h, boolean resizable, boolean ignoreMinSize) { - // 15 classes - setFrame(frame, title, w, h); + // 15 classes call this method directly. + + // TODO: allow callers to determine X and Y position of frame (eg. via + // bounds object). + // TODO: consider fixing method to update entries in the window submenu with + // the current window title + frame.setTitle(title); + if (frame.getWidth() < 1 || frame.getHeight() < 1) + { + frame.setSize(w, h); + } if (getInstance() != null) getInstance().addFrame(frame, makeVisible, resizable, ignoreMinSize); @@ -896,21 +899,6 @@ public class Desktop extends GDesktop public final static boolean FRAME_ALLOW_ANY_SIZE = true; public final static boolean FRAME_SET_MIN_SIZE_300 = false; - - private static void setFrame(JInternalFrame frame, String title, - int w, int h) - { - // TODO: allow callers to determine X and Y position of frame (eg. via - // bounds object). - // TODO: consider fixing method to update entries in the window submenu with - // the current window title - - frame.setTitle(title); - if (frame.getWidth() < 1 || frame.getHeight() < 1) - { - frame.setSize(w, h); - } - } private void addFrame(JInternalFrame frame, boolean makeVisible, boolean resizable,