import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
+import jalview.api.StructureSelectionManagerProvider;
import jalview.bin.Cache;
+import jalview.io.AppletFormatAdapter;
import jalview.io.FileLoader;
import jalview.io.FormatAdapter;
import jalview.io.IdentifyFile;
import jalview.io.JalviewFileChooser;
import jalview.io.JalviewFileView;
+import jalview.jbgui.GDesktop;
import jalview.jbgui.GSplitFrame;
import jalview.jbgui.GStructureViewer;
import jalview.structure.StructureSelectionManager;
+import jalview.util.BrowserLauncher;
import jalview.util.ImageMaker;
import jalview.util.MessageManager;
import jalview.viewmodel.AlignmentViewport;
* @author $author$
* @version $Revision: 1.155 $
*/
-public class Desktop extends jalview.jbgui.GDesktop implements
- DropTargetListener, ClipboardOwner, IProgressIndicator,
- jalview.api.StructureSelectionManagerProvider
+public class Desktop extends GDesktop implements
+ DropTargetListener,
+ ClipboardOwner, IProgressIndicator,
+ StructureSelectionManagerProvider
{
private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
doVamsasClientCheck();
doGroovyCheck();
doConfigureStructurePrefs();
- setTitle("Jalview " + jalview.bin.Cache.getProperty("VERSION"));
+ setTitle("Jalview " + Cache.getProperty("VERSION"));
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- boolean selmemusage = jalview.bin.Cache.getDefault("SHOW_MEMUSAGE",
+ boolean selmemusage = Cache.getDefault("SHOW_MEMUSAGE",
false);
- boolean showjconsole = jalview.bin.Cache.getDefault(
+ boolean showjconsole = Cache.getDefault(
"SHOW_JAVA_CONSOLE", false);
desktop = new MyDesktopPane(selmemusage);
showMemusage.setSelected(selmemusage);
jconsole = new Console(this, showjconsole);
// add essential build information
jconsole.setHeader("Jalview Version: "
- + jalview.bin.Cache.getProperty("VERSION") + "\n"
+ + Cache.getProperty("VERSION") + "\n"
+ "Jalview Installation: "
- + jalview.bin.Cache.getDefault("INSTALLATION", "unknown")
+ + Cache.getDefault("INSTALLATION", "unknown")
+ "\n" + "Build Date: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ + Cache.getDefault("BUILD_DATE", "unknown") + "\n"
+ "Java version: " + System.getProperty("java.version") + "\n"
+ System.getProperty("os.arch") + " "
+ System.getProperty("os.name") + " "
{
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.getProperty("LAST_DIRECTORY"),
+ AppletFormatAdapter.READABLE_EXTENSIONS,
+ AppletFormatAdapter.READABLE_FNAMES,
+ Cache.getProperty("DEFAULT_FILE_FORMAT"));
Cache.log.debug("Filechooser init thread finished.");
}
}).start();
// configure services
StructureSelectionManager ssm = StructureSelectionManager
.getStructureSelectionManager(this);
- if (jalview.bin.Cache.getDefault(Preferences.ADD_SS_ANN, true))
+ if (Cache.getDefault(Preferences.ADD_SS_ANN, true))
{
- ssm.setAddTempFacAnnot(jalview.bin.Cache.getDefault(
+ ssm.setAddTempFacAnnot(Cache.getDefault(
Preferences.ADD_TEMPFACT_ANN, true));
- ssm.setProcessSecondaryStructure(jalview.bin.Cache.getDefault(
+ ssm.setProcessSecondaryStructure(Cache.getDefault(
Preferences.STRUCT_FROM_PDB, true));
- ssm.setSecStructServices(jalview.bin.Cache.getDefault(
+ ssm.setSecStructServices(Cache.getDefault(
Preferences.USE_RNAVIEW, true));
}
else
{
// TODO: lock aspect ratio for scaling desktop Bug #0058199
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
- String x = jalview.bin.Cache.getProperty(windowName + "SCREEN_X");
- String y = jalview.bin.Cache.getProperty(windowName + "SCREEN_Y");
- String width = jalview.bin.Cache.getProperty(windowName
+ String x = Cache.getProperty(windowName + "SCREEN_X");
+ String y = Cache.getProperty(windowName + "SCREEN_Y");
+ String width = Cache.getProperty(windowName
+ "SCREEN_WIDTH");
- String height = jalview.bin.Cache.getProperty(windowName
+ String height = Cache.getProperty(windowName
+ "SCREEN_HEIGHT");
if ((x != null) && (y != null) && (width != null) && (height != null))
{
int ix = Integer.parseInt(x), iy = Integer.parseInt(y), iw = Integer
.parseInt(width), ih = Integer.parseInt(height);
- if (jalview.bin.Cache.getProperty("SCREENGEOMETRY_WIDTH") != null)
+ if (Cache.getProperty("SCREENGEOMETRY_WIDTH") != null)
{
// 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
+ .parseInt(Cache
.getProperty("SCREENGEOMETRY_WIDTH"))));
double sh = ((1f * screenSize.height) / (1f * Integer
- .parseInt(jalview.bin.Cache
+ .parseInt(Cache
.getProperty("SCREENGEOMETRY_HEIGHT"))));
// rescale the bounds depending upon the current screen geometry.
ix = (int) (ix * sw);
ih = (int) (ih * sh);
while (ix >= screenSize.width)
{
- jalview.bin.Cache.log
+ Cache.log
.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
ix -= screenSize.width;
}
while (iy >= screenSize.height)
{
- jalview.bin.Cache.log
+ Cache.log
.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
iy -= screenSize.height;
}
- jalview.bin.Cache.log.debug("Got last known dimensions for "
+ Cache.log.debug("Got last known dimensions for "
+ windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ " height:" + ih);
}
private void doVamsasClientCheck()
{
- if (jalview.bin.Cache.vamsasJarsPresent())
+ if (Cache.vamsasJarsPresent())
{
setupVamsasDisconnectedGui();
VamsasMenu.setVisible(true);
public void inputLocalFileMenuItem_actionPerformed(AlignViewport viewport)
{
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.getProperty("LAST_DIRECTORY"),
+ AppletFormatAdapter.READABLE_EXTENSIONS,
+ AppletFormatAdapter.READABLE_FNAMES,
+ Cache.getProperty("DEFAULT_FILE_FORMAT"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager
if (value == JalviewFileChooser.APPROVE_OPTION)
{
String choice = chooser.getSelectedFile().getPath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", chooser
+ Cache.setProperty("LAST_DIRECTORY", chooser
.getSelectedFile().getParent());
String format = null;
history.setEditable(true);
history.addItem("http://www.");
- String historyItems = jalview.bin.Cache.getProperty("RECENT_URL");
+ String historyItems = Cache.getProperty("RECENT_URL");
StringTokenizer st;
public void quit()
{
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
- jalview.bin.Cache
+ Cache
.setProperty("SCREENGEOMETRY_WIDTH", screen.width + "");
- jalview.bin.Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height
+ Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height
+ "");
storeLastKnownDimensions("", new Rectangle(getBounds().x,
getBounds().y, getWidth(), getHeight()));
private void storeLastKnownDimensions(String string, Rectangle jc)
{
- jalview.bin.Cache.log.debug("Storing last known dimensions for "
+ 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 + "");
+ Cache.setProperty(string + "SCREEN_X", jc.x + "");
+ Cache.setProperty(string + "SCREEN_Y", jc.y + "");
+ Cache.setProperty(string + "SCREEN_WIDTH", jc.width + "");
+ Cache.setProperty(string + "SCREEN_HEIGHT", jc.height + "");
}
/**
if (shortv)
{
message.append("<h1><strong>Version: "
- + jalview.bin.Cache.getProperty("VERSION") + "</strong></h1>");
+ + Cache.getProperty("VERSION") + "</strong></h1>");
message.append("<strong>Last Updated: <em>"
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown")
+ + Cache.getDefault("BUILD_DATE", "unknown")
+ "</em></strong>");
}
{
message.append("<strong>Version "
- + jalview.bin.Cache.getProperty("VERSION")
+ + Cache.getProperty("VERSION")
+ "; last updated: "
- + jalview.bin.Cache.getDefault("BUILD_DATE", "unknown"));
+ + Cache.getDefault("BUILD_DATE", "unknown"));
}
- if (jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking").equals(
+ if (Cache.getDefault("LATEST_VERSION", "Checking").equals(
"Checking"))
{
message.append("<br>...Checking latest version...</br>");
}
- else if (!jalview.bin.Cache.getDefault("LATEST_VERSION", "Checking")
- .equals(jalview.bin.Cache.getProperty("VERSION")))
+ else if (!Cache.getDefault("LATEST_VERSION", "Checking")
+ .equals(Cache.getProperty("VERSION")))
{
boolean red = false;
- if (jalview.bin.Cache.getProperty("VERSION").toLowerCase()
+ if (Cache.getProperty("VERSION").toLowerCase()
.indexOf("automated build") == -1)
{
red = true;
}
message.append("<br>!! Version "
- + jalview.bin.Cache.getDefault("LATEST_VERSION",
+ + Cache.getDefault("LATEST_VERSION",
"..Checking..")
+ " is available for download from "
- + jalview.bin.Cache.getDefault("www.jalview.org",
+ + Cache.getDefault("www.jalview.org",
"http://www.jalview.org") + " !!");
if (red)
{
}
}
message.append("<br>Authors: "
- + jalview.bin.Cache
+ + Cache
.getDefault("AUTHORFNAMES",
"The Jalview Authors (See AUTHORS file for current list)")
+ "<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.<br>"
protected void garbageCollect_actionPerformed(ActionEvent e)
{
// We simply collect the garbage
- jalview.bin.Cache.log.debug("Collecting garbage...");
+ Cache.log.debug("Collecting garbage...");
System.gc();
- jalview.bin.Cache.log.debug("Finished garbage collection.");
+ Cache.log.debug("Finished garbage collection.");
}
/*
public void saveState_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "jvp" }, new String[]
{ "Jalview Project" }, "Jalview Project");
setProgressBar(MessageManager.formatMessage(
"label.saving_jalview_project", new Object[]
{ choice.getName() }), choice.hashCode());
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ Cache.setProperty("LAST_DIRECTORY",
choice.getParent());
// TODO catch and handle errors for savestate
// TODO prevent user from messing with the Desktop whilst we're saving
public void loadState_actionPerformed(ActionEvent e)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "jvp", "jar" }, new String[]
{ "Jalview Project", "Jalview Project (old)" },
"Jalview Project");
final File selectedFile = chooser.getSelectedFile();
setProjectFile(selectedFile);
final String choice = selectedFile.getAbsolutePath();
- jalview.bin.Cache.setProperty("LAST_DIRECTORY",
+ Cache.setProperty("LAST_DIRECTORY",
selectedFile.getParent());
new Thread(new Runnable()
{
}
- jalview.gui.VamsasApplication v_client = null;
+ VamsasApplication v_client = null;
public void vamsasImport_actionPerformed(ActionEvent e)
{
{
// Load and try to start a session.
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"));
+ Cache.getProperty("LAST_DIRECTORY"));
chooser.setFileView(new JalviewFileView());
chooser.setDialogTitle(MessageManager
}
else
{
- jalview.bin.Cache.log
+ Cache.log
.error("Implementation error - load session from a running session is not supported.");
}
}
/**
- * import file into a new vamsas session (uses jalview.gui.VamsasApplication)
+ * import file into a new vamsas session (uses VamsasApplication)
*
* @param file
* @return true if import was a success and a session was started.
if (v_client != null)
{
- jalview.bin.Cache.log
+ Cache.log
.error("Implementation error - load session from a running session is not supported.");
return false;
}
}
bis.close();
fos.close();
- v_client = new jalview.gui.VamsasApplication(this, file,
+ v_client = new VamsasApplication(this, file,
url.toExternalForm());
} catch (Exception ex)
{
- jalview.bin.Cache.log.error(
+ Cache.log.error(
"Failed to create new vamsas session from contents of URL "
+ url, ex);
return false;
}
/**
- * import file into a new vamsas session (uses jalview.gui.VamsasApplication)
+ * import file into a new vamsas session (uses VamsasApplication)
*
* @param file
* @return true if import was a success and a session was started.
if (v_client != null)
{
- jalview.bin.Cache.log
+ Cache.log
.error("Implementation error - load session from a running session is not supported.");
return false;
}
{ file.getName() }), file.hashCode());
try
{
- v_client = new jalview.gui.VamsasApplication(this, file, null);
+ v_client = new VamsasApplication(this, file, null);
} catch (Exception ex)
{
setProgressBar(MessageManager.formatMessage(
"status.importing_vamsas_session_from", new Object[]
{ file.getName() }), file.hashCode());
- jalview.bin.Cache.log.error(
+ Cache.log.error(
"New vamsas session from existing session file failed:", ex);
return false;
}
// Start a session.
// we just start a default session for moment.
/*
- * JalviewFileChooser chooser = new JalviewFileChooser(jalview.bin.Cache.
+ * JalviewFileChooser chooser = new JalviewFileChooser(Cache.
* getProperty("LAST_DIRECTORY"));
*
* chooser.setFileView(new JalviewFileView());
* int value = chooser.showOpenDialog(this);
*
* if (value == JalviewFileChooser.APPROVE_OPTION) { v_client = new
- * jalview.gui.VamsasApplication(this, chooser.getSelectedFile());
+ * VamsasApplication(this, chooser.getSelectedFile());
*/
v_client = new VamsasApplication(this);
setupVamsasConnectedGui();
sess = VamsasApplication.getSessionList();
} catch (Exception e)
{
- jalview.bin.Cache.log.warn(
+ Cache.log.warn(
"Problem getting current sessions list.", e);
sess = null;
}
if (sess != null)
{
- jalview.bin.Cache.log.debug("Got current sessions list: "
+ Cache.log.debug("Got current sessions list: "
+ sess.length + " entries.");
VamsasStMenu.removeAll();
for (int i = 0; i < sess.length; i++)
}
else
{
- jalview.bin.Cache.log.debug("No current vamsas sessions.");
+ Cache.log.debug("No current vamsas sessions.");
VamsasStMenu.removeAll();
VamsasStMenu.setVisible(false);
}
if (v_client != null)
{
JalviewFileChooser chooser = new JalviewFileChooser(
- jalview.bin.Cache.getProperty("LAST_DIRECTORY"), new String[]
+ Cache.getProperty("LAST_DIRECTORY"), new String[]
{ "vdj" }, // TODO: VAMSAS DOCUMENT EXTENSION is VDJ
new String[]
{ "Vamsas Document" }, "Vamsas Document");
JPanel progpanel = addProgressPanel(MessageManager.formatMessage(
"label.saving_vamsas_doc", new Object[]
{ choice.getName() }));
- jalview.bin.Cache.setProperty("LAST_DIRECTORY", choice.getParent());
+ Cache.setProperty("LAST_DIRECTORY", choice.getParent());
String warnmsg = null;
String warnttl = null;
try
{
warnttl = "Serious Problem saving Vamsas Document";
warnmsg = ex.toString();
- jalview.bin.Cache.log.error("Error Whilst saving document to "
+ Cache.log.error("Error Whilst saving document to "
+ choice, ex);
} catch (Exception ex)
{
warnttl = "Problem saving Vamsas Document.";
warnmsg = ex.toString();
- jalview.bin.Cache.log.warn("Exception Whilst saving document to "
+ Cache.log.warn("Exception Whilst saving document to "
+ choice, ex);
}
*/
public void setVamsasUpdate(boolean b)
{
- jalview.bin.Cache.log.debug("Setting gui for Vamsas update "
+ Cache.log.debug("Setting gui for Vamsas update "
+ (b ? "in progress" : "finished"));
if (vamUpdate != null)
public void doGroovyCheck()
{
- if (jalview.bin.Cache.groovyJarsPresent())
+ if (Cache.groovyJarsPresent())
{
groovyShell = new JMenuItem();
groovyShell.setText(MessageManager.getString("label.groovy_console"));
public void groovyShell_actionPerformed(ActionEvent e)
{
// use reflection to avoid creating compilation dependency.
- if (!jalview.bin.Cache.groovyJarsPresent())
+ if (!Cache.groovyJarsPresent())
{
throw new Error(
MessageManager
run.invoke(gc);
} catch (Exception ex)
{
- jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex);
+ Cache.log.error("Groovy Shell Creation failed.", ex);
JOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager.getString("label.couldnt_create_groovy_shell"),
"status.opening_params", new Object[]
{ url }), this.hashCode());
}
- jalview.util.BrowserLauncher.openURL(url);
+ BrowserLauncher.openURL(url);
} catch (Exception ex)
{
JOptionPane.showInternalMessageDialog(Desktop.desktop,
{
invalidate();
File of;
- ImageMaker im = new jalview.util.ImageMaker(this, ImageMaker.TYPE.EPS,
+ ImageMaker im = new ImageMaker(this, ImageMaker.TYPE.EPS,
"View of Desktop", getWidth(), getHeight(), of = new File(
"Jalview_snapshot" + System.currentTimeMillis()
+ ".eps"), "View of desktop");