"resize") != "none");
Desktop.addInternalFrame(frame, MessageManager
.formatMessage("label.overview_params", new Object[]
- { this.getTitle() }), true, dim.width, dim.height, resizable,
- true);
+ { this.getTitle() }), Desktop.FRAME_MAKE_VISIBLE, dim.width, dim.height, resizable,
+ Desktop.FRAME_ALLOW_ANY_SIZE);
frame.pack();
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.addInternalFrameListener(
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Desktop.addInternalFrame(frame,
- MessageManager.getString("label.choose_annotations"),
- MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true);
+ MessageManager.getString("label.choose_annotations"), Desktop.FRAME_MAKE_VISIBLE,
+ MY_FRAME_WIDTH, MY_FRAME_HEIGHT, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300);
}
protected void setShowSelected(boolean showSelected)
frame.setContentPane(this);
frame.setLayer(JLayeredPane.PALETTE_LAYER);
Dimension preferredSize = frame.getPreferredSize();
- Desktop.addInternalFrame(frame, "", true, preferredSize.width,
- preferredSize.height, true, true);
+ Desktop.addInternalFrame(frame, "", Desktop.FRAME_MAKE_VISIBLE, preferredSize.width,
+ preferredSize.height, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_ALLOW_ANY_SIZE);
}
/**
title = title + " (" + af.getViewport().getViewName() + ")";
}
- Desktop.addInternalFrame(frame, title, width, height, false);
+ Desktop.addInternalFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, width, height, Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_SET_MIN_SIZE_300);
calcChoicePanel.doLayout();
revalidate();
/*
experimentalFeatures.setSelected(showExperimental());
-
checkURLLinks();
// Spawn a thread that shows the splashscreen
public void run()
{
long now = System.currentTimeMillis();
- setProgressBar(
- MessageManager.getString("status.refreshing_news"), now);
+ setProgressBar(MessageManager.getString("status.refreshing_news"),
+ now);
jvnews.refreshNews();
setProgressBar(null, now);
jvnews.showNews();
}
}
- /**
- * Adds and opens the given frame to the desktop
- *
- * @param frame
- * Frame to show
- * @param title
- * Visible Title
- * @param w
- * width
- * @param h
- * height
- */
- public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, int w, int h)
- {
- addInternalFrame(frame, title, true, w, h, true, false);
- }
-
- /**
- * 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
- */
- public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, boolean makeVisible,
- int w, int h)
- {
- addInternalFrame(frame, title, makeVisible, w, h, true, false);
- }
+// /**
+// * Add an internal frame to the Jalview desktop that is allowed to be resized,
+// * has a minimum size of 300px and might or might not be visible
+// *
+// * @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
+// */
+// @Deprecated
+// public static synchronized void addInternalFrame(
+// final JInternalFrame frame, String title, boolean makeVisible,
+// int w, int h)
+// {
+// // textbox, web services, sequenceFetcher, featureSettings
+// getInstance().addFrame(frame, title, makeVisible, w, h,
+// FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300);
+// }
+//
+// /**
+// * Add an internal frame to the Jalview desktop that is visible, has a minimum
+// * size of 300px, and may or may not be resizable
+// *
+// * @param frame
+// * Frame to show
+// * @param title
+// * Visible Title
+// * @param w
+// * width
+// * @param h
+// * height
+// * @param resizable
+// * Allow resize
+// */
+// @Deprecated
+// public static synchronized void addInternalFrame(
+// final JInternalFrame frame, String title, int w, int h,
+// boolean resizable)
+// {
+// // annotation, font, calculation, user-defined colors
+// getInstance().addFrame(frame, title, FRAME_MAKE_VISIBLE, w, h,
+// resizable, FRAME_SET_MIN_SIZE_300);
+// }
/**
- * Add an internal frame to the Jalview desktop and make it visible
+ * Adds and opens the given frame to the desktop that is visible, allowed to
+ * resize, and has a 300px minimum width.
*
* @param frame
* Frame to show
* width
* @param h
* height
- * @param resizable
- * Allow resize
*/
public static synchronized void addInternalFrame(
- final JInternalFrame frame, String title, int w, int h,
- boolean resizable)
+ final JInternalFrame frame, String title, int w, int h)
{
- addInternalFrame(frame, title, true, w, h, resizable, false);
+ // 58 classes
+ getInstance().addFrame(frame, title, Desktop.FRAME_MAKE_VISIBLE, w, h,
+ FRAME_ALLOW_RESIZE, FRAME_SET_MIN_SIZE_300);
}
/**
- * Add an internal frame to the Jalview desktop
+ * Add an internal frame to the Jalview desktop that may optionally be
+ * visible, resizable, and allowed to be any size
*
* @param frame
* Frame to show
final JInternalFrame frame, String title, boolean makeVisible,
int w, int h, boolean resizable, boolean ignoreMinSize)
{
-
- getInstance().addFrame(frame, title, makeVisible, w, h, resizable, ignoreMinSize);
+ // 15 classes
+ getInstance().addFrame(frame, title, makeVisible, w, h, resizable,
+ ignoreMinSize);
}
+
+ // These can now by put into a single int flag, if desired:
- private void addFrame(JInternalFrame frame, String title,
+ public final static boolean FRAME_MAKE_VISIBLE = true;
+
+ public final static boolean FRAME_NOT_VISIBLE = false;
+
+ public final static boolean FRAME_ALLOW_RESIZE = true;
+
+ public final static boolean FRAME_NOT_RESIZABLE = false;
+
+ public final static boolean FRAME_ALLOW_ANY_SIZE = true;
+
+ public final static boolean FRAME_SET_MIN_SIZE_300 = false;
+
+ private void addFrame(JInternalFrame frame, String title,
boolean makeVisible, int w, int h, boolean resizable,
boolean ignoreMinSize)
{
- // 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
+ // 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.setTitle(title);
+ if (frame.getWidth() < 1 || frame.getHeight() < 1)
{
frame.setSize(w, h);
}
public void internalFrameActivated(InternalFrameEvent evt)
{
JInternalFrame itf = getDesktopPane().getSelectedFrame();
- if (itf != null)
+ if (itf != null)
{
if (itf instanceof AlignFrame)
{
CutAndPasteTransfer cap = new CutAndPasteTransfer();
cap.setForInput(viewPanel);
addInternalFrame(cap,
- MessageManager.getString("label.cut_paste_alignmen_file"), true,
- 600, 500);
+ MessageManager.getString("label.cut_paste_alignmen_file"),
+ FRAME_MAKE_VISIBLE, 600, 500, FRAME_ALLOW_RESIZE,
+ FRAME_SET_MIN_SIZE_300);
}
/*
{
Cache.log.error(
"Problems whilst loading project from " + choice, ex);
- JvOptionPane.showMessageDialog( getDesktopPane(),
+ JvOptionPane.showMessageDialog(getDesktopPane(),
MessageManager.formatMessage(
"label.error_whilst_loading_project_from",
new Object[]
public static AlignmentViewport[] getViewports(String sequenceSetId)
{
List<AlignmentViewport> viewp = new ArrayList<>();
- if ( getDesktopPane() != null)
+ if (getDesktopPane() != null)
{
AlignFrame[] frames = getAlignFrames();
return new AlignFrame[] { Jalview.getInstance().currentAlignFrame };
}
- JInternalFrame[] frames = getDesktopPane().getAllFrames();
+ JInternalFrame[] frames = getDesktopPane().getAllFrames();
if (frames == null)
{
*/
public static AlignFrame getAlignFrameFor(AlignViewportI viewport)
{
- if ( getDesktopPane() != null)
+ if (getDesktopPane() != null)
{
AlignmentPanel[] aps = getAlignmentPanels(
viewport.getSequenceSetId());
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog( getDesktopPane(),
+ JvOptionPane.showInternalMessageDialog(getDesktopPane(),
MessageManager
.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
{
return;
}
- try
+ try
{
SwingUtilities.invokeAndWait(prompter);
} catch (Exception q)
}
else
{
- Desktop.addInternalFrame(frame, title, false, bounds.width,
- bounds.height);
+ Desktop.addInternalFrame(frame, title, Desktop.FRAME_NOT_VISIBLE, bounds.width,
+ bounds.height, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300);
frame.setBounds(bounds);
frame.setVisible(true);
}
}
});
addEscapeHandler();
- Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
- true, MY_WIDTH, MY_HEIGHT, true, true);
+ Desktop.addInternalFrame(frame, MessageManager.getString("label.find"),
+ Desktop.FRAME_MAKE_VISIBLE, MY_WIDTH, MY_HEIGHT, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_ALLOW_ANY_SIZE);
searchBox.getComponent().requestFocus();
}
if (isTreeFont())
{
Desktop.addInternalFrame(frame,
- MessageManager.getString("action.change_font_tree_panel"),
- 400, 200, false);
+ MessageManager.getString("action.change_font_tree_panel"), Desktop.FRAME_MAKE_VISIBLE,
+ 400, 200, Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_SET_MIN_SIZE_300);
}
else
{
Desktop.addInternalFrame(frame,
- MessageManager.getString("action.change_font"), 380, 220,
- false);
+ MessageManager.getString("action.change_font"), Desktop.FRAME_MAKE_VISIBLE, 380, 220,
+ Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_SET_MIN_SIZE_300);
}
frame.setLayer(JLayeredPane.PALETTE_LAYER);
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
MessageManager
- .getString("label.redundancy_threshold_selection"),
- true, FRAME_WIDTH, FRAME_HEIGHT, false, true);
+ .getString("label.redundancy_threshold_selection"), Desktop.FRAME_MAKE_VISIBLE,
+ FRAME_WIDTH, FRAME_HEIGHT, Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_ALLOW_ANY_SIZE);
frame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
frame = new JInternalFrame();
frame.setContentPane(this);
- Desktop.addInternalFrame(frame, getFrameTitle(), true, 400,
- Platform.isAMacAndNotJS() ? 240 : 180);
+ Desktop.addInternalFrame(frame, getFrameTitle(), Desktop.FRAME_MAKE_VISIBLE, 400,
+ Platform.isAMacAndNotJS() ? 240 : 180, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300);
}
private String getFrameTitle()
if (!conservationSlider.isVisible())
{
Desktop.addInternalFrame(conservationSlider,
- conservationSlider.getTitle(), true, FRAME_WIDTH,
- FRAME_HEIGHT, false, true);
+ conservationSlider.getTitle(), Desktop.FRAME_MAKE_VISIBLE, FRAME_WIDTH,
+ FRAME_HEIGHT, Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_ALLOW_ANY_SIZE);
conservationSlider.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
if (!PIDSlider.isVisible())
{
- Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), true,
- FRAME_WIDTH, FRAME_HEIGHT, false, true);
+ Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), Desktop.FRAME_MAKE_VISIBLE,
+ FRAME_WIDTH, FRAME_HEIGHT, Desktop.FRAME_NOT_RESIZABLE, Desktop.FRAME_ALLOW_ANY_SIZE);
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
PIDSlider.addInternalFrameListener(new InternalFrameAdapter()
{
frame = new JInternalFrame();
frame.setContentPane(this);
Desktop.addInternalFrame(frame,
- MessageManager.getString("label.user_defined_colours"),
- MY_FRAME_WIDTH, MY_FRAME_HEIGHT, true);
+ MessageManager.getString("label.user_defined_colours"), Desktop.FRAME_MAKE_VISIBLE,
+ MY_FRAME_WIDTH, MY_FRAME_HEIGHT, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300);
}
/**
public WebserviceInfo(String title, String info, int width, int height,
boolean makeVisible)
{
+ // no references
init(title, info, width, height, makeVisible);
}
{
frame = new JInternalFrame();
frame.setContentPane(this);
- Desktop.addInternalFrame(frame, title, makeVisible, width, height);
+ Desktop.addInternalFrame(frame, title, makeVisible, width, height, Desktop.FRAME_ALLOW_RESIZE, Desktop.FRAME_SET_MIN_SIZE_300);
frame.setClosable(false);
progressBar = new ProgressBar(statusPanel, statusBar);
WsURL = "http://www.compbio.dundee.ac.uk/JalviewWS/services/jpred";
WebserviceInfo wsInfo = new WebserviceInfo(WebServiceJobTitle,
- WebServiceReference, true);
+ WebServiceReference, Desktop.FRAME_MAKE_VISIBLE);
return wsInfo;
}
package jalview.ws.jws1;
import jalview.gui.AlignFrame;
+import jalview.gui.Desktop;
import jalview.gui.WebserviceInfo;
import jalview.util.MessageManager;
import jalview.ws.WSClient;
WebserviceInfo wsInfo = null;
if (!headless)
{
- wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference,
- true);
+ wsInfo = new WebserviceInfo(WebServiceJobTitle, WebServiceReference,
+ Desktop.FRAME_MAKE_VISIBLE);
}
return wsInfo;
}
return new WebserviceInfo(WebServiceJobTitle,
WebServiceJobTitle + " using service hosted at "
+ serv.hosturl + "\n"
- + (serv.description != null ? serv.description : ""),
- false);
+ + (serv.description != null ? serv.description : ""),
+ Desktop.FRAME_NOT_VISIBLE);
}
return null;
}
if (!headless)
{
wsInfo = new WebserviceInfo(WebServiceJobTitle,
- WebServiceName + "\n" + WebServiceReference, true);
+ WebServiceName + "\n" + WebServiceReference, Desktop.FRAME_MAKE_VISIBLE);
wsInfo.setRenderAsHtml(true);
}