*/
package jalview.gui;
+import java.util.Locale;
+
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
public class Desktop extends jalview.jbgui.GDesktop
implements DropTargetListener, ClipboardOwner, IProgressIndicator, jalview.api.StructureSelectionManagerProvider {
private static final String CITATION;
- static {
- URL bg_logo_url = ChannelProperties.getImageURL("bg_logo." + String.valueOf(SplashScreen.logoSize));
- URL uod_logo_url = ChannelProperties.getImageURL("uod_banner." + String.valueOf(SplashScreen.logoSize));
+ static
+ {
+ URL bg_logo_url = ChannelProperties.getImageURL(
+ "bg_logo." + String.valueOf(SplashScreen.logoSize));
+ URL uod_logo_url = ChannelProperties.getImageURL(
+ "uod_banner." + String.valueOf(SplashScreen.logoSize));
boolean logo = (bg_logo_url != null || uod_logo_url != null);
StringBuilder sb = new StringBuilder();
- sb.append("<br><br>Development managed by The Barton Group, University of Dundee, Scotland, UK.");
- if (logo) {
+ sb.append(
+ "<br><br>Jalview is free software released under GPLv3.<br><br>Development is managed by The Barton Group, University of Dundee, Scotland, UK.");
+ if (logo)
+ {
sb.append("<br>");
}
- sb.append(bg_logo_url == null ? "" : "<img alt=\"Barton Group logo\" src=\"" + bg_logo_url.toString() + "\">");
+ sb.append(bg_logo_url == null ? ""
+ : "<img alt=\"Barton Group logo\" src=\""
+ + bg_logo_url.toString() + "\">");
sb.append(uod_logo_url == null ? ""
- : " <img alt=\"University of Dundee shield\" src=\"" + uod_logo_url.toString() + "\">");
+ : " <img alt=\"University of Dundee shield\" src=\""
+ + uod_logo_url.toString() + "\">");
sb.append(
- "<br><br>For help, see the FAQ at <a href=\"https://www.jalview.org/faq\">www.jalview.org/faq</a> and/or join the jalview-discuss@jalview.org mailing list");
+ "<br><br>For help, see <a href=\"https://www.jalview.org/faq\">www.jalview.org/faq</a> and join <a href=\"https://discourse.jalview.org\">discourse.jalview.org</a>");
sb.append("<br><br>If you use Jalview, please cite:"
- + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
- + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
- + "<br>Bioinformatics doi: 10.1093/bioinformatics/btp033");
+ + "<br>Waterhouse, A.M., Procter, J.B., Martin, D.M.A, Clamp, M. and Barton, G. J. (2009)"
+ + "<br>Jalview Version 2 - a multiple sequence alignment editor and analysis workbench"
+ + "<br>Bioinformatics <a href=\"https://doi.org/10.1093/bioinformatics/btp033\">doi: 10.1093/bioinformatics/btp033</a>");
CITATION = sb.toString();
}
awtAppClassNameField.setAccessible(true);
awtAppClassNameField.set(xToolkit, title);
} else {
- Cache.log.debug("XToolkit: awtAppClassName not found");
+ jalview.bin.Console.debug("XToolkit: awtAppClassName not found");
}
} catch (Exception e) {
- Cache.debug("Error setting awtAppClassName");
- Cache.trace(Cache.getStackTraceString(e));
+ jalview.bin.Console.debug("Error setting awtAppClassName");
+ jalview.bin.Console.trace(Cache.getStackTraceString(e));
}
}
System.out.println("Cannot set APQHandlers");
// e.printStackTrace();
} catch (Throwable t) {
- Cache.warn("Error setting APQHandlers: " + t.toString());
- Cache.trace(Cache.getStackTraceString(t));
+ jalview.bin.Console.warn("Error setting APQHandlers: " + t.toString());
+ jalview.bin.Console.trace(Cache.getStackTraceString(t));
}
setIconImages(ChannelProperties.getIconList());
new Thread(new Runnable() {
@Override
public void run() {
- Cache.log.debug("Filechooser init thread started.");
+ jalview.bin.Console.debug("Filechooser init thread started.");
String fileFormat = Cache.getProperty("DEFAULT_FILE_FORMAT");
JalviewFileChooser.forRead(Cache.getProperty("LAST_DIRECTORY"), fileFormat);
- Cache.log.debug("Filechooser init thread finished.");
+ jalview.bin.Console.debug("Filechooser init thread finished.");
}
}).start();
// Add the service change listener
@Override
public void propertyChange(PropertyChangeEvent evt) {
- Cache.log.debug("Firing service changed event for " + evt.getNewValue());
+ jalview.bin.Console.debug("Firing service changed event for " + evt.getNewValue());
JalviewServicesChanged(evt);
}
});
if (Cache.getDefault(Preferences.ADD_SS_ANN, true)) {
ssm.setAddTempFacAnnot(Cache.getDefault(Preferences.ADD_TEMPFACT_ANN, true));
ssm.setProcessSecondaryStructure(Cache.getDefault(Preferences.STRUCT_FROM_PDB, true));
- ssm.setSecStructServices(Cache.getDefault(Preferences.USE_RNAVIEW, true));
+ // JAL-3915 - RNAView is no longer an option so this has no effect
+ ssm.setSecStructServices(Cache.getDefault(Preferences.USE_RNAVIEW, false));
} else {
ssm.setAddTempFacAnnot(false);
ssm.setProcessSecondaryStructure(false);
new Thread(new Runnable() {
@Override
public void run() {
- Cache.log.debug("Starting news thread.");
+ jalview.bin.Console.debug("Starting news thread.");
jvnews = new BlogReader(me);
showNews.setVisible(true);
- Cache.log.debug("Completed news thread.");
+ jalview.bin.Console.debug("Completed news thread.");
}
}).start();
}
new Thread(new Runnable() {
@Override
public void run() {
- Cache.log.debug("Downloading data from identifiers.org");
+ jalview.bin.Console.debug("Downloading data from identifiers.org");
try {
UrlDownloadClient.download(IdOrgSettings.getUrl(), IdOrgSettings.getDownloadLocation());
} catch (IOException e) {
- Cache.log.debug("Exception downloading identifiers.org data" + e.getMessage());
+ jalview.bin.Console.debug("Exception downloading identifiers.org data" + e.getMessage());
}
}
}).start();
}
void showNews(boolean visible) {
- Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
+ jalview.bin.Console.debug((visible ? "Showing" : "Hiding") + " news.");
showNews.setSelected(visible);
if (visible && !jvnews.isVisible()) {
new Thread(new Runnable() {
iy = (int) (iy * sh);
ih = (int) (ih * sh);
while (ix >= screenSize.width) {
- Cache.log.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
+ jalview.bin.Console.debug("Window geometry location recall error: shifting horizontal to within screenbounds.");
ix -= screenSize.width;
}
while (iy >= screenSize.height) {
- Cache.log.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
+ jalview.bin.Console.debug("Window geometry location recall error: shifting vertical to within screenbounds.");
iy -= screenSize.height;
}
- Cache.log.debug("Got last known dimensions for " + windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ jalview.bin.Console.debug("Got last known dimensions for " + windowName + ": x:" + ix + " y:" + iy + " width:" + iw
+ " height:" + ih);
}
// return dimensions for new instance
frame.requestFocus();
} catch (java.beans.PropertyVetoException ve) {
} catch (java.lang.ClassCastException cex) {
- Cache.log.warn(
+ jalview.bin.Console.warn(
"Squashed a possible GUI implementation error. If you can recreate this, please look at https://issues.jalview.org/browse/JAL-869",
cex);
}
String url = (history instanceof JTextField ? ((JTextField) history).getText()
: ((JComboBox<String>) history).getEditor().getItem().toString().trim());
- if (url.toLowerCase().endsWith(".jar")) {
+ if (url.toLowerCase(Locale.ROOT).endsWith(".jar")) {
if (viewport != null) {
new FileLoader().LoadFile(viewport, url, DataSourceType.URL, FileFormat.Jalview);
} else {
}
private void storeLastKnownDimensions(String string, Rectangle jc) {
- Cache.log.debug("Storing last known dimensions for " + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width
+ jalview.bin.Console.debug("Storing last known dimensions for " + string + ": x:" + jc.x + " y:" + jc.y + " width:" + jc.width
+ " height:" + jc.height);
Cache.setProperty(string + "SCREEN_X", jc.x + "");
// message.append("<br>...Checking latest version...</br>");
} else if (!latestVersion.equals(Cache.getProperty("VERSION"))) {
boolean red = false;
- if (Cache.getProperty("VERSION").toLowerCase().indexOf("automated build") == -1) {
+ if (Cache.getProperty("VERSION").toLowerCase(Locale.ROOT).indexOf("automated build") == -1) {
red = true;
// Displayed when code version and jnlp version do not match and code
// version is not a development build
@Override
protected void garbageCollect_actionPerformed(ActionEvent e) {
// We simply collect the garbage
- Cache.log.debug("Collecting garbage...");
+ jalview.bin.Console.debug("Collecting garbage...");
System.gc();
- Cache.log.debug("Finished garbage collection.");
+ jalview.bin.Console.debug("Finished garbage collection.");
}
/*
} catch (OutOfMemoryError oom) {
new OOMWarning("Whilst saving current state to " + chosenFile.getName(), oom);
} catch (Exception ex) {
- Cache.log.error("Problems whilst trying to save to " + chosenFile.getName(), ex);
+ jalview.bin.Console.error("Problems whilst trying to save to " + chosenFile.getName(), ex);
JvOptionPane.showMessageDialog(me,
MessageManager.formatMessage("label.error_whilst_saving_current_state_to",
new Object[] { chosenFile.getName() }),
} catch (OutOfMemoryError oom) {
new OOMWarning("Whilst loading project from " + choice, oom);
} catch (Exception ex) {
- Cache.log.error("Problems whilst loading project from " + choice, ex);
+ jalview.bin.Console.error("Problems whilst loading project from " + choice, ex);
JvOptionPane.showMessageDialog(Desktop.desktop,
MessageManager.formatMessage("label.error_whilst_loading_project_from", new Object[] { choice }),
MessageManager.getString("label.couldnt_load_project"), JvOptionPane.WARNING_MESSAGE);
try {
openGroovyConsole();
} catch (Exception ex) {
- Cache.log.error("Groovy Shell Creation failed.", ex);
+ jalview.bin.Console.error("Groovy Shell Creation failed.", ex);
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager.getString("label.couldnt_create_groovy_shell"),
});
}
} else {
- Cache.log.error("Errors reported by JABA discovery service. Check web services preferences.\n" + ermsg);
+ jalview.bin.Console.error("Errors reported by JABA discovery service. Check web services preferences.\n" + ermsg);
}
}
}
Desktop.showUrl(url);
} catch (Exception x) {
if (url != null) {
- if (Cache.log != null) {
- Cache.log.error("Couldn't handle string " + url + " as a URL.");
- } else {
- System.err.println("Couldn't handle string " + url + " as a URL.");
- }
+ jalview.bin.Console.error("Couldn't handle string " + url + " as a URL.");
}
// ignore any exceptions due to dud links.
}
try {
SwingUtilities.invokeAndWait(prompter);
} catch (Exception q) {
- Cache.log.warn("Unexpected Exception in dialog thread.", q);
+ jalview.bin.Console.warn("Unexpected Exception in dialog thread.", q);
}
}
});
@Override
public void exportImage(Graphics g) throws Exception {
paintAll(g);
- Cache.log.info("Successfully written snapshot to file " + of.getAbsolutePath());
+ jalview.bin.Console.info("Successfully written snapshot to file " + of.getAbsolutePath());
}
};
String title = "View of desktop";
try {
urlFlavour = new DataFlavor("application/x-java-url; class=java.net.URL");
} catch (ClassNotFoundException cfe) {
- Cache.log.debug("Couldn't instantiate the URL dataflavor.", cfe);
+ jalview.bin.Console.debug("Couldn't instantiate the URL dataflavor.", cfe);
}
if (urlFlavour != null && t.isDataFlavorSupported(urlFlavour)) {
if (url != null) {
protocols.add(DataSourceType.URL);
files.add(url.toString());
- Cache.log.debug("Drop handled as URL dataflavor " + files.get(files.size() - 1));
+ jalview.bin.Console.debug("Drop handled as URL dataflavor " + files.get(files.size() - 1));
return;
} else {
if (Platform.isAMacAndNotJS()) {
}
}
} catch (Throwable ex) {
- Cache.log.debug("URL drop handler failed.", ex);
+ jalview.bin.Console.debug("URL drop handler failed.", ex);
}
}
if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
// Works on Windows and MacOSX
- Cache.log.debug("Drop handled as javaFileListFlavor");
+ jalview.bin.Console.debug("Drop handled as javaFileListFlavor");
for (Object file : (List) t.getTransferData(DataFlavor.javaFileListFlavor)) {
files.add(file);
protocols.add(DataSourceType.FILE);
boolean added = false;
String data = null;
if (t.isDataFlavorSupported(uriListFlavor)) {
- Cache.log.debug("Drop handled as uriListFlavor");
+ jalview.bin.Console.debug("Drop handled as uriListFlavor");
// This is used by Unix drag system
data = (String) t.getTransferData(uriListFlavor);
}
if (data == null) {
// fallback to text: workaround - on OSX where there's a JVM bug
- Cache.log.debug("standard URIListFlavor failed. Trying text");
+ jalview.bin.Console.debug("standard URIListFlavor failed. Trying text");
// try text fallback
DataFlavor textDf = new DataFlavor("text/plain;class=java.lang.String");
if (t.isDataFlavorSupported(textDf)) {
data = (String) t.getTransferData(textDf);
}
- Cache.log.debug("Plain text drop content returned " + (data == null ? "Null - failed" : data));
+ jalview.bin.Console.debug("Plain text drop content returned " + (data == null ? "Null - failed" : data));
}
if (data != null) {
while (protocols.size() < files.size()) {
- Cache.log.debug("Adding missing FILE protocol for " + files.get(protocols.size()));
+ jalview.bin.Console.debug("Adding missing FILE protocol for " + files.get(protocols.size()));
protocols.add(DataSourceType.FILE);
}
for (java.util.StringTokenizer st = new java.util.StringTokenizer(data, "\r\n"); st.hasMoreTokens();) {
continue;
}
java.net.URI uri = new java.net.URI(s);
- if (uri.getScheme().toLowerCase().startsWith("http")) {
+ if (uri.getScheme().toLowerCase(Locale.ROOT).startsWith("http")) {
protocols.add(DataSourceType.URL);
files.add(uri.toString());
} else {
}
}
- if (Cache.log.isDebugEnabled()) {
+ if (jalview.bin.Console.isDebugEnabled()) {
if (data == null || !added) {
if (t.getTransferDataFlavors() != null && t.getTransferDataFlavors().length > 0) {
- Cache.log.debug("Couldn't resolve drop data. Here are the supported flavors:");
+ jalview.bin.Console.debug("Couldn't resolve drop data. Here are the supported flavors:");
for (DataFlavor fl : t.getTransferDataFlavors()) {
- Cache.log.debug("Supported transfer dataflavor: " + fl.toString());
+ jalview.bin.Console.debug("Supported transfer dataflavor: " + fl.toString());
Object df = t.getTransferData(fl);
if (df != null) {
- Cache.log.debug("Retrieves: " + df);
+ jalview.bin.Console.debug("Retrieves: " + df);
} else {
- Cache.log.debug("Retrieved nothing");
+ jalview.bin.Console.debug("Retrieved nothing");
}
}
} else {
- Cache.log.debug("Couldn't resolve dataflavor for drop: " + t.toString());
+ jalview.bin.Console.debug("Couldn't resolve dataflavor for drop: " + t.toString());
}
}
}
}
if (Platform.isWindowsAndNotJS()) {
- Cache.log.debug("Scanning dropped content for Windows Link Files");
+ jalview.bin.Console.debug("Scanning dropped content for Windows Link Files");
// resolve any .lnk files in the file drop
for (int f = 0; f < files.size(); f++) {
- String source = files.get(f).toString().toLowerCase();
+ String source = files.get(f).toString().toLowerCase(Locale.ROOT);
if (protocols.get(f).equals(DataSourceType.FILE)
&& (source.endsWith(".lnk") || source.endsWith(".url") || source.endsWith(".site"))) {
try {
Object obj = files.get(f);
File lf = (obj instanceof File ? (File) obj : new File((String) obj));
// process link file to get a URL
- Cache.log.debug("Found potential link file: " + lf);
+ jalview.bin.Console.debug("Found potential link file: " + lf);
WindowsShortcut wscfile = new WindowsShortcut(lf);
String fullname = wscfile.getRealFilename();
protocols.set(f, FormatAdapter.checkProtocol(fullname));
files.set(f, fullname);
- Cache.log.debug("Parsed real filename " + fullname + " to extract protocol: " + protocols.get(f));
+ jalview.bin.Console.debug("Parsed real filename " + fullname + " to extract protocol: " + protocols.get(f));
} catch (Exception ex) {
- Cache.log.error("Couldn't parse " + files.get(f) + " as a link file.", ex);
+ jalview.bin.Console.error("Couldn't parse " + files.get(f) + " as a link file.", ex);
}
}
}
AffineTransform t = gg.getTransform();
double scaleX = t.getScaleX();
double scaleY = t.getScaleY();
- Cache.debug(debugScaleMessage + scaleX + " (X)");
- Cache.debug(debugScaleMessage + scaleY + " (Y)");
+ jalview.bin.Console.debug(debugScaleMessage + scaleX + " (X)");
+ jalview.bin.Console.debug(debugScaleMessage + scaleY + " (Y)");
debugScaleMessageDone = true;
} else {
- Cache.debug("Desktop graphics null");
+ jalview.bin.Console.debug("Desktop graphics null");
}
} catch (Exception e) {
- Cache.debug(Cache.getStackTraceString(e));
+ jalview.bin.Console.debug(Cache.getStackTraceString(e));
}
}
}