X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FDesktop.java;h=d076ba06a9d601da326fe76f71554463a84ea04c;hb=62d2ca926e73609acc4c2a50676f2010c6e3e343;hp=32e5f6438b7e5eccd568b3ff3c72e40d1dec0c37;hpb=dfa39e09cf3ffa44cc1e764bfa72900bab96136d;p=jalview.git diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 32e5f64..d076ba0 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -129,6 +129,15 @@ public class Desktop extends jalview.jbgui.GDesktop implements DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider { + private static int DEFAULT_MIN_WIDTH = 300; + + private static int DEFAULT_MIN_HEIGHT = 250; + + private static int ALIGN_FRAME_DEFAULT_MIN_WIDTH = 600; + + private static int ALIGN_FRAME_DEFAULT_MIN_HEIGHT = 70; + + private static final String EXPERIMENTAL_FEATURES = "EXPERIMENTAL_FEATURES"; private JalviewChangeSupport changeSupport = new JalviewChangeSupport(); @@ -327,19 +336,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements instance = this; doVamsasClientCheck(); - groovyShell = new JMenuItem(); - groovyShell.setText(MessageManager.getString("label.groovy_console")); - groovyShell.addActionListener(new ActionListener() - { - @Override - public void actionPerformed(ActionEvent e) - { - groovyShell_actionPerformed(); - } - }); - toolsMenu.add(groovyShell); - groovyShell.setVisible(true); - doConfigureStructurePrefs(); setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION")); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); @@ -394,6 +390,8 @@ public class Desktop extends jalview.jbgui.GDesktop implements showConsole(showjconsole); showNews.setVisible(false); + + experimentalFeatures.setSelected(showExperimental()); getIdentifiersOrgData(); @@ -490,6 +488,19 @@ public class Desktop extends jalview.jbgui.GDesktop implements }); } + /** + * Answers true if user preferences to enable experimental features is True + * (on), else false + * + * @return + */ + public boolean showExperimental() + { + String experimental = Cache.getDefault(EXPERIMENTAL_FEATURES, + Boolean.FALSE.toString()); + return Boolean.valueOf(experimental).booleanValue(); + } + public void doConfigureStructurePrefs() { // configure services @@ -742,7 +753,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements public static synchronized void addInternalFrame( final JInternalFrame frame, String title, int w, int h) { - addInternalFrame(frame, title, true, w, h, true); + addInternalFrame(frame, title, true, w, h, true, false); } /** @@ -764,7 +775,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements final JInternalFrame frame, String title, boolean makeVisible, int w, int h) { - addInternalFrame(frame, title, makeVisible, w, h, true); + addInternalFrame(frame, title, makeVisible, w, h, true, false); } /** @@ -785,7 +796,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements final JInternalFrame frame, String title, int w, int h, boolean resizable) { - addInternalFrame(frame, title, true, w, h, resizable); + addInternalFrame(frame, title, true, w, h, resizable, false); } /** @@ -804,10 +815,12 @@ public class Desktop extends jalview.jbgui.GDesktop implements * height * @param resizable * Allow resize + * @param ignoreMinSize + * Do not set the default minimum size for frame */ public static synchronized void addInternalFrame( final JInternalFrame frame, String title, boolean makeVisible, - int w, int h, boolean resizable) + int w, int h, boolean resizable, boolean ignoreMinSize) { // TODO: allow callers to determine X and Y position of frame (eg. via @@ -833,6 +846,23 @@ public class Desktop extends jalview.jbgui.GDesktop implements openFrameCount++; + if (!ignoreMinSize) + { + frame.setMinimumSize(new Dimension(DEFAULT_MIN_WIDTH, + DEFAULT_MIN_HEIGHT)); + + // Set default dimension for Alignment Frame window. + // The Alignment Frame window could be added from a number of places, + // hence, + // I did this here in order not to miss out on any Alignment frame. + if (frame instanceof AlignFrame) + { + frame.setMinimumSize(new Dimension(ALIGN_FRAME_DEFAULT_MIN_WIDTH, + ALIGN_FRAME_DEFAULT_MIN_HEIGHT)); + } + } + + frame.setVisible(makeVisible); frame.setClosable(true); frame.setResizable(resizable); @@ -2492,8 +2522,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements } - protected JMenuItem groovyShell; - /** * Accessor method to quickly get all the AlignmentFrames loaded. * @@ -2579,6 +2607,7 @@ public class Desktop extends jalview.jbgui.GDesktop implements /** * Add Groovy Support to Jalview */ + @Override public void groovyShell_actionPerformed() { try @@ -2875,8 +2904,6 @@ public class Desktop extends jalview.jbgui.GDesktop implements || (t2 != null && t2.isAlive()) || (t3 != null && t3.isAlive()) || (t0 != null && t0.isAlive()); - // could just as easily ask discoverer if it is still running instead of - // holding ref to thread } } } @@ -3395,4 +3422,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements } } } + + /** + * Sets the Preferences property for experimental features to True or False + * depending on the state of the controlling menu item + */ + @Override + protected void showExperimental_actionPerformed(boolean selected) + { + Cache.setProperty(EXPERIMENTAL_FEATURES, Boolean.toString(selected)); + } }