/*
- * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1)
- * Copyright (C) 2009 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5)
+ * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * This file is part of Jalview.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
*/
package jalview.gui;
desktop.setDesktopManager(new DefaultDesktopManager());
Rectangle dims = getLastKnownDimensions("");
- if (dims!=null)
- {
+ if (dims != null)
+ {
setBounds(dims);
}
else
}
jconsole = new Console(this);
// immediately output essential build information
- System.out.println("Jalview Desktop "+jalview.bin.Cache.getProperty("VERSION")+"\n"
- +"Build Date: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")+"\n"
- + "Java version: " + System.getProperty("java.version")
- + "\n"+System.getProperty("os.arch") + " "
+ System.out.println("Jalview Desktop "
+ + jalview.bin.Cache.getProperty("VERSION") + "\n"
+ + "Build Date: "
+ + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ + "Java version: " + System.getProperty("java.version") + "\n"
+ + System.getProperty("os.arch") + " "
+ System.getProperty("os.name") + " "
+ System.getProperty("os.version"));
-
+
showConsole(showjconsole);
this.addWindowListener(new WindowAdapter()
discoverer = new jalview.ws.Discoverer(); // Only gets started if gui is
// displayed.
+ // Thread off a new instance of the file chooser - this reduces the time it
+ // takes to open it later on.
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ Cache.log.debug("Filechooser init thread started.");
+ JalviewFileChooser chooser = new JalviewFileChooser(
+ jalview.bin.Cache.getProperty("LAST_DIRECTORY"),
+ jalview.io.AppletFormatAdapter.READABLE_EXTENSIONS,
+ jalview.io.AppletFormatAdapter.READABLE_FNAMES,
+ jalview.bin.Cache.getProperty("DEFAULT_FILE_FORMAT"));
+ Cache.log.debug("Filechooser init thread finished.");
+ }
+ }).start();
}
/**
* recover the last known dimensions for a jalview window
+ *
* @param windowName
* - empty string is desktop, all other windows have unique prefix
* @return null or last known dimensions scaled to current geometry (if last
// attempt #1 - try to cope with change in screen geometry - this
// version doesn't preserve original jv aspect ratio.
// take ratio of current screen size vs original screen size.
- double sw = ( (1f*screenSize.width)
- / (1f*Integer.parseInt(jalview.bin.Cache
- .getProperty("SCREENGEOMETRY_WIDTH"))))
- ;
- double sh = ( (1f*screenSize.height)
- / (1f*Integer.parseInt(jalview.bin.Cache
+ double sw = ((1f * screenSize.width) / (1f * Integer
+ .parseInt(jalview.bin.Cache
+ .getProperty("SCREENGEOMETRY_WIDTH"))));
+ double sh = ((1f * screenSize.height) / (1f * Integer
+ .parseInt(jalview.bin.Cache
.getProperty("SCREENGEOMETRY_HEIGHT"))));
// rescale the bounds depending upon the current screen geometry.
ix = (int) (ix * sw);
iw = (int) (iw * sw);
iy = (int) (iy * sh);
ih = (int) (ih * sh);
- jalview.bin.Cache.log.debug("Got last known dimensions for "+windowName+": x:"+ix + " y:"+iy + " width:"+iw+" height:"+ih);
+ jalview.bin.Cache.log.debug("Got last known dimensions for "
+ + windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ + " height:" + ih);
}
- // return dimensions for new instance
+ // return dimensions for new instance
return new Rectangle(ix, iy, iw, ih);
}
return null;
}
/**
- * DOCUMENT ME!
+ * Adds and opens the given frame to the desktop
*
* @param frame
* DOCUMENT ME!
boolean resizable)
{
+ // 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
.setProperty("SCREENGEOMETRY_WIDTH", screen.width + "");
jalview.bin.Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height
+ "");
- storeLastKnownDimensions("",new Rectangle(getBounds().x,getBounds().y, getWidth(), getHeight()));
+ storeLastKnownDimensions("", new Rectangle(getBounds().x,
+ getBounds().y, getWidth(), getHeight()));
if (jconsole != null)
{
- storeLastKnownDimensions("JAVA_CONSOLE_",jconsole.getBounds());
+ storeLastKnownDimensions("JAVA_CONSOLE_", jconsole.getBounds());
jconsole.stopConsole();
}
System.exit(0);
private void storeLastKnownDimensions(String string, Rectangle jc)
{
- jalview.bin.Cache.log.debug("Storing last known dimensions for "+string+": x:"+jc.x + " y:"+jc.y + " width:"+jc.width+" height:"+jc.height);
-
- jalview.bin.Cache.setProperty(string+"SCREEN_X",jc.x + "");
- jalview.bin.Cache.setProperty(string+"SCREEN_Y", jc.y + "");
- jalview.bin.Cache.setProperty(string+"SCREEN_WIDTH", jc.width + "");
- jalview.bin.Cache.setProperty(string+"SCREEN_HEIGHT", jc.height
- + "");
+ jalview.bin.Cache.log.debug("Storing last known dimensions for "
+ + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width
+ + " height:" + jc.height);
+
+ jalview.bin.Cache.setProperty(string + "SCREEN_X", jc.x + "");
+ jalview.bin.Cache.setProperty(string + "SCREEN_Y", jc.y + "");
+ jalview.bin.Cache.setProperty(string + "SCREEN_WIDTH", jc.width + "");
+ jalview.bin.Cache.setProperty(string + "SCREEN_HEIGHT", jc.height + "");
}
/**
if (percentUsage < 20)
g.setColor(Color.red);
FontMetrics fm = g.getFontMetrics();
- if (fm!=null)
- { g.drawString("Total Free Memory: " + df.format(totalFreeMemory)
- + "MB; Max Memory: " + df.format(maxMemory) + "MB; "
- + df.format(percentUsage) + "%", 10, getHeight()
- - fm.getHeight());
+ if (fm != null)
+ {
+ g.drawString("Total Free Memory: " + df.format(totalFreeMemory)
+ + "MB; Max Memory: " + df.format(maxMemory) + "MB; "
+ + df.format(percentUsage) + "%", 10, getHeight()
+ - fm.getHeight());
}
}
}