private java.util.Vector cachedDeserFactories = new java.util.Vector();
- static org.apache.axis.description.OperationDesc[] _operations;
+ private static org.apache.axis.description.OperationDesc[] _operations;
static
{
}
}
+ @Override
public java.lang.String predict(vamsas.objects.simple.Sequence seq)
throws java.rmi.RemoteException
{
}
}
+ @Override
public java.lang.String predictOnMsa(
vamsas.objects.simple.Msfalignment msf)
throws java.rmi.RemoteException
}
}
+ @Override
public vamsas.objects.simple.Secstructpred getpredict(
java.lang.String job_id) throws java.rmi.RemoteException
{
}
}
+ @Override
public vamsas.objects.simple.JpredResult getresult(java.lang.String job_id)
throws java.rmi.RemoteException
{
public class MuscleWSSoapBindingStub extends org.apache.axis.client.Stub
implements ext.vamsas.MuscleWS
{
- static org.apache.axis.description.OperationDesc[] _operations;
+ private static final org.apache.axis.description.OperationDesc[] _operations;
static
{
}
}
+ @Override
public vamsas.objects.simple.WsJobId align(
vamsas.objects.simple.SequenceSet seqSet)
throws java.rmi.RemoteException
}
}
+ @Override
public vamsas.objects.simple.Alignment getalign(java.lang.String job_id)
throws java.rmi.RemoteException
{
}
}
+ @Override
public vamsas.objects.simple.MsaResult getResult(java.lang.String job_id)
throws java.rmi.RemoteException
{
}
}
+ @Override
public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
throws java.rmi.RemoteException
{
private java.util.Vector cachedDeserFactories = new java.util.Vector();
- static org.apache.axis.description.OperationDesc[] _operations;
+ private static org.apache.axis.description.OperationDesc[] _operations;
static
{
}
}
+ @Override
public ext.vamsas.ServiceHandles getServices()
throws java.rmi.RemoteException
{
private java.util.Vector cachedDeserFactories = new java.util.Vector();
- static org.apache.axis.description.OperationDesc[] _operations;
+ private static final org.apache.axis.description.OperationDesc[] _operations;
static
{
}
}
+ @Override
public java.lang.String getDatabase() throws java.rmi.RemoteException
{
if (super.cachedEndpoint == null)
}
}
+ @Override
public vamsas.objects.simple.SeqSearchResult getResult(
java.lang.String job_id) throws java.rmi.RemoteException
{
}
}
+ @Override
public vamsas.objects.simple.WsJobId psearch(
vamsas.objects.simple.Alignment al, java.lang.String database)
throws java.rmi.RemoteException
}
}
+ @Override
public vamsas.objects.simple.WsJobId search(
vamsas.objects.simple.Sequence s, java.lang.String database)
throws java.rmi.RemoteException
}
}
+ @Override
public vamsas.objects.simple.WsJobId cancel(java.lang.String jobId)
throws java.rmi.RemoteException
{
private java.lang.Object __equalsCalc = null;
+ @Override
public synchronized boolean equals(java.lang.Object obj)
{
if (obj == null)
private boolean __hashCodeCalc = false;
+ @Override
public synchronized int hashCode()
{
if (__hashCodeCalc)
}
// Type metadata
- private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
+ private static final org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(
ServiceHandle.class, true);
static
import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.datamodel.SequenceNode;
+import jalview.util.Platform;
import jalview.util.QuickSort;
import java.util.ArrayList;
*/
public class AlignmentSorter
{
+
+ static AlignmentSorter instance;
+
+ public static AlignmentSorter getInstance()
+ {
+
+ // BH 2019.05.08 need to isolate static fields in JavaScript
+
+ AlignmentSorter i = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+ if (Platform.isJS())
+ {
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative i = g._jalviewScoreModelsInstance;
+ *
+ */
+ }
+ if (i == null)
+ {
+ i = new AlignmentSorter();
+
+ if (Platform.isJS())
+ {
+ /**
+ * @j2sNative g._jalviewScoreModelsInstance = i;
+ *
+ */
+ }
+ else
+ {
+ instance = i;
+ }
+ }
+ return i;
+ }
+
/*
* todo: refactor searches to follow a basic pattern: (search property, last
* search state, current sort direction)
*/
- static boolean sortIdAscending = true;
+ boolean sortIdAscending = true;
- static int lastGroupHash = 0;
+ int lastGroupHash = 0;
- static boolean sortGroupAscending = true;
+ boolean sortGroupAscending = true;
- static AlignmentOrder lastOrder = null;
+ AlignmentOrder lastOrder = null;
- static boolean sortOrderAscending = true;
+ boolean sortOrderAscending = true;
- static TreeModel lastTree = null;
+ TreeModel lastTree = null;
- static boolean sortTreeAscending = true;
+ boolean sortTreeAscending = true;
- /*
+
+ /**
* last Annotation Label used for sort by Annotation score
*/
- private static String lastSortByAnnotation;
+ private String lastSortByAnnotation;
- /*
- * string hash of last arguments to sortByFeature
- * (sort order toggles if this is unchanged between sorts)
+ /**
+ * string hash of last arguments to sortByFeature (sort order toggles if this
+ * is unchanged between sorts)
*/
- private static String sortByFeatureCriteria;
+ private String sortByFeatureCriteria;
- private static boolean sortByFeatureAscending = true;
+ private boolean sortByFeatureAscending = true;
- private static boolean sortLengthAscending;
+ private boolean sortLengthAscending;
/**
* Sorts sequences in the alignment by Percentage Identity with the given
QuickSort.sort(ids, seqs);
- if (sortIdAscending)
+ AlignmentSorter as = getInstance();
+ if (as.sortIdAscending)
{
setReverseOrder(align, seqs);
}
setOrder(align, seqs);
}
- sortIdAscending = !sortIdAscending;
+ as.sortIdAscending = !as.sortIdAscending;
}
/**
QuickSort.sort(length, seqs);
- if (sortLengthAscending)
+ AlignmentSorter as = getInstance();
+
+ if (as.sortLengthAscending)
{
setReverseOrder(align, seqs);
}
setOrder(align, seqs);
}
- sortLengthAscending = !sortLengthAscending;
+ as.sortLengthAscending = !as.sortLengthAscending;
}
/**
// ORDERS BY GROUP SIZE
List<SequenceGroup> groups = new ArrayList<>();
- if (groups.hashCode() != lastGroupHash)
+ AlignmentSorter as = getInstance();
+
+ if (groups.hashCode() != as.lastGroupHash)
{
- sortGroupAscending = true;
- lastGroupHash = groups.hashCode();
+ as.sortGroupAscending = true;
+ as.lastGroupHash = groups.hashCode();
}
else
{
- sortGroupAscending = !sortGroupAscending;
+ as.sortGroupAscending = !as.sortGroupAscending;
}
// SORTS GROUPS BY SIZE
}
}
- if (sortGroupAscending)
+ if (as.sortGroupAscending)
{
setOrder(align, seqs);
}
// Get an ordered vector of sequences which may also be present in align
List<SequenceI> tmp = order.getOrder();
- if (lastOrder == order)
+ AlignmentSorter as = getInstance();
+
+ if (as.lastOrder == order)
{
- sortOrderAscending = !sortOrderAscending;
+ as.sortOrderAscending = !as.sortOrderAscending;
}
else
{
- sortOrderAscending = true;
+ as.sortOrderAscending = true;
}
- if (sortOrderAscending)
+ if (as.sortOrderAscending)
{
setOrder(align, tmp);
}
{
List<SequenceI> tmp = getOrderByTree(align, tree);
+ AlignmentSorter as = getInstance();
+
// tmp should properly permute align with tree.
- if (lastTree != tree)
+ if (as.lastTree != tree)
{
- sortTreeAscending = true;
- lastTree = tree;
+ as.sortTreeAscending = true;
+ as.lastTree = tree;
}
else
{
- sortTreeAscending = !sortTreeAscending;
+ as.sortTreeAscending = !as.sortTreeAscending;
}
- if (sortTreeAscending)
+ if (as.sortTreeAscending)
{
setOrder(align, tmp);
}
}
jalview.util.QuickSort.sort(scores, seqs);
- if (lastSortByAnnotation != scoreLabel)
+
+ AlignmentSorter as = getInstance();
+
+ if (as.lastSortByAnnotation != scoreLabel)
{
- lastSortByAnnotation = scoreLabel;
+ as.lastSortByAnnotation = scoreLabel;
setOrder(alignment, seqs);
}
else
}
}
+ boolean doSort = false;
+
if (FEATURE_SCORE.equals(method))
{
if (hasScores == 0)
}
}
}
- QuickSort.sortByDouble(scores, seqs, sortByFeatureAscending);
+ doSort = true;
}
else if (FEATURE_DENSITY.equals(method))
{
// System.err.println("Sorting on Density: seq "+seqs[i].getName()+
// " Feats: "+featureCount+" Score : "+scores[i]);
}
- QuickSort.sortByDouble(scores, seqs, sortByFeatureAscending);
+ doSort = true;
+ }
+ if (doSort)
+ {
+ QuickSort.sortByDouble(scores, seqs, getInstance().sortByFeatureAscending);
}
-
setOrder(alignment, seqs);
}
/*
* if resorting on the same criteria, toggle sort order
*/
- if (sortByFeatureCriteria == null
- || !scoreCriteria.equals(sortByFeatureCriteria))
+ AlignmentSorter as = getInstance();
+ if (as.sortByFeatureCriteria == null
+ || !scoreCriteria.equals(as.sortByFeatureCriteria))
{
- sortByFeatureAscending = true;
+ as.sortByFeatureAscending = true;
}
else
{
- sortByFeatureAscending = !sortByFeatureAscending;
+ as.sortByFeatureAscending = !as.sortByFeatureAscending;
}
- sortByFeatureCriteria = scoreCriteria;
+ as.sortByFeatureCriteria = scoreCriteria;
}
}
import java.util.StringTokenizer;
/**
- * A singleton that provides instances of genetic code translation tables
+ * A static class that provides instances of genetic code translation tables
*
* @author gmcarstairs
* @see https://www.ncbi.nlm.nih.gov/Taxonomy/Utils/wprintgc.cgi
*/
public final class GeneticCodes
{
+
+ /**
+ * As implemented, this has to be the first table defined in the data file.
+ */
+ private static GeneticCodeI standardTable;
+
+ /**
+ *
+ * @return the standard code table (table 1)
+ */
+ public static GeneticCodeI getStandardCodeTable()
+ {
+ return (standardTable == null
+ ? standardTable = codeTables.values().iterator().next()
+ : standardTable);
+ }
+
private static final int CODON_LENGTH = 3;
private static final String QUOTE = "\"";
private static final String RESOURCE_FILE = "/GeneticCodes.dat";
- private static GeneticCodes instance = new GeneticCodes();
-
- private Map<String, String> ambiguityCodes;
+ private static final Map<String, String> ambiguityCodes;
/*
* loaded code tables, with keys in order of loading
*/
- private Map<String, GeneticCodeI> codeTables;
+ private static final Map<String, GeneticCodeI> codeTables;
- /**
- * Private constructor enforces singleton
- */
- private GeneticCodes()
+ static
{
- if (instance == null)
- {
- ambiguityCodes = new HashMap<>();
+ ambiguityCodes = new HashMap<>();
- /*
- * LinkedHashMap preserves order of addition of entries,
- * so we can assume the Standard Code Table is the first
- */
- codeTables = new LinkedHashMap<>();
- loadAmbiguityCodes(AMBIGUITY_CODES_FILE);
- loadCodes(RESOURCE_FILE);
- }
+ /*
+ * LinkedHashMap preserves order of addition of entries,
+ * so we can assume the Standard Code Table is the first
+ */
+ codeTables = new LinkedHashMap<>();
+ loadAmbiguityCodes(AMBIGUITY_CODES_FILE);
+ loadCodes(RESOURCE_FILE);
}
/**
- * Returns the singleton instance of this class
- *
- * @return
+ * Private constructor enforces no instantiation
*/
- public static GeneticCodes getInstance()
+ private GeneticCodes()
{
- return instance;
}
/**
*
* @return
*/
- public Iterable<GeneticCodeI> getCodeTables()
+ public static Iterable<GeneticCodeI> getCodeTables()
{
return codeTables.values();
}
/**
- * Answers the code table with the given id
+ * Answers the code table with the given id -- test suite only
*
* @param id
* @return
*/
- public GeneticCodeI getCodeTable(String id)
+ public static GeneticCodeI getCodeTable(String id)
{
return codeTables.get(id);
}
/**
- * A convenience method that returns the standard code table (table 1). As
- * implemented, this has to be the first table defined in the data file.
- *
- * @return
- */
- public GeneticCodeI getStandardCodeTable()
- {
- return codeTables.values().iterator().next();
- }
-
- /**
* Loads the code tables from a data file
*/
- protected void loadCodes(String fileName)
+ private static void loadCodes(String fileName)
{
try
{
- InputStream is = getClass().getResourceAsStream(fileName);
+ InputStream is = GeneticCodes.class.getResourceAsStream(fileName);
if (is == null)
{
System.err.println("Resource file not found: " + fileName);
*
* @param fileName
*/
- protected void loadAmbiguityCodes(String fileName)
+ private static void loadAmbiguityCodes(String fileName)
{
try
{
- InputStream is = getClass().getResourceAsStream(fileName);
+ InputStream is = GeneticCodes.class.getResourceAsStream(fileName);
if (is == null)
{
System.err.println("Resource file not found: " + fileName);
* @return
* @throws IOException
*/
- protected String readLine(BufferedReader dataIn) throws IOException
+ private static String readLine(BufferedReader dataIn) throws IOException
{
String line = dataIn.readLine();
while (line != null && line.startsWith("#"))
* @return
* @throws IOException
*/
- protected String loadOneTable(BufferedReader dataIn) throws IOException
+ private static String loadOneTable(BufferedReader dataIn)
+ throws IOException
{
String name = null;
String id = null;
* @param name
* @param codons
*/
- protected void registerCodeTable(final String id, final String name,
+ private static void registerCodeTable(final String id, final String name,
final Map<String, String> codons)
{
codeTables.put(id, new GeneticCodeI()
* @param codeTable
* @return
*/
- protected String getAmbiguousTranslation(String codon,
+ protected static String getAmbiguousTranslation(String codon,
Map<String, String> ambiguous, GeneticCodeI codeTable)
{
if (codon.length() != CODON_LENGTH)
ambiguous.put(codon, peptide);
return peptide;
}
+
}
* score matrix (JAL-2397)
* Set this flag to true (via Groovy) for 2.10.1 behaviour
*/
- private static boolean scoreGapAsAny = false;
+ // BH 2019.05.08 was static but not ever set
+ private boolean scoreGapAsAny = false;
public static final short UNMAPPED = (short) -1;
import jalview.io.DataSourceType;
import jalview.io.FileParse;
import jalview.io.ScoreMatrixFile;
+import jalview.util.Platform;
import java.io.IOException;
import java.util.LinkedHashMap;
private static ScoreModels instance;
- private Map<String, ScoreModelI> models;
-
/**
* Answers the singleton instance of this class, with lazy initialisation
* (built-in score models are loaded on the first call to this method)
*/
public static ScoreModels getInstance()
{
- if (instance == null)
+ ScoreModels m = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+ if (Platform.isJS())
{
- instance = new ScoreModels();
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative m = g._jalviewScoreModelsInstance;
+ *
+ */
}
- return instance;
+ if (m == null)
+ {
+ m = new ScoreModels();
+ if (Platform.isJS())
+ {
+ /**
+ * @j2sNative g._jalviewScoreModelsInstance = m;
+ *
+ */
+ }
+ else
+ {
+ instance = m;
+ }
+ }
+ return m;
}
+ private Map<String, ScoreModelI> models;
+
/**
* Private constructor to enforce use of singleton. Registers Jalview's
* "built-in" score models:
*/
public class ArgsParser
{
- Vector<String> vargs = null;
+
+ public static final String ANNOTATIONS = "annotations";
+
+ public static final String COLOUR = "colour";
+
+ public static final String FEATURES = "features";
+
+ public static final String GROOVY = "groovy";
+
+ public static final String GROUPS = "groups";
+
+ public static final String HEADLESS = "headless";
+
+ public static final String JABAWS = "jabaws";
+
+ public static final String NOANNOTATION = "no-annotation";
+
+ public static final String NOANNOTATION2 = "noannotation"; // BH 2019.05.07
+
+ public static final String NODISPLAY = "nodisplay";
+
+ public static final String NOGUI = "nogui";
+
+ public static final String NONEWS = "nonews";
+
+ public static final String NOQUESTIONNAIRE = "noquestionnaire";
+
+ public static final String NOSORTBYTREE = "nosortbytree";
+
+ public static final String NOUSAGESTATS = "nousagestats";
+
+ public static final String OPEN = "open";
+
+ public static final String PROPS = "props";
+
+ public static final String QUESTIONNAIRE = "questionnaire";
+
+ public static final String SETPROP = "setprop";
+
+ public static final String SORTBYTREE = "sortbytree";
+
+ public static final String TREE = "tree";
+
+ public static final String VDOC = "vdoc";
+
+ public static final String VSESS = "vsess";
+
+ private Vector<String> vargs = null;
public ArgsParser(String[] args)
{
- vargs = new Vector<String>();
+ vargs = new Vector<>();
for (int i = 0; i < args.length; i++)
{
String arg = args[i].trim();
}
if (authorDetails == null)
{
- applicationProperties.remove("AUTHORS");
- applicationProperties.remove("AUTHORFNAMES");
- applicationProperties.remove("YEAR");
+ applicationProperties.remove("AUTHORS");
+ applicationProperties.remove("AUTHORFNAMES");
+ applicationProperties.remove("YEAR");
}
// FIND THE VERSION NUMBER AND BUILD DATE FROM jalview.jar
}
if (buildDetails == null)
{
- applicationProperties.remove("VERSION");
+ applicationProperties.remove("VERSION");
}
String jnlpVersion = System.getProperty("jalview.version");
String codeVersion = getProperty("VERSION");
// "DEFAULT_PDB_FILE_PARSER", DEFAULT_PDB_FILE_PARSER));
// jnlpVersion will be null if we're using InstallAnywhere
// Dont do this check if running in headless mode
- if (jnlpVersion == null && getDefault("VERSION_CHECK", true)
- && (System.getProperty("java.awt.headless") == null || System
- .getProperty("java.awt.headless").equals("false")))
+ if (jnlpVersion == null && !Jalview.isHeadlessMode()
+ && getDefault("VERSION_CHECK", true))
{
class VersionChecker extends Thread
Platform.getURLCommandArguments();
}
- // singleton instance of this class
+ private boolean headless;
+
+ public static boolean isHeadlessMode()
+ {
+ return getInstance().headless;
+ }
+
+ /**
+ * singleton instance of this class in Java only
+ */
private static Jalview instance;
+ public static Jalview getInstance()
+ {
+ Jalview j;
+ @SuppressWarnings("unused")
+ ThreadGroup g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative j = g._jalviewInstance;
+ */
+ {
+ j = instance;
+ }
+ return j;
+ }
+
+ private static void setInstance(Jalview j)
+ {
+ @SuppressWarnings("unused")
+ ThreadGroup g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2s g._jalviewInstance = j;
+ */
+ {
+ instance = j;
+ }
+ }
+
private Desktop desktop;
- public static AlignFrame currentAlignFrame;
+ private AlignFrame currentAlignFrame;
+
+ public static AlignFrame getCurrentAlignFrame()
+ {
+ return getInstance().currentAlignFrame;
+ }
+
+ public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+ {
+ getInstance().currentAlignFrame = currentAlignFrame;
+ }
static
{
*/
{
// grab all the rights we can for the JVM
- Policy.setPolicy(new Policy()
- {
- @Override
- public PermissionCollection getPermissions(CodeSource codesource)
- {
- Permissions perms = new Permissions();
- perms.add(new AllPermission());
- return (perms);
- }
-
- @Override
- public void refresh()
- {
- }
- });
+ Policy.setPolicy(new Policy()
+ {
+ @Override
+ public PermissionCollection getPermissions(CodeSource codesource)
+ {
+ Permissions perms = new Permissions();
+ perms.add(new AllPermission());
+ return (perms);
+ }
+
+ @Override
+ public void refresh()
+ {
+ }
+ });
}
}
}
- public static Jalview getInstance()
- {
- return instance;
- }
-
/**
* main class for Jalview application
*
*/
public static void main(String[] args)
{
-// setLogging(); // BH - for event debugging in JavaScript
- instance = new Jalview();
- instance.doMain(args);
-}
+ // setLogging(); // BH - for event debugging in JavaScript
+ setInstance(new Jalview());
+ getInstance().doMain(args);
+ }
- private static void logClass(String name)
- {
- // BH - for event debugging in JavaScript
- ConsoleHandler consoleHandler = new ConsoleHandler();
- consoleHandler.setLevel(Level.ALL);
- Logger logger = Logger.getLogger(name);
- logger.setLevel(Level.ALL);
- logger.addHandler(consoleHandler);
+ private static void logClass(String name)
+ {
+ // BH - for event debugging in JavaScript
+ ConsoleHandler consoleHandler = new ConsoleHandler();
+ consoleHandler.setLevel(Level.ALL);
+ Logger logger = Logger.getLogger(name);
+ logger.setLevel(Level.ALL);
+ logger.addHandler(consoleHandler);
}
@SuppressWarnings("unused")
- private static void setLogging()
+ private static void setLogging()
{
/**
System.out.println("not in js");
}
- // BH - for event debugging in JavaScript (Java mode only)
+ // BH - for event debugging in JavaScript (Java mode only)
if (!Platform.isJS())
/**
* Java only
*
* @j2sIgnore
*/
- {
- Logger.getLogger("").setLevel(Level.ALL);
- logClass("java.awt.EventDispatchThread");
- logClass("java.awt.EventQueue");
- logClass("java.awt.Component");
- logClass("java.awt.focus.Component");
- logClass("java.awt.focus.DefaultKeyboardFocusManager");
- }
+ {
+ Logger.getLogger("").setLevel(Level.ALL);
+ logClass("java.awt.EventDispatchThread");
+ logClass("java.awt.EventQueue");
+ logClass("java.awt.Component");
+ logClass("java.awt.focus.Component");
+ logClass("java.awt.focus.DefaultKeyboardFocusManager");
+ }
}
-
-
-
/**
* @param args
+ System.getProperty("os.version"));
ArgsParser aparser = new ArgsParser(args);
- boolean headless = false;
- String usrPropsFile = aparser.getValue("props");
- Cache.loadProperties(usrPropsFile); // must do this before
+ String usrPropsFile = aparser.getValue(ArgsParser.PROPS);
+ Cache.loadProperties(usrPropsFile);
if (usrPropsFile != null)
{
System.out.println(
showUsage();
System.exit(0);
}
- if (aparser.contains("nodisplay") || aparser.contains("nogui")
- || aparser.contains("headless"))
+ if (aparser.contains(ArgsParser.NODISPLAY)
+ || aparser.contains(ArgsParser.NOGUI)
+ || aparser.contains(ArgsParser.HEADLESS)
+ || "true".equals(System.getProperty("java.awt.headless")))
{
- System.setProperty("java.awt.headless", "true");
headless = true;
}
+
// anything else!
- final String jabawsUrl = aparser.getValue("jabaws");
+ final String jabawsUrl = aparser.getValue(ArgsParser.JABAWS);
if (jabawsUrl != null)
{
try
}
}
- String defs = aparser.getValue("setprop");
+ // check for property setting
+ String defs = aparser.getValue(ArgsParser.SETPROP);
while (defs != null)
{
int p = defs.indexOf('=');
System.out.println("Executing setprop argument: " + defs);
if (Platform.isJS())
{
- Cache.setProperty(defs.substring(0,p), defs.substring(p+1));
+ Cache.setProperty(defs.substring(0, p), defs.substring(p + 1));
}
}
- defs = aparser.getValue("setprop");
- }
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
- {
- headless = true;
+ defs = aparser.getValue(ArgsParser.SETPROP);
}
System.setProperty("http.agent",
"Jalview Desktop/" + Cache.getDefault("VERSION", "Unknown"));
"Failed to set QuaQua look and feel: " + e.toString());
}
}
- if (lookAndFeel == null || !(lookAndFeel.getClass()
- .isAssignableFrom(UIManager.getLookAndFeel().getClass()))
+ if (lookAndFeel == null
+ || !(lookAndFeel.getClass().isAssignableFrom(
+ UIManager.getLookAndFeel().getClass()))
|| !UIManager.getLookAndFeel().getClass().toString()
.toLowerCase().contains("quaqua"))
{
if (!headless)
{
- desktop = new Desktop()
-// {
-// // BH testing
-// @Override
-// protected void processEvent(AWTEvent e) {
-// System.out.println("Jalview.java " + e);
-// super.processEvent(e);
-// }
-// }
- ;
+ desktop = new Desktop();
desktop.setInBatchMode(true); // indicate we are starting up
desktop.setVisible(true);
*/
{
desktop.startServiceDiscovery();
- if (!aparser.contains("nousagestats"))
+ if (!aparser.contains(ArgsParser.NOUSAGESTATS))
{
startUsageStats(desktop);
}
System.err.println("CMD [-nousagestats] executed successfully!");
}
- if (!aparser.contains("noquestionnaire"))
+ if (!aparser.contains(ArgsParser.NOQUESTIONNAIRE))
{
- String url = aparser.getValue("questionnaire");
+ String url = aparser.getValue(ArgsParser.QUESTIONNAIRE);
if (url != null)
{
// Start the desktop questionnaire prompter with the specified
.println("CMD [-noquestionnaire] executed successfully!");
}
- if (!aparser.contains("nonews"))
+ if (!aparser.contains(ArgsParser.NONEWS))
{
desktop.checkForNews();
}
}
}
- String file = null, data = null;
+ String data = null;
FileFormatI format = null;
DataSourceType protocol = null;
FileLoader fileLoader = new FileLoader(!headless);
- String groovyscript = null; // script to execute after all loading is
+ // script to execute after all loading is
// completed one way or another
// extract groovy argument and execute if necessary
- groovyscript = aparser.getValue("groovy", true);
- file = aparser.getValue("open", true);
+ String groovyscript = aparser.getValue(ArgsParser.GROOVY, true);
+ String file = aparser.getValue(ArgsParser.OPEN, true);
if (file == null && desktop == null)
{
System.out.println("No files to open!");
System.exit(1);
}
- String vamsasImport = aparser.getValue("vdoc");
- String vamsasSession = aparser.getValue("vsess");
+ String vamsasImport = aparser.getValue(ArgsParser.VDOC);
+ String vamsasSession = aparser.getValue(ArgsParser.VSESS);
if (vamsasImport != null || vamsasSession != null)
{
if (desktop == null || headless)
System.out.println("CMD [-open " + file + "] executed successfully!");
if (!Platform.isJS())
- /**
- * ignore in JavaScript -- can't just file existence - could load it?
- *
- * @j2sIgnore
- */
+ /**
+ * ignore in JavaScript -- can't just check file existence - could load
+ * it?
+ *
+ * @j2sIgnore
+ */
{
if (!file.startsWith("http://") && !file.startsWith("https://"))
// BH 2019 added https check for Java
}
}
- protocol = AppletFormatAdapter.checkProtocol(file);
+ protocol = AppletFormatAdapter.checkProtocol(file);
try
{
else
{
setCurrentAlignFrame(af);
- data = aparser.getValue("colour", true);
+ data = aparser.getValue(ArgsParser.COLOUR, true);
if (data != null)
{
data.replaceAll("%20", " ");
- ColourSchemeI cs = ColourSchemeProperty
- .getColourScheme(af.getViewport(),
- af.getViewport().getAlignment(), data);
+ ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
+ af.getViewport(), af.getViewport().getAlignment(), data);
if (cs != null)
{
}
// Must maintain ability to use the groups flag
- data = aparser.getValue("groups", true);
+ data = aparser.getValue(ArgsParser.GROUPS, true);
if (data != null)
{
af.parseFeaturesFile(data,
System.out.println(
"CMD groups[-" + data + "] executed successfully!");
}
- data = aparser.getValue("features", true);
+ data = aparser.getValue(ArgsParser.FEATURES, true);
if (data != null)
{
af.parseFeaturesFile(data,
"CMD [-features " + data + "] executed successfully!");
}
- data = aparser.getValue("annotations", true);
+ data = aparser.getValue(ArgsParser.ANNOTATIONS, true);
if (data != null)
{
af.loadJalviewDataFile(data, null, null, null);
"CMD [-annotations " + data + "] executed successfully!");
}
// set or clear the sortbytree flag.
- if (aparser.contains("sortbytree"))
+ if (aparser.contains(ArgsParser.SORTBYTREE))
{
af.getViewport().setSortByTree(true);
if (af.getViewport().getSortByTree())
System.out.println("CMD [-sortbytree] executed successfully!");
}
}
- if (aparser.contains("no-annotation"))
+ if (aparser.contains(ArgsParser.NOANNOTATION)
+ || aparser.contains(ArgsParser.NOANNOTATION2))
{
af.getViewport().setShowAnnotation(false);
if (!af.getViewport().isShowAnnotation())
System.out.println("CMD no-annotation executed successfully!");
}
}
- if (aparser.contains("nosortbytree"))
+ if (aparser.contains(ArgsParser.NOSORTBYTREE))
{
af.getViewport().setSortByTree(false);
if (!af.getViewport().getSortByTree())
.println("CMD [-nosortbytree] executed successfully!");
}
}
- data = aparser.getValue("tree", true);
+ data = aparser.getValue(ArgsParser.TREE, true);
if (data != null)
{
try
String imageName = "unnamed.png";
while (aparser.getSize() > 1)
{
+ // PNG filename
+ // SVG filename
+ // HTML filename
+ // biojsmsa filename
String outputFormat = aparser.nextValue();
file = aparser.nextValue();
/**
* start a User Config prompt asking if we can log usage statistics.
*/
- PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop,
- "USAGESTATS", "Jalview Usage Statistics",
+ PromptUserConfig prompter = new PromptUserConfig(
+ Desktop.getDesktopPane(), "USAGESTATS",
+ "Jalview Usage Statistics",
"Do you want to help make Jalview better by enabling "
+ "the collection of usage statistics with Google Analytics ?"
+ "\n\n(you can enable or disable usage tracking in the preferences)",
}
}
- public static boolean isHeadlessMode()
- {
- String isheadless = System.getProperty("java.awt.headless");
- if (isheadless != null && isheadless.equalsIgnoreCase("true"))
- {
- return true;
- }
- return false;
- }
-
public AlignFrame[] getAlignFrames()
{
return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
}
}
- public static AlignFrame getCurrentAlignFrame()
- {
- return Jalview.currentAlignFrame;
- }
-
- public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
- {
- Jalview.currentAlignFrame = currentAlignFrame;
- }
}
this.settings = defaults;
this.isComplexAlignFile = format.isComplexAlignFile();
init(viewport.hasHiddenRows(), viewport.hasHiddenColumns());
- dialog = JvOptionPane.newOptionDialog(Desktop.desktop);
+ dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane());
}
/**
});
buildColourMenu();
- if (Desktop.desktop != null)
+ if (Desktop.getDesktopPane() != null)
{
this.setDropTarget(new java.awt.dnd.DropTarget(this, this));
if (!Platform.isJS())
private void addServiceListeners()
{
final java.beans.PropertyChangeListener thisListener;
- Desktop.instance.addJalviewPropertyChangeListener("services",
+ Desktop.getInstance().addJalviewPropertyChangeListener("services",
thisListener = new java.beans.PropertyChangeListener()
{
@Override
javax.swing.event.InternalFrameEvent evt)
{
// System.out.println("deregistering discoverer listener");
- Desktop.instance.removeJalviewPropertyChangeListener("services",
+ Desktop.getInstance().removeJalviewPropertyChangeListener("services",
thisListener);
closeMenuItem_actionPerformed(true);
}
@Override
public void addFromFile_actionPerformed(ActionEvent e)
{
- Desktop.instance.inputLocalFileMenuItem_actionPerformed(viewport);
+ Desktop.getInstance().inputLocalFileMenuItem_actionPerformed(viewport);
}
@Override
// file is reloaded.
if (FileFormat.Jalview.equals(currentFileFormat))
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
for (int i = 0; i < frames.length; i++)
{
if (frames[i] instanceof AlignFrame && frames[i] != this
try
{
frames[i].setSelected(true);
- Desktop.instance.closeAssociatedWindows();
+ Desktop.getInstance().closeAssociatedWindows();
} catch (java.beans.PropertyVetoException ex)
{
}
}
}
- Desktop.instance.closeAssociatedWindows();
+ Desktop.getInstance().closeAssociatedWindows();
FileLoader loader = new FileLoader();
DataSourceType protocol = fileName.startsWith("http:")
@Override
public void addFromText_actionPerformed(ActionEvent e)
{
- Desktop.instance
+ Desktop.getInstance()
.inputTextboxMenuItem_actionPerformed(viewport.getAlignPanel());
}
@Override
public void addFromURL_actionPerformed(ActionEvent e)
{
- Desktop.instance.inputURLMenuItem_actionPerformed(viewport);
+ Desktop.getInstance().inputURLMenuItem_actionPerformed(viewport);
}
@Override
// todo is this (2005) test now obsolete - value is never null?
while (currentFileFormat == null)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.select_file_format_before_saving"),
MessageManager.getString("label.file_format_not_specified"),
.setContents(new StringSelection(""), null);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss,
- Desktop.instance);
+ Desktop.getInstance());
} catch (OutOfMemoryError er)
{
new OOMWarning("copying region", er);
+ 1) == viewport.getAlignment().getWidth()) ? true : false;
if (wholeHeight && wholeWidth)
{
- JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop);
+ JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane());
dialog.setResponseHandler(0, okAction); // 0 = OK_OPTION
Object[] options = new Object[] { MessageManager.getString("action.ok"),
MessageManager.getString("action.cancel") };
@Override
public void gatherViews_actionPerformed(ActionEvent e)
{
- Desktop.instance.gatherViews(this);
+ Desktop.getInstance().gatherViews(this);
}
/**
{
if (_s.getLength() < sg.getEndRes())
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString(
"label.selected_region_to_tree_may_only_contain_residues_or_gaps"),
MessageManager.getString(
viewport.setCurrentTree(showNewickTree(fin, filePath).getTree());
} catch (Exception ex)
{
- JvOptionPane.showMessageDialog(Desktop.desktop, ex.getMessage(),
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), ex.getMessage(),
MessageManager
.getString("label.problem_reading_tree_file"),
JvOptionPane.WARNING_MESSAGE);
}
if (fin != null && fin.hasWarningMessage())
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
fin.getWarningMessage(),
MessageManager.getString(
"label.possible_problem_with_tree_file"),
final String errorTitle = MessageManager
.getString("label.implementation_error")
+ MessageManager.getString("label.translation_failed");
- JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
JvOptionPane.ERROR_MESSAGE);
return;
}
"label.select_at_least_three_bases_in_at_least_one_sequence_to_cDNA_translation");
final String errorTitle = MessageManager
.getString("label.translation_failed");
- JvOptionPane.showMessageDialog(Desktop.desktop, msg, errorTitle,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msg, errorTitle,
JvOptionPane.WARNING_MESSAGE);
}
else
PDBEntry pe = new AssociatePdbFileWithSeq()
.associatePdbWithSeq(fm[0].toString(),
(DataSourceType) fm[1], toassoc, false,
- Desktop.instance);
+ Desktop.getInstance());
if (pe != null)
{
System.err.println("Associated file : "
{
// some problem - if no warning its probable that the ID matching
// process didn't work
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
tcf.getWarningMessage() == null
? MessageManager.getString(
"label.check_file_matches_sequence_ids_alignment")
+ (format != null
? "(parsing as '" + format + "' file)"
: ""),
- oom, Desktop.desktop);
+ oom, Desktop.getDesktopPane());
}
}
} catch (Exception ex)
{
System.err.println((ex.toString()));
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.couldnt_run_groovy_script"),
MessageManager.getString("label.groovy_support_failed"),
JvOptionPane.ERROR_MESSAGE);
if (align != null)
{
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.registerMappings(align.getCodonFrames());
}
if (mappings != null)
{
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
for (AlignedCodonFrame acf : mappings)
{
if (noReferencesTo(acf))
public void sendSelection()
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.sendSelection(new SequenceGroup(getSelectionGroup()),
new ColumnSelection(getColumnSelection()),
new HiddenColumns(getAlignment().getHiddenColumns()),
public StructureSelectionManager getStructureSelectionManager()
{
return StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
}
@Override
* dialog responses 0, 1, 2 (even though JOptionPane shows them
* in reverse order)
*/
- JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop)
+ JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane())
.setResponseHandler(0, new Runnable()
{
@Override
{
int seqPanelWidth = getSeqPanel().seqCanvas.getWidth();
- if (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true"))
+ if (Jalview.isHeadlessMode())
{
seqPanelWidth = alignFrame.getWidth() - getVisibleIdWidth()
- vscroll.getPreferredSize().width
updateView();
}
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(), ttl,
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(), ttl,
colourPanel.getBackground(), listener);
}
seqs, omitHidden, alignmentStartEnd);
Toolkit.getDefaultToolkit().getSystemClipboard()
- .setContents(new StringSelection(output), Desktop.instance);
+ .setContents(new StringSelection(output), Desktop.getInstance());
HiddenColumns hiddenColumns = null;
}
if (errormsgs.length() > 0)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.pdb_entries_couldnt_be_retrieved", new String[]
{ errormsgs.toString() }),
if (prompt)
{
- reply = JvOptionPane.showInternalInputDialog(Desktop.desktop,
+ reply = JvOptionPane.showInternalInputDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.couldnt_find_pdb_id_in_file"),
MessageManager.getString("label.no_pdb_id_in_file"),
SequenceGroup sg = viewport.getSelectionGroup();
if (sg != null && sg.getSize() < MIN_TREE_SELECTION)
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.you_need_at_least_n_sequences",
MIN_TREE_SELECTION),
if (!jmb.launchChimera())
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.chimera_failed"),
MessageManager.getString("label.error_loading_file"),
JvOptionPane.ERROR_MESSAGE);
if (errormsgs.length() > 0)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.pdb_entries_couldnt_be_retrieved", new Object[]
{ errormsgs.toString() }),
ActionListener al = radioItem.getActionListeners()[0];
radioItem.removeActionListener(al);
int option = JvOptionPane.showInternalConfirmDialog(
- Desktop.desktop,
+ Desktop.getDesktopPane(),
MessageManager
.getString("label.remove_from_default_list"),
MessageManager
.setGapCharacter(alignFrame.viewport.getGapCharacter());
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
/*
* register any new mappings for sequence mouseover etc
.println(MessageManager.getString("label.couldnt_read_data"));
if (!Jalview.isHeadlessMode())
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
AppletFormatAdapter.getSupportedFormats(),
MessageManager.getString("label.couldnt_read_data"),
JvOptionPane.WARNING_MESSAGE);
} catch (IOException ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, MessageManager
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), MessageManager
.formatMessage("label.couldnt_read_pasted_text", new String[]
{ ex.toString() }),
MessageManager.getString("label.error_parsing_text"),
.println(MessageManager.getString("label.couldnt_read_data"));
if (!Jalview.isHeadlessMode())
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
AppletFormatAdapter.getSupportedFormats(),
MessageManager.getString("label.couldnt_read_data"),
JvOptionPane.WARNING_MESSAGE);
*/
package jalview.gui;
-import static jalview.util.UrlConstants.SEQUENCE_ID;
-
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Cache;
* @author $author$
* @version $Revision: 1.155 $
*/
+@SuppressWarnings("serial")
public class Desktop extends jalview.jbgui.GDesktop
implements DropTargetListener, ClipboardOwner, IProgressIndicator,
jalview.api.StructureSelectionManagerProvider
{
- private static int DEFAULT_MIN_WIDTH = 300;
+ private final static int DEFAULT_MIN_WIDTH = 300;
- private static int DEFAULT_MIN_HEIGHT = 250;
+ private final static int DEFAULT_MIN_HEIGHT = 250;
- private static int ALIGN_FRAME_DEFAULT_MIN_WIDTH = 600;
+ private final static int ALIGN_FRAME_DEFAULT_MIN_WIDTH = 600;
- private static int ALIGN_FRAME_DEFAULT_MIN_HEIGHT = 70;
+ private final static int ALIGN_FRAME_DEFAULT_MIN_HEIGHT = 70;
- private static final String EXPERIMENTAL_FEATURES = "EXPERIMENTAL_FEATURES";
+ private final static String EXPERIMENTAL_FEATURES = "EXPERIMENTAL_FEATURES";
private JalviewChangeSupport changeSupport = new JalviewChangeSupport();
/**
* news reader - null if it was never started.
*/
- private BlogReader jvnews = null;
+ BlogReader jvnews = null;
private File projectFile;
listener);
}
- /** Singleton Desktop instance */
- public static Desktop instance;
+ /**
+ * Singleton Desktop instance only in Java;
+ */
+ private static Desktop instance;
- public static MyDesktopPane desktop;
+ public static Desktop getInstance()
+ {
+ Desktop d;
+ @SuppressWarnings("unused")
+ ThreadGroup g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative d = g._jalviewDesktopInstance;
+ */
+ {
+ d = instance;
+ }
+ return d;
+ }
- public static MyDesktopPane getDesktop()
+ private static void setInstance(Desktop d)
{
- // BH 2018 could use currentThread() here as a reference to a
- // Hashtable<Thread, MyDesktopPane> in JavaScript
- return desktop;
+ @SuppressWarnings("unused")
+ ThreadGroup g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2s g._jalviewDesktopInstance = d;
+ */
+ {
+ instance = d;
+ }
+ }
+
+ private MyDesktopPane desktopPane;
+
+ public static MyDesktopPane getDesktopPane()
+ {
+ return getInstance().desktopPane;
+ }
+
+ private void setDesktopPane(MyDesktopPane pane)
+ {
+ getInstance().desktopPane = pane;
}
static int openFrameCount = 0;
} catch (NullPointerException npe)
{
Point p = getMousePosition();
- instance.showPasteMenu(p.x, p.y);
+ getInstance().showPasteMenu(p.x, p.y);
}
}
public void endDraggingFrame(JComponent f)
{
delegate.endDraggingFrame(f);
- desktop.repaint();
+ getDesktopPane().repaint();
}
@Override
public void endResizingFrame(JComponent f)
{
delegate.endResizingFrame(f);
- desktop.repaint();
+ getDesktopPane().repaint();
}
@Override
* block are spawned off as threads rather than waited for during this
* constructor.
*/
- instance = this;
+ setInstance(this);
if (!Platform.isJS())
{
doVamsasClientCheck();
false);
boolean showjconsole = jalview.bin.Cache.getDefault("SHOW_JAVA_CONSOLE",
false);
- desktop = new MyDesktopPane(selmemusage);
+ setDesktopPane(new MyDesktopPane(selmemusage));
showMemusage.setSelected(selmemusage);
- desktop.setBackground(Color.white);
+ getDesktopPane().setBackground(Color.white);
getContentPane().setLayout(new BorderLayout());
// alternate config - have scrollbars - see notes in JAL-153
// JScrollPane sp = new JScrollPane();
getRootPane().putClientProperty("swingjs.overflow.hidden", "false");
}
- getContentPane().add(desktop, BorderLayout.CENTER);
- desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
+ getContentPane().add(getDesktopPane(), BorderLayout.CENTER);
+ getDesktopPane().setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
// This line prevents Windows Look&Feel resizing all new windows to maximum
// if previous window was maximised
- desktop.setDesktopManager(new MyDesktopManager(
+ getDesktopPane().setDesktopManager(new MyDesktopManager(
(Platform.isWindowsAndNotJS() ? new DefaultDesktopManager()
: Platform.isAMacAndNotJS()
? new AquaInternalFrameManager(
- desktop.getDesktopManager())
- : desktop.getDesktopManager())));
+ getDesktopPane().getDesktopManager())
+ : getDesktopPane().getDesktopManager())));
Rectangle dims = getLastKnownDimensions("");
if (dims != null)
}
- this.setDropTarget(new java.awt.dnd.DropTarget(desktop, this));
+ this.setDropTarget(new java.awt.dnd.DropTarget(getDesktopPane(), this));
this.addWindowListener(new WindowAdapter()
{
}
}
});
- desktop.addMouseListener(ma);
+ getDesktopPane().addMouseListener(ma);
}
public void run()
{
Cache.log.debug("Downloading data from identifiers.org");
- UrlDownloadClient client = new UrlDownloadClient();
+ // UrlDownloadClient client = new UrlDownloadClient();
try
{
- client.download(IdOrgSettings.getUrl(),
+ UrlDownloadClient.download(IdOrgSettings.getUrl(),
IdOrgSettings.getDownloadLocation());
} catch (IOException e)
{
showNews(showNews.isSelected());
}
- void showNews(boolean visible)
+ protected void showNews(boolean visible)
{
Cache.log.debug((visible ? "Showing" : "Hiding") + " news.");
showNews.setSelected(visible);
public void run()
{
long now = System.currentTimeMillis();
- Desktop.instance.setProgressBar(
+ Desktop.getInstance().setProgressBar(
MessageManager.getString("status.refreshing_news"), now);
jvnews.refreshNews();
- Desktop.instance.setProgressBar(null, now);
+ Desktop.getInstance().setProgressBar(null, now);
jvnews.showNews();
}
}).start();
}
}
- void showPasteMenu(int x, int y)
+ protected void showPasteMenu(int x, int y)
{
JPopupMenu popup = new JPopupMenu();
JMenuItem item = new JMenuItem(
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (instance == null || (System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true")))
+ if (instance == null || Jalview.isHeadlessMode())
{
return;
}
* add an entry for the new frame in the Window menu
* (and remove it when the frame is closed)
*/
- final JMenuItem menuItem = new JMenuItem(title);
+ JMenuItem menuItem = new JMenuItem(title);
frame.addInternalFrameListener(new InternalFrameAdapter()
{
@Override
public void internalFrameActivated(InternalFrameEvent evt)
{
- JInternalFrame itf = desktop.getSelectedFrame();
+ JInternalFrame itf = getDesktopPane().getSelectedFrame();
if (itf != null)
{
if (itf instanceof AlignFrame)
{
menuItem.removeActionListener(menuItem.getActionListeners()[0]);
}
- windowMenu.remove(menuItem);
+ getInstance().windowMenu.remove(menuItem);
};
});
setKeyBindings(frame);
- desktop.add(frame);
+ getDesktopPane().add(frame);
- windowMenu.add(menuItem);
+ getInstance().windowMenu.add(menuItem);
frame.toFront();
try
*/
private static void setKeyBindings(JInternalFrame frame)
{
- @SuppressWarnings("serial")
final Action closeAction = new AbstractAction()
{
@Override
{
String msg = MessageManager
.formatMessage("label.couldnt_locate", url);
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, msg,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
+ msg,
MessageManager.getString("label.url_not_found"),
JvOptionPane.WARNING_MESSAGE);
};
String dialogOption = MessageManager
.getString("label.input_alignment_from_url");
- JvOptionPane.newOptionDialog(desktop).setResponseHandler(0, action)
+ JvOptionPane.newOptionDialog(getDesktopPane())
+ .setResponseHandler(0, action)
.showInternalDialog(panel, dialogOption,
JvOptionPane.YES_NO_CANCEL_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options,
public void aboutMenuItem_actionPerformed(ActionEvent e)
{
// StringBuffer message = getAboutMessage(false);
- // JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ // JvOptionPane.showInternalMessageDialog(Desktop.getDesktop(),
//
// message.toString(), "About Jalview", JvOptionPane.INFORMATION_MESSAGE);
new Thread(new Runnable()
public void closeAll_actionPerformed(ActionEvent e)
{
// TODO show a progress bar while closing?
- JInternalFrame[] frames = desktop.getAllFrames();
+ JInternalFrame[] frames = getDesktopPane().getAllFrames();
for (int i = 0; i < frames.length; i++)
{
try
@Override
protected void showMemusage_actionPerformed(ActionEvent e)
{
- desktop.showMemoryUsage(showMemusage.isSelected());
+ getDesktopPane().showMemoryUsage(showMemusage.isSelected());
}
/*
void reorderAssociatedWindows(boolean minimize, boolean close)
{
- JInternalFrame[] frames = desktop.getAllFrames();
+ JInternalFrame[] frames = getDesktopPane().getAllFrames();
if (frames == null || frames.length < 1)
{
return;
saveState_actionPerformed(true);
}
- private void setProjectFile(File choice)
+ protected void setProjectFile(File choice)
{
this.projectFile = choice;
}
{
Cache.log.error(
"Problems whilst loading project from " + choice, ex);
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.error_whilst_loading_project_from",
new Object[]
*/
public static AlignmentPanel[] getAlignmentPanels(String alignmentId)
{
- if (Desktop.desktop == null)
+ if (Desktop.getDesktopPane() == null)
{
// no frames created and in headless mode
// TODO: verify that frames are recoverable when in headless mode
public static AlignmentViewport[] getViewports(String sequenceSetId)
{
List<AlignmentViewport> viewp = new ArrayList<>();
- if (desktop != null)
+ if (getDesktopPane() != null)
{
AlignFrame[] frames = Desktop.getAlignFrames();
{
source.viewport.setGatherViewsHere(true);
source.viewport.setExplodedGeometry(source.getBounds());
- JInternalFrame[] frames = desktop.getAllFrames();
+ JInternalFrame[] frames = getDesktopPane().getAllFrames();
String viewId = source.viewport.getSequenceSetId();
for (int t = 0; t < frames.length; t++)
String fle = chooser.getSelectedFile().toString();
if (!vamsasImport(chooser.getSelectedFile()))
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.couldnt_import_as_vamsas_session",
new Object[]
removeProgressPanel(progpanel);
if (warnmsg != null)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
warnmsg, warnttl, JvOptionPane.ERROR_MESSAGE);
}
public JInternalFrame[] getAllFrames()
{
- return desktop.getAllFrames();
+ return getDesktopPane().getAllFrames();
}
/**
while (li.hasNext())
{
String link = li.next();
- if (link.contains(SEQUENCE_ID)
+ if (link.contains(UrlConstants.SEQUENCE_ID)
&& !UrlConstants.isDefaultString(link))
{
check = true;
});
msgPanel.add(jcb);
- JvOptionPane.showMessageDialog(Desktop.desktop, msgPanel,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), msgPanel,
MessageManager
.getString("label.SEQUENCE_ID_no_longer_used"),
JvOptionPane.WARNING_MESSAGE);
{
if (Jalview.isHeadlessMode())
{
- // Desktop.desktop is null in headless mode
- return new AlignFrame[] { Jalview.currentAlignFrame };
+ // Desktop.getDesktop() is null in headless mode
+ return new AlignFrame[] { Jalview.getCurrentAlignFrame() };
}
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
if (frames == null)
{
*/
public GStructureViewer[] getJmols()
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
if (frames == null)
{
} catch (Exception ex)
{
jalview.bin.Cache.log.error("Groovy Shell Creation failed.", ex);
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.couldnt_create_groovy_shell"),
MessageManager.getString("label.groovy_support_failed"),
/**
* Open the Groovy console
*/
- void openGroovyConsole()
+ private void openGroovyConsole()
{
if (groovyConsole == null)
{
*/
public static AlignFrame getAlignFrameFor(AlignViewportI viewport)
{
- if (desktop != null)
+ if (getDesktopPane() != null)
{
AlignmentPanel[] aps = getAlignmentPanels(
viewport.getSequenceSetId());
if (discoverer == null)
{
discoverer = new jalview.ws.jws1.Discoverer();
- // register PCS handler for desktop.
+ // register PCS handler for getDesktop().
discoverer.addPropertyChangeListener(changeSupport);
}
// JAL-940 - disabled JWS1 service configuration - always start discoverer
*
* jd.waitForInput();
*/
- JvOptionPane.showConfirmDialog(Desktop.desktop,
+ JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
new JLabel("<html><table width=\"450\"><tr><td>"
+ ermsg + "</td></tr></table>"
+ "<p>It may be that you have invalid JABA URLs<br/>in your web service preferences,"
}
}
- private Runnable serviceChangedDialog = null;
+ Runnable serviceChangedDialog = null;
/**
* start a thread to open a URL in the configured browser. Pops up a warning
*/
public static void showUrl(final String url)
{
- showUrl(url, Desktop.instance);
+ showUrl(url, Desktop.getInstance());
}
/**
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
}).start();
}
- public static WsParamSetManager wsparamManager = null;
+ private WsParamSetManager wsparamManager = null;
public static ParamManager getUserParameterStore()
{
- if (wsparamManager == null)
+ Desktop d = getInstance();
+ if (d.wsparamManager == null)
{
- wsparamManager = new WsParamSetManager();
+ d.wsparamManager = new WsParamSetManager();
}
- return wsparamManager;
+ return d.wsparamManager;
}
/**
/**
* flag indicating if dialogExecutor should try to acquire a permit
*/
- private volatile boolean dialogPause = true;
+ volatile boolean dialogPause = true;
/**
* pause the queue
*/
- private java.util.concurrent.Semaphore block = new Semaphore(0);
+ java.util.concurrent.Semaphore block = new Semaphore(0);
private static groovy.ui.Console groovyConsole;
}
;
}
- if (instance == null)
+ if (getInstance() == null)
{
return;
}
String topViewId = myTopFrame.viewport.getSequenceSetId();
String bottomViewId = myBottomFrame.viewport.getSequenceSetId();
- JInternalFrame[] frames = desktop.getAllFrames();
+ JInternalFrame[] frames = getDesktopPane().getAllFrames();
for (JInternalFrame frame : frames)
{
if (frame instanceof SplitFrame && frame != source)
* - the payload from the drop event
* @throws Exception
*/
+ @SuppressWarnings("unchecked")
public static void transferFromDropTarget(List<Object> files,
List<DataSourceType> protocols, DropTargetDropEvent evt,
Transferable t) throws Exception
{
// Works on Windows and MacOSX
Cache.log.debug("Drop handled as javaFileListFlavor");
- for (Object file : (List) t
+ for (Object file : (List<Object>) t
.getTransferData(DataFlavor.javaFileListFlavor))
{
files.add(file);
Class<? extends StructureViewerBase> structureViewerClass)
{
List<StructureViewerBase> result = new ArrayList<>();
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
+ JInternalFrame[] frames = Desktop.getInstance().getAllFrames();
for (JInternalFrame frame : frames)
{
}
return result;
}
+
}
updateColourButton(mainPanel, colour, featureColour);
};
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(),
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
title, featureColour.getColour(), listener);
}
else
* set dialog action handlers for OK (create/Amend) and Cancel options
* also for Delete if applicable (when amending features)
*/
- JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.desktop)
+ JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane())
.setResponseHandler(0, okAction).setResponseHandler(2, cancelAction);
if (!forCreate)
{
*/
boolean getFocusedViewport()
{
- if (focusfixed || Desktop.desktop == null)
+ if (focusfixed || Desktop.getDesktopPane() == null)
{
if (ap != null && av != null)
{
}
// now checks further down the window stack to fix bug
// https://mantis.lifesci.dundee.ac.uk/view.php?id=36008
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
for (int f = 0; f < frames.length; f++)
{
JInternalFrame alignFrame = frames[f];
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
JvOptionPane.WARNING_MESSAGE);
boolean block, String title, int width, int height)
{
- frame = new JDialog(Desktop.instance, modal);
+ frame = new JDialog(Desktop.getInstance(), modal);
frame.setTitle(title);
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Rectangle deskr = Desktop.instance.getBounds();
+ Rectangle deskr = Desktop.getInstance().getBounds();
frame.setBounds(new Rectangle((int) (deskr.getCenterX() - width / 2),
(int) (deskr.getCenterY() - height / 2), width, height));
}
ex.printStackTrace();
}
- dialog = JvOptionPane.newOptionDialog(Desktop.desktop);
+ dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane());
}
/**
public OOMWarning(String string, OutOfMemoryError oomerror)
{
- this(string, oomerror, Desktop.desktop);
+ this(string, oomerror, Desktop.getDesktopPane());
}
@Override
jalview.util.BrowserLauncher.openURL(url);
} catch (Exception ex)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.web_browser_not_found_unix"),
MessageManager.getString("label.web_browser_not_found"),
JvOptionPane.WARNING_MESSAGE);
refresh();
};
};
- JalviewColourChooser.showColourChooser(Desktop.getDesktop(),
+ JalviewColourChooser.showColourChooser(Desktop.getDesktopPane(),
title, Color.BLUE, listener);
}
Integer.toString(getComboIntStringKey(backupfilesPresetsCombo)));
Cache.saveProperties();
- Desktop.instance.doConfigureStructurePrefs();
+ Desktop.getInstance().doConfigureStructurePrefs();
try
{
frame.setClosed(true);
boolean valid = false;
while (!valid)
{
- if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
+ if (JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(), link,
MessageManager.getString("label.new_sequence_url_link"),
JvOptionPane.OK_CANCEL_OPTION, -1,
null) == JvOptionPane.OK_OPTION)
boolean valid = false;
while (!valid)
{
- if (JvOptionPane.showInternalConfirmDialog(Desktop.desktop, link,
+ if (JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(), link,
MessageManager.getString("label.edit_sequence_url_link"),
JvOptionPane.OK_CANCEL_OPTION, -1,
null) == JvOptionPane.OK_OPTION)
} catch (NumberFormatException x)
{
userIdWidth.setText("");
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("warn.user_defined_width_requirements"),
MessageManager.getString("label.invalid_id_column_width"),
File f = new File(chimeraPath.getText());
if (!f.canExecute())
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.invalid_chimera_path"),
MessageManager.getString("label.invalid_name"),
JvOptionPane.ERROR_MESSAGE);
if (!found)
{
String[] options = { "OK", "Help" };
- int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
+ int showHelp = JvOptionPane.showInternalOptionDialog(Desktop.getDesktopPane(),
JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.chimera_missing")),
"", JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
}
try
{
- int reply = JvOptionPane.showConfirmDialog(Desktop.desktop, // component,
+ int reply = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(), // component,
dialogText, dialogTitle,
(allowCancel) ? JvOptionPane.YES_NO_CANCEL_OPTION
: JvOptionPane.YES_NO_OPTION,
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, error,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), error,
MessageManager.getString("label.error_retrieving_data"),
JvOptionPane.WARNING_MESSAGE);
}
System.err.println("Error when loading images!");
}
} while (!mt.checkAll());
- Desktop.instance.setIconImage(logo);
+ Desktop.getInstance().setIconImage(logo);
}
} catch (Exception ex)
{
}
add(authlist, BorderLayout.CENTER);
authlist.addMouseListener(closer);
- Desktop.desktop.add(iframe);
+ Desktop.getDesktopPane().add(iframe);
refreshText();
}
@SuppressWarnings("unused")
protected boolean refreshText()
{
- String newtext = Desktop.instance.getAboutMessage(true).toString();
+ String newtext = Desktop.getInstance().getAboutMessage(true).toString();
// System.err.println("Text found: \n"+newtext+"\nEnd of newtext.");
if (oldtext != newtext.length())
{
authlist.setSize(new Dimension(750, 375));
add(authlist, BorderLayout.CENTER);
revalidate();
- iframe.setBounds((Desktop.instance.getWidth() - 750) / 2,
- (Desktop.instance.getHeight() - 375) / 2, 750,
+ iframe.setBounds((Desktop.getInstance().getWidth() - 750) / 2,
+ (Desktop.getInstance().getHeight() - 375) / 2, 750,
authlist.getHeight() + iconimg.getHeight());
iframe.validate();
iframe.setVisible(true);
}
closeSplash();
- Desktop.instance.startDialogQueue();
+ Desktop.getInstance().startDialogQueue();
}
/**
// allow about 65 pixels for Desktop decorators on Windows
int newHeight = Math.min(height,
- Desktop.instance.getHeight() - DESKTOP_DECORATORS_HEIGHT);
+ Desktop.getInstance().getHeight() - DESKTOP_DECORATORS_HEIGHT);
if (newHeight != height)
{
int oldDividerLocation = getDividerLocation();
// TODO if CommandListener is only ever 1:1 for complementary views,
// may change broadcast pattern to direct messaging (more efficient)
final StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.addCommandListener(((AlignFrame) getTopFrame()).getViewport());
ssm.addCommandListener(((AlignFrame) getBottomFrame()).getViewport());
}
adjustLayout();
final StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.addCommandListener(newTopPanel.av);
ssm.addCommandListener(newBottomPanel.av);
}
*/
protected void expandViews_actionPerformed()
{
- Desktop.instance.explodeViews(this);
+ Desktop.getInstance().explodeViews(this);
}
/**
*/
protected void gatherViews_actionPerformed()
{
- Desktop.instance.gatherViews(this);
+ Desktop.getInstance().gatherViews(this);
}
/**
*/
private void discoverStructureViews()
{
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
targetView.removeAllItems();
if (lastTargetedView != null && !lastTargetedView.isVisible())
lastTargetedView = null;
}
int linkedViewsAt = 0;
- for (StructureViewerBase view : Desktop.instance
+ for (StructureViewerBase view : Desktop.getInstance()
.getStructureViewers(null, null))
{
StructureViewer viewHandler = (lastTargetedView != null
PDBEntry fileEntry = new AssociatePdbFileWithSeq()
.associatePdbWithSeq(selectedPdbFileName,
DataSourceType.FILE, selectedSequence, true,
- Desktop.instance);
+ Desktop.getInstance());
sViewer = launchStructureViewer(
ssm, new PDBEntry[]
*/
protected List<StructureViewerBase> getViewersFor(AlignmentPanel alp)
{
- return Desktop.instance.getStructureViewers(alp, this.getClass());
+ return Desktop.getInstance().getStructureViewers(alp, this.getClass());
}
@Override
{
if (isNoSelectionMade())
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.no_colour_selection_in_scheme"),
MessageManager.getString("label.no_colour_selection_warn"),
String[] options = new String[] { title,
MessageManager.getString("label.dont_save_changes"), };
final String question = JvSwingUtils.wrapTooltip(true, message);
- int response = JvOptionPane.showOptionDialog(Desktop.desktop,
+ int response = JvOptionPane.showOptionDialog(Desktop.getDesktopPane(),
question, title, JvOptionPane.DEFAULT_OPTION,
JvOptionPane.PLAIN_MESSAGE, null, options, options[0]);
{
if (isNoSelectionMade())
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.no_colour_selection_in_scheme"),
MessageManager.getString("label.no_colour_selection_warn"),
String name = schemeName.getText().trim();
if (name.length() < 1)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager
.getString("label.user_colour_scheme_must_have_name"),
MessageManager.getString("label.no_name_colour_scheme"),
* @j2sIgnore
*/
{
- int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ int reply = JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.colour_scheme_exists_overwrite", new Object[]
{ name, name }),
+ qid + "&rid=" + rid;
jalview.bin.Cache.log
.info("Prompting user for questionnaire at " + qurl);
- int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ int reply = JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.jalview_new_questionnaire"),
MessageManager.getString("label.jalview_user_survey"),
JvOptionPane.YES_NO_OPTION, JvOptionPane.QUESTION_MESSAGE);
}
} catch (InvalidSessionDocumentException e)
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString(
"label.vamsas_doc_couldnt_be_opened_as_new_session"),
VamsasAppDatastore vds = new VamsasAppDatastore(doc, vobj2jv, jv2vobj,
baseProvEntry(), alRedoState);
// wander through frames
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
if (frames == null)
{
Cache.log.debug(
"Asking user if the vamsas session should be stored.");
int reply = JvOptionPane.showInternalConfirmDialog(
- Desktop.desktop,
+ Desktop.getDesktopPane(),
"The current VAMSAS session has unsaved data - do you want to save it ?",
"VAMSAS Session Shutdown",
JvOptionPane.YES_NO_OPTION,
if (reply == JvOptionPane.YES_OPTION)
{
Cache.log.debug("Prompting for vamsas store filename.");
- Desktop.instance.vamsasSave_actionPerformed(null);
+ Desktop.getInstance().vamsasSave_actionPerformed(null);
Cache.log
.debug("Finished attempt at storing document.");
}
public void disableGui(boolean b)
{
- Desktop.instance.setVamsasUpdate(b);
+ Desktop.getInstance().setVamsasUpdate(b);
}
Hashtable _backup_vobj2jv;
{
final IPickManager pm = vclient.getPickManager();
final StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
final VamsasApplication me = this;
pm.registerMessageHandler(new IMessageHandler()
{
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop, message,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(), message,
title, JvOptionPane.WARNING_MESSAGE);
}
public boolean showRunDialog()
{
- frame = new JDialog(Desktop.instance, true);
+ frame = new JDialog(Desktop.getInstance(), true);
frame.setTitle(MessageManager.formatMessage("label.edit_params_for",
new String[]
{ service.getActionText() }));
- Rectangle deskr = Desktop.instance.getBounds();
+ Rectangle deskr = Desktop.getInstance().getBounds();
Dimension pref = this.getPreferredSize();
frame.setBounds(
new Rectangle((int) (deskr.getCenterX() - pref.width / 2),
dialogpanel.add(canceljob);
// JAL-1580: setMaximumSize() doesn't work, so just size for the worst case:
// check for null is for JUnit usage
- final int windowHeight = Desktop.instance == null ? 540
- : Desktop.instance.getHeight();
+ final int windowHeight = Desktop.getInstance() == null ? 540
+ : Desktop.getInstance().getHeight();
setPreferredSize(new Dimension(540, windowHeight));
add(dialogpanel, BorderLayout.SOUTH);
validate();
chooser.setDialogTitle(MessageManager
.getString("label.choose_filename_for_param_file"));
chooser.setToolTipText(MessageManager.getString("action.save"));
- int value = chooser.showSaveDialog(Desktop.instance);
+ int value = chooser.showSaveDialog(Desktop.getInstance());
if (value == JalviewFileChooser.APPROVE_OPTION)
{
outfile = chooser.getSelectedFile();
File pfile = new File(filename);
if (pfile.exists() && pfile.canWrite())
{
- if (JvOptionPane.showConfirmDialog(Desktop.instance,
+ if (JvOptionPane.showConfirmDialog(Desktop.getInstance(),
"Delete the preset's file, too ?", "Delete User Preset ?",
JvOptionPane.OK_CANCEL_OPTION) == JvOptionPane.OK_OPTION)
{
boolean valid = false;
int resp = JvOptionPane.CANCEL_OPTION;
while (!valid && (resp = JvOptionPane.showInternalConfirmDialog(
- Desktop.desktop, panel, title,
+ Desktop.getDesktopPane(), panel, title,
JvOptionPane.OK_CANCEL_OPTION)) == JvOptionPane.OK_OPTION)
{
try
} catch (Exception e)
{
valid = false;
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.invalid_url"));
}
}
if (valid && resp == JvOptionPane.OK_OPTION)
{
- int validate = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
+ int validate = JvOptionPane.showInternalConfirmDialog(Desktop.getDesktopPane(),
MessageManager.getString("info.validate_jabaws_server"),
MessageManager.getString("label.test_server"),
JvOptionPane.YES_NO_OPTION);
}
else
{
- int opt = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
+ int opt = JvOptionPane.showInternalOptionDialog(Desktop.getDesktopPane(),
"The Server '" + foo.toString()
+ "' failed validation,\ndo you want to add it anyway? ",
"Server Validation Failed", JvOptionPane.YES_NO_OPTION,
}
else
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString(
"warn.server_didnt_pass_validation"));
}
if (lastrefresh != update)
{
lastrefresh = update;
- Desktop.instance.startServiceDiscovery(true); // wait around for all
+ Desktop.getInstance().startServiceDiscovery(true); // wait around for all
// threads to complete
updateList();
public void run()
{
long ct = System.currentTimeMillis();
- Desktop.instance.setProgressBar(MessageManager
+ Desktop.getInstance().setProgressBar(MessageManager
.getString("status.refreshing_web_service_menus"), ct);
if (lastrefresh != update)
{
lastrefresh = update;
- Desktop.instance.startServiceDiscovery(true);
+ Desktop.getInstance().startServiceDiscovery(true);
updateList();
}
- Desktop.instance.setProgressBar(null, ct);
+ Desktop.getInstance().setProgressBar(null, ct);
}
}).start();
MessageManager.getString("label.delete"),
MessageManager.getString("label.rename") };
- confirmButton = JvOptionPane.showOptionDialog(Desktop.desktop,
+ confirmButton = JvOptionPane.showOptionDialog(Desktop.getDesktopPane(),
messageSB.toString(),
MessageManager.getString("label.backupfiles_confirm_delete"),
JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
MessageManager.getString("label.delete"),
MessageManager.getString("label.keep") };
- confirmButton = JvOptionPane.showOptionDialog(Desktop.desktop,
+ confirmButton = JvOptionPane.showOptionDialog(Desktop.getDesktopPane(),
messageSB.toString(),
MessageManager.getString("label.backupfiles_confirm_delete"),
JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE,
Long.toString(df.length()) }));
}
- int confirmButton = JvOptionPane.showConfirmDialog(Desktop.desktop,
+ int confirmButton = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
messageSB.toString(),
MessageManager
.getString("label.backupfiles_confirm_delete"),
"label.backupfiles_confirm_save_new_saved_file_not_ok"));
}
- int confirmButton = JvOptionPane.showConfirmDialog(Desktop.desktop,
+ int confirmButton = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
messageSB.toString(),
MessageManager
.getString("label.backupfiles_confirm_save_file"),
Runtime rt = Runtime.getRuntime();
try
{
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Desktop.instance.startLoading(file);
+ Desktop.getInstance().startLoading(file);
}
if (format == null)
{
if (format == null)
{
- Desktop.instance.stopLoading();
+ Desktop.getInstance().stopLoading();
System.err.println("The input file \"" + file
+ "\" has null or unidentifiable data content!");
if (!Jalview.isHeadlessMode())
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.getString("label.couldnt_read_data")
+ " in " + file + "\n"
+ AppletFormatAdapter.getSupportedFormats(),
}
// TODO: cache any stream datasources as a temporary file (eg. PDBs
// retrieved via URL)
- if (Desktop.desktop != null && Desktop.desktop.isShowMemoryUsage())
+ if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage())
{
System.gc();
memused = (rt.maxMemory() - rt.totalMemory() + rt.freeMemory()); // free
// register PDB entries with desktop's structure selection
// manager
StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.registerPDBEntry(pdbe);
}
}
}
else
{
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Desktop.instance.stopLoading();
+ Desktop.getInstance().stopLoading();
}
final String errorMessage = MessageManager.getString(
"label.couldnt_load_file") + " " + title + "\n" + error;
// TODO: refactor FileLoader to be independent of Desktop / Applet GUI
// bits ?
- if (raiseGUI && Desktop.desktop != null)
+ if (raiseGUI && Desktop.getDesktopPane() != null)
{
javax.swing.SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
errorMessage,
MessageManager
.getString("label.error_loading_file"),
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.problems_opening_file", new String[]
{ file }),
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"warn.out_of_memory_loading_file", new String[]
{ file }),
// memory
// after
// load
- if (Desktop.desktop != null && Desktop.desktop.isShowMemoryUsage())
+ if (Desktop.getDesktopPane() != null && Desktop.getDesktopPane().isShowMemoryUsage())
{
if (alignFrame != null)
{
}
}
// remove the visual delay indicator
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Desktop.instance.stopLoading();
+ Desktop.getInstance().stopLoading();
}
}
import jalview.api.AlignExportSettingsI;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.datamodel.AlignExportSettingsAdapter;
import jalview.datamodel.AlignmentExportData;
import jalview.gui.AlignmentPanel;
protected void setProgressMessage(String message)
{
- if (pIndicator != null && !isHeadless())
+ if (pIndicator != null && !Jalview.isHeadlessMode())
{
pIndicator.setProgressBar(message, pSessionId);
}
}
}
- /**
- * Answers true if HTML export is invoke in headless mode or false otherwise
- *
- * @return
- */
- protected boolean isHeadless()
- {
- return System.getProperty("java.awt.headless") != null
- && System.getProperty("java.awt.headless").equals("true");
- }
+ // /**
+ // * Answers true if HTML export is invoke in headless mode or false otherwise
+ // *
+ // * @return
+ // */
+ // protected boolean isHeadless()
+ // {
+ // return System.getProperty("java.awt.headless") != null
+ // && System.getProperty("java.awt.headless").equals("true");
+ // }
/**
* This method provides implementation of consistent behaviour which should
*/
protected void exportCompleted()
{
- if (isLaunchInBrowserAfterExport() && !isHeadless())
+ if (isLaunchInBrowserAfterExport() && !Jalview.isHeadlessMode())
{
try
{
package jalview.io;
import jalview.bin.Cache;
+import jalview.bin.Jalview;
import jalview.gui.AlignmentPanel;
import jalview.gui.LineartOptions;
import jalview.gui.OOMWarning;
/*
* Prompt for character rendering style if preference is not set
*/
- if (renderStyle.equalsIgnoreCase("Prompt each time") && !isHeadless())
+ if (renderStyle.equalsIgnoreCase("Prompt each time")
+ && !Jalview.isHeadlessMode())
{
LineartOptions svgOption = new LineartOptions("HTML", textOption);
svgOption.setResponseAction(1, new Runnable()
// /SAVE THE TREES
// /////////////////////////////////
// FIND ANY ASSOCIATED TREES
- if (Desktop.desktop != null)
+ if (Desktop.getDesktopPane() != null)
{
- javax.swing.JInternalFrame[] frames = Desktop.instance
+ javax.swing.JInternalFrame[] frames = Desktop.getInstance()
.getAllFrames();
for (int t = 0; t < frames.length; t++)
if (mappings != null)
{
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.registerMappings(mappings);
}
}
{
// This must be outside the run() body as java 1.5
// will not return any value from the OptionPane to the expired thread.
- int reply = JvOptionPane.showConfirmDialog(Desktop.desktop,
+ int reply = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
"Automatically update suggested ids?",
"Auto replace sequence ids", JvOptionPane.YES_NO_OPTION);
}
bindjvvobj(mapping, sequenceMapping);
jalview.structure.StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.registerMapping(acf);
// Try to link up any conjugate database references in the two sequences
// matchConjugateDBRefs(from, to, mapping);
showTranslation
.setText(MessageManager.getString("label.translate_cDNA"));
boolean first = true;
- for (final GeneticCodeI table : GeneticCodes.getInstance()
- .getCodeTables())
+ for (final GeneticCodeI table : GeneticCodes.getCodeTables())
{
JMenuItem item = new JMenuItem(table.getId() + " " + table.getName());
showTranslation.add(item);
import javax.swing.JMenuItem;
/**
- * DOCUMENT ME!
+ * abstract class super to jalview.gui.Desktop
*
- * @author $author$
- * @version $Revision$
*/
@SuppressWarnings("serial")
-public class GDesktop extends JFrame
+public abstract class GDesktop extends JFrame
{
- protected static JMenu windowMenu = new JMenu();
+ public JMenu windowMenu = new JMenu(); // BH 2019.05.07 was static
JMenuBar desktopMenubar = new JMenuBar();
protected JCheckBoxMenuItem showConsole = new JCheckBoxMenuItem();
- protected JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
+ public JCheckBoxMenuItem showNews = new JCheckBoxMenuItem();
protected JMenuItem snapShotWindow = new JMenuItem();
*/
public GDesktop()
{
- super();
try
{
jbInit();
boolean ret = false;
String warningMessage = MessageManager
.getString("label.warning_confirm_change_reverse");
- int confirm = JvOptionPane.showConfirmDialog(Desktop.desktop,
+ int confirm = JvOptionPane.showConfirmDialog(Desktop.getDesktopPane(),
warningMessage,
MessageManager.getString("label.change_increment_decrement"),
JvOptionPane.YES_NO_OPTION, JvOptionPane.WARNING_MESSAGE);
return true;
}
- JvOptionPane.showInternalMessageDialog(jalview.gui.Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(jalview.gui.Desktop.getDesktopPane(),
MessageManager.getString("warn.url_must_contain"),
MessageManager.getString("label.invalid_url"),
JvOptionPane.WARNING_MESSAGE);
public void notifyDuplicate()
{
- JvOptionPane.showInternalMessageDialog(jalview.gui.Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(jalview.gui.Desktop.getDesktopPane(),
MessageManager.getString("warn.name_cannot_be_duplicate"),
MessageManager.getString("label.invalid_name"),
JvOptionPane.WARNING_MESSAGE);
* only view *should* be coped with sensibly.
*/
// This must have been loaded, is it still visible?
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
String matchedFile = null;
for (int f = frames.length - 1; f > -1; f--)
{
{
// FIND ANY ASSOCIATED TREES
// NOT IMPLEMENTED FOR HEADLESS STATE AT PRESENT
- if (Desktop.desktop != null)
+ if (Desktop.getDesktopPane() != null)
{
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
for (int t = 0; t < frames.length; t++)
{
/*
* save PCA viewers
*/
- if (!storeDS && Desktop.desktop != null)
+ if (!storeDS && Desktop.getDesktopPane() != null)
{
- for (JInternalFrame frame : Desktop.desktop.getAllFrames())
+ for (JInternalFrame frame : Desktop.getDesktopPane().getAllFrames())
{
if (frame instanceof PCAPanel)
{
final SequenceI jds, List<String> viewIds, AlignmentPanel ap,
boolean storeDataset)
{
- if (Desktop.desktop == null)
+ if (Desktop.getDesktopPane() == null)
{
return;
}
- JInternalFrame[] frames = Desktop.desktop.getAllFrames();
+ JInternalFrame[] frames = Desktop.getDesktopPane().getAllFrames();
for (int f = frames.length - 1; f > -1; f--)
{
if (frames[f] instanceof AppVarna)
{
// used to attempt to parse as V1 castor-generated xml
}
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Desktop.instance.stopLoading();
+ Desktop.getInstance().stopLoading();
}
if (af != null)
{
*/
for (AlignFrame fr : gatherToThisFrame.values())
{
- Desktop.instance.gatherViews(fr);
+ Desktop.getInstance().gatherViews(fr);
}
restoreSplitFrames();
if (ds.getCodonFrames() != null)
{
StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.registerMappings(ds.getCodonFrames());
}
}
reportErrors();
}
- if (Desktop.instance != null)
+ if (Desktop.getInstance() != null)
{
- Desktop.instance.stopLoading();
+ Desktop.getInstance().stopLoading();
}
return af;
*/
for (SplitFrame sf : gatherTo)
{
- Desktop.instance.gatherViews(sf);
+ Desktop.getInstance().gatherViews(sf);
}
splitFrameCandidates.clear();
@Override
public void run()
{
- JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+ JvOptionPane.showInternalMessageDialog(Desktop.getDesktopPane(),
finalErrorMessage,
"Error " + (saving ? "saving" : "loading")
+ " Jalview file",
entry.setProperty(prop.getName(), prop.getValue());
}
StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance)
+ .getStructureSelectionManager(Desktop.getInstance())
.registerPDBEntry(entry);
// adds PDBEntry to datasequence's set (since Jalview 2.10)
if (al.getSequenceAt(i).getDatasetSequence() != null)
int height = safeInt(structureState.getHeight());
// Probably don't need to do this anymore...
- // Desktop.desktop.getComponentAt(x, y);
+ // Desktop.getDesktop().getComponentAt(x, y);
// TODO: NOW: check that this recovers the PDB file correctly.
String pdbFile = loadPDBFile(jprovider, pdbid.getId(),
pdbid.getFile());
{
try
{
- frames = Desktop.desktop.getAllFrames();
+ frames = Desktop.getDesktopPane().getAllFrames();
} catch (ArrayIndexOutOfBoundsException e)
{
// occasional No such child exceptions are thrown here...
public static String codonTranslate(String lccodon)
{
- String peptide = GeneticCodes.getInstance().getStandardCodeTable()
- .translate(lccodon);
+ String peptide = GeneticCodes.getStandardCodeTable().translate(lccodon);
if ("*".equals(peptide))
{
return "STOP";
private static Boolean isNoJSMac = null, isNoJSWin = null, isMac = null,
isWin = null;
- private static Boolean isHeadless = null;
+ // private static Boolean isHeadless = null;
/**
* added to group mouse events into Windows and nonWindows (mac, unix, linux)
return (isNoJSWin == null ? (isNoJSWin = !isJS && isWin()) : isNoJSWin);
}
- /**
- *
- * @return true if we are running in non-interactive no UI mode
- */
- public static boolean isHeadless()
- {
- if (isHeadless == null)
- {
- isHeadless = "true".equals(System.getProperty("java.awt.headless"));
- }
- return isHeadless;
- }
+ // /**
+ // *
+ // * @return true if we are running in non-interactive no UI mode
+ // */
+ // public static boolean isHeadless()
+ // {
+ // if (isHeadless == null)
+ // {
+ // isHeadless = "true".equals(System.getProperty("java.awt.headless"));
+ // }
+ // return isHeadless;
+ // }
/**
*
// JBPNote - should do this a better way!
if (f.getFaultReason().indexOf("(407)") > -1)
{
- if (jalview.gui.Desktop.desktop != null)
+ if (jalview.gui.Desktop.getDesktopPane() != null)
{
- JvOptionPane.showMessageDialog(jalview.gui.Desktop.desktop,
+ JvOptionPane.showMessageDialog(jalview.gui.Desktop.getDesktopPane(),
MessageManager.getString("label.set_proxy_settings"),
MessageManager
.getString("label.proxy_authorization_failed"),
} catch (Exception ex)
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.secondary_structure_prediction_service_couldnt_be_located",
new String[]
alignFrame = _alignFrame;
if (!sh.getAbstractName().equals("MsaWS"))
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.service_called_is_not_msa_service",
new String[]
if ((wsInfo = setWebService(sh)) == null)
{
- JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), MessageManager
.formatMessage("label.msa_service_is_unknown", new String[]
{ sh.getName() }),
MessageManager.getString("label.internal_jalview_error"),
// name to service client name
if (!sh.getAbstractName().equals(this.getServiceActionKey()))
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.service_called_is_not_seq_search_service",
new String[]
if ((wsInfo = setWebService(sh)) == null)
{
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.seq_search_service_is_unknown", new String[]
{ sh.getName() }),
if (!(sh.service instanceof MsaWS))
{
// redundant at mo - but may change
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
MessageManager.formatMessage(
"label.service_called_is_not_msa_service",
new String[]
server = (MsaWS) sh.service;
if ((wsInfo = setWebService(sh, false)) == null)
{
- JvOptionPane.showMessageDialog(Desktop.desktop, MessageManager
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(), MessageManager
.formatMessage("label.msa_service_is_unknown", new String[]
{ sh.serviceType }),
MessageManager.getString("label.internal_jalview_error"),
// dan changed! dan test. comment out if conditional
// if (alignFrame.getViewport().getAlignment().isNucleotide())
// {
- // JvOptionPane.showMessageDialog(Desktop.desktop, sh.serviceType
+ // JvOptionPane.showMessageDialog(Desktop.getDesktop(), sh.serviceType
// + " can only be used\nfor amino acid alignments.",
// "Wrong type of sequences!", JvOptionPane.WARNING_MESSAGE);
// return;
@Override
public void actionPerformed(ActionEvent arg0)
{
- Desktop.instance.showUrl(service.docUrl);
+ Desktop.getInstance().showUrl(service.docUrl);
}
});
annotservice.setToolTipText(
try
{
paramStore = new JabaParamStore(this,
- (Desktop.instance != null ? Desktop.getUserParameterStore()
+ (Desktop.getInstance() != null ? Desktop.getUserParameterStore()
: null));
} catch (Exception ex)
{
else
{
// TODO: try to tell the user why the job couldn't be started.
- JvOptionPane.showMessageDialog(Desktop.desktop,
+ JvOptionPane.showMessageDialog(Desktop.getDesktopPane(),
(jobsthread.hasWarnings() ? jobsthread.getWarnings()
: MessageManager.getString(
"label.job_couldnt_be_started_check_input")),
Iterator<int[]> contigs = cs.getVisContigsIterator(0, alf.getWidth(),
false);
Dna dna = new Dna(av, contigs);
- AlignmentI translated = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI translated = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
assertNotNull("Couldn't do a full width translation of test data.",
translated);
}
alf.getWidth(), false);
AlignViewportI av = new AlignViewport(alf, cs);
Dna dna = new Dna(av, vcontigs);
- AlignmentI transAlf = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI transAlf = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
assertTrue("Translation failed (ipos=" + ipos
+ ") No alignment data.", transAlf != null);
Iterator<int[]> contigs = cs.getVisContigsIterator(0, alf.getWidth(),
false);
Dna dna = new Dna(av, contigs);
- AlignmentI translated = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI translated = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
String aa = translated.getSequenceAt(0).getSequenceAsString();
assertEquals(
"AAAACCDDEEFFGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVWYY***",
Iterator<int[]> contigs = cs.getVisContigsIterator(0, alf.getWidth(),
false);
Dna dna = new Dna(av, contigs);
- AlignmentI translated = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI translated = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
String aa = translated.getSequenceAt(0).getSequenceAsString();
assertEquals("AACDDGGGGHHIIIKKLLLLLLMNNPPPPQQRRRRRRSSSSSSTTTTVVVVW", aa);
}
Iterator<int[]> contigs = cs.getVisContigsIterator(0, cdna.getWidth(),
false);
Dna dna = new Dna(av, contigs);
- AlignmentI translated = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI translated = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
/*
* Jumble the cDNA sequences and translate.
av = new AlignViewport(cdnaReordered, cs);
contigs = cs.getVisContigsIterator(0, cdna.getWidth(), false);
dna = new Dna(av, contigs);
- AlignmentI translated2 = dna.translateCdna(GeneticCodes.getInstance()
- .getStandardCodeTable());
+ AlignmentI translated2 = dna
+ .translateCdna(GeneticCodes.getStandardCodeTable());
/*
* Check translated sequences are the same in both alignments.
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ jalview.gui.Desktop.getInstance().closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" })
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
}
@AfterMethod(alwaysRun = true)
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
}
/**
* remove any sequence mappings left lying around by other tests
*/
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.resetAll();
}
* mappings
*/
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
List<AlignedCodonFrame> sequenceMappings = ssm.getSequenceMappings();
assertEquals(2, sequenceMappings.size());
assertTrue(sequenceMappings.contains(acf1));
@Test(groups = { "Functional" })
public void testDeregisterMapping_withNoReference()
{
- Desktop d = Desktop.instance;
+ Desktop d = Desktop.getInstance();
assertNotNull(d);
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.resetAll();
AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded(
@Test(groups = { "Functional" })
public void testDeregisterMapping_withReference()
{
- Desktop d = Desktop.instance;
+ Desktop d = Desktop.getInstance();
assertNotNull(d);
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.resetAll();
AlignFrame af1 = new FileLoader().LoadFileWaitTillLoaded(
doStuffInJalview(f);
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
checkUsedMemory(35L);
}
* sanity check - fails if any frame was added after
* closeAll_actionPerformed
*/
- assertEquals(Desktop.instance.getAllFrames().length, 0);
+ assertEquals(Desktop.getInstance().getAllFrames().length, 0);
/*
* if this assertion fails
@AfterMethod(alwaysRun = true)
public void tearDown()
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
}
@Test(groups = "Functional")
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ jalview.gui.Desktop.getInstance().closeAll_actionPerformed(null);
}
{
// retrieve dbref
- SequenceFetcher sf = new SequenceFetcher(Desktop.instance,
+ SequenceFetcher sf = new SequenceFetcher(Desktop.getInstance(),
forSource, forAccession);
sf.run();
AlignFrame[] afs = Desktop.getAlignFrames();
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
// recover stored project
af = new FileLoader(false).LoadFileWaitTillLoaded(
savedProjects.get(first).toString(), DataSourceType.FILE);
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
pass3 = 0;
// recover stored project
File storedProject = savedProjects.get(nextxref);
}
else
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
// recover stored project
File storedProject = savedProjects.get(nextnextxref);
if (storedProject == null)
* remove any sequence mappings created so they don't pollute other tests
*/
StructureSelectionManager ssm = StructureSelectionManager
- .getStructureSelectionManager(Desktop.instance);
+ .getStructureSelectionManager(Desktop.getInstance());
ssm.resetAll();
}
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ jalview.gui.Desktop.getInstance().closeAll_actionPerformed(null);
}
@BeforeTest(alwaysRun = true)
public static void clearDesktop()
{
- if (Desktop.instance != null && Desktop.getFrames() != null
+ if (Desktop.getInstance() != null && Desktop.getFrames() != null
&& Desktop.getFrames().length > 0)
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
}
}
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- jalview.gui.Desktop.instance.closeAll_actionPerformed(null);
+ jalview.gui.Desktop.getInstance().closeAll_actionPerformed(null);
}
@Test(groups = { "Functional" }, enabled = true)
public void testStoreAndRecoverExpandedviews() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", DataSourceType.FILE);
{
Assert.fail("Didn't save the expanded view state", e);
}
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
if (Desktop.getAlignFrames() != null)
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
@Test(groups = { "Functional" })
public void testStoreAndRecoverReferenceSeqSettings() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull(af, "Didn't read in the example file correctly.");
{
Assert.fail("Didn't save the expanded view state", e);
}
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
if (Desktop.getAlignFrames() != null)
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
@Test(groups = { "Functional" })
public void testStoreAndRecoverGroupRepSeqs() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
assertNotNull(af, "Didn't read in the example file correctly.");
{
Assert.fail("Didn't save the expanded view state", e);
}
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
if (Desktop.getAlignFrames() != null)
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
@Test(groups = { "Functional" })
public void testStoreAndRecoverPDBEntry() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
String exampleFile = "examples/3W5V.pdb";
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(exampleFile,
DataSourceType.FILE);
{
Assert.fail("Didn't save the state", e);
}
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
if (Desktop.getAlignFrames() != null)
{
Assert.assertEquals(Desktop.getAlignFrames().length, 0);
@Test(groups = { "Functional" })
public void testStoreAndRecoverColourThresholds() throws IOException
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
".jvp");
tfile.deleteOnExit();
new Jalview2XML(false).saveState(tfile);
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
DataSourceType.FILE);
Assert.assertNotNull(af, "Failed to reload project");
@Test(groups = { "Functional" })
public void testMergeDatasetsforManyViews() throws IOException
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
// complex project - one dataset, several views on several alignments
AlignFrame af = new FileLoader(false).LoadFileWaitTillLoaded(
@Test(groups = "Functional")
public void testPcaViewAssociation() throws IOException
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
final String PCAVIEWNAME = "With PCA";
// create a new tempfile
File tempfile = File.createTempFile("jvPCAviewAssoc", "jvp");
}
// load again.
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
tempfile.getCanonicalPath(), DataSourceType.FILE);
- JInternalFrame[] frames = Desktop.instance.getAllFrames();
+ JInternalFrame[] frames = Desktop.getInstance().getAllFrames();
// PCA and the tabbed alignment view should be the only two windows on the
// desktop
assertEquals(frames.length, 2,
@AfterClass(alwaysRun = true)
public static void tearDownAfterClass() throws Exception
{
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
}
@Test(groups = "Functional")
{
// for some reason 'BeforeMethod' (which should be inherited from
// Jalview2XmlBase isn't always called)...
- Desktop.instance.closeAll_actionPerformed(null);
+ Desktop.getInstance().closeAll_actionPerformed(null);
try {
Thread.sleep(200);
} catch (Exception foo) {};