Includes lazy dynamic loading of SequenceFetcher database options.
Note that if WebServices menu is enabled (Java, not JavaScript), then
all web-based database proxies are instantiated anyway.
public class AlignmentSorter
{
+ /**
+ * types of feature ordering: Sort by score : average score - or total score -
+ * over all features in region Sort by feature label text: (or if null -
+ * feature type text) - numerical or alphabetical Sort by feature density:
+ * based on counts - ignoring individual text or scores for each feature
+ */
+ public static final String FEATURE_SCORE = "average_score";
+
+ public static final String FEATURE_LABEL = "text";
+
+ public static final String FEATURE_DENSITY = "density";
+
static AlignmentSorter instance;
public static AlignmentSorter getInstance()
{
g = Thread.currentThread().getThreadGroup();
/**
- * @j2sNative i = g._jalviewScoreModelsInstance;
+ * @j2sNative i = g._jalviewAlignmentSorterInstance;
*
*/
}
if (Platform.isJS())
{
/**
- * @j2sNative g._jalviewScoreModelsInstance = i;
+ * @j2sNative g._jalviewAlignmentSorterInstance = i;
*
*/
}
}
/**
- * types of feature ordering: Sort by score : average score - or total score -
- * over all features in region Sort by feature label text: (or if null -
- * feature type text) - numerical or alphabetical Sort by feature density:
- * based on counts - ignoring individual text or scores for each feature
- */
- public static String FEATURE_SCORE = "average_score";
-
- public static String FEATURE_LABEL = "text";
-
- public static String FEATURE_DENSITY = "density";
-
- /**
* Sort sequences by feature score or density, optionally restricted by
* feature types, feature groups, or alignment start/end positions.
* <p>
*/
public class Cache
{
+
+ static Cache instance;
+
+ /**
+ * In Java, this will be a static field instance, which will be
+ * application-specific; in JavaScript it will be an applet-specific instance
+ * tied to the applet's ThreadGroup.
+ *
+ * @return
+ */
+ public static Cache getInstance()
+ {
+
+ // BH 2019.05.08 need to isolate static fields in JavaScript
+
+ Cache i = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+ if (Platform.isJS())
+ {
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative i = g._jalviewCacheInstance;
+ *
+ */
+ }
+ if (i == null)
+ {
+ i = new Cache();
+ if (Platform.isJS())
+ {
+ /**
+ * @j2sNative g._jalviewCacheInstance = i;
+ *
+ */
+ }
+ else
+ {
+ instance = i;
+ }
+ }
+ return i;
+ }
+
/**
* property giving log4j level for CASTOR loggers
*/
*/
public static Logger log;
+ private Cache()
+ {
+ // inaccessible
+ }
+
/** Jalview Properties */
- public static Properties applicationProperties = new Properties()
+ // BH 2019.05.08 was static
+ @SuppressWarnings("serial")
+ private Properties applicationProperties = new Properties()
{
// override results in properties output in alphabetical order
@Override
};
/** Default file is ~/.jalview_properties */
+ // BH 2019.05.07 note: Instances of Jalview will share this file.
static String propertiesFile;
- private static boolean propsAreReadOnly = Platform.isJS();
+ /**
+ * flag to possibly allow properties to be written to a property file
+ */
+ private boolean propsAreReadOnly = Platform.isJS();
private final static String JS_PROPERTY_PREFIX = "jalview_";
*/
public static void loadProperties(String propsFile)
{
+ getInstance().loadPropertiesImpl(propsFile);
+ }
+
+ private void loadPropertiesImpl(String propsFile)
+ {
propertiesFile = propsFile;
- if (propsFile == null && !propsAreReadOnly)
- {
- propertiesFile = System.getProperty("user.home") + File.separatorChar
- + ".jalview_properties";
- }
- else
+ if (!propsAreReadOnly)
{
- // don't corrupt the file we've been given.
- propsAreReadOnly = true;
+ // Java only
+ if (propsFile == null)
+ {
+ propertiesFile = System.getProperty("user.home")
+ + File.separatorChar + ".jalview_properties";
+ }
+ else
+ {
+ // don't corrupt the file we've been given.
+ propsAreReadOnly = true;
+ }
}
if (propertiesFile == null)
- { // BH 2019
+ { // BH 2019 read properties from the Info object associated with this
+ // applet
Platform.readInfoProperties(JS_PROPERTY_PREFIX,
applicationProperties);
}
}
- private static void deleteBuildProperties()
+ private void deleteBuildProperties()
{
applicationProperties.remove("LATEST_VERSION");
applicationProperties.remove("VERSION");
*/
public static String getProperty(String key)
{
+ return getInstance().getPropertyImpl(key);
+ }
+
+ private String getPropertyImpl(String key)
+ {
String prop = applicationProperties.getProperty(key);
if (prop == null && Platform.isJS())
{
*/
public static Object setProperty(String key, String obj)
{
+ return getInstance().setPropertyImpl(key, obj, true);
+ }
+
+ public static void setPropertyNoSave(String key, String obj)
+ {
+ getInstance().setPropertyImpl(key, obj, false);
+ }
+
+ private Object setPropertyImpl(String key, String obj, boolean andSave)
+ {
Object oldValue = null;
try
{
oldValue = applicationProperties.setProperty(key, obj);
- if (!propsAreReadOnly)
+ if (andSave && !propsAreReadOnly)
{
FileOutputStream out = new FileOutputStream(propertiesFile);
applicationProperties.store(out, "---JalviewX Properties File---");
/**
* remove the specified property from the jalview properties file
*
- * @param string
+ * @param key
*/
- public static void removeProperty(String string)
+ public static void removeProperty(String key)
+ {
+ getInstance().removePropertyImpl(key, true);
+ }
+
+ public static void removePropertyNoSave(String key)
+ {
+ getInstance().removePropertyImpl(key, false);
+ }
+
+ private void removePropertyImpl(String key, boolean andSave)
+ {
+ applicationProperties.remove(key);
+ if (andSave)
+ {
+ savePropertiesImpl();
+ }
+ }
+
+ public static void saveProperties()
{
- applicationProperties.remove(string);
- saveProperties();
+ getInstance().savePropertiesImpl();
}
/**
* save the properties to the jalview properties path
*/
- public static void saveProperties()
+ private void savePropertiesImpl()
{
if (!propsAreReadOnly)
{
}
}
+ private final static int UNTESTED = -1;
+
+ private final static int TRUE = 1;
+
+ private final static int FALSE = 0;
+
/**
* internal vamsas class discovery state
*/
- private static int vamsasJarsArePresent = -1;
+ private static int vamsasJarsArePresent = (Platform.isJS() ? FALSE
+ : UNTESTED);
/**
* Searches for vamsas client classes on class path.
*/
public static boolean vamsasJarsPresent()
{
- if (vamsasJarsArePresent == -1)
+ if (vamsasJarsArePresent == UNTESTED)
{
try
{
{
jalview.bin.Cache.log.debug(
"Found Vamsas Classes (uk.ac..vamsas.client.VorbaId can be loaded)");
- vamsasJarsArePresent = 1;
+ vamsasJarsArePresent = TRUE;
Logger lvclient = Logger.getLogger("uk.ac.vamsas");
lvclient.setLevel(Level.toLevel(Cache
.getDefault("logs.Vamsas.Level", Level.INFO.toString())));
}
} catch (Exception e)
{
- vamsasJarsArePresent = 0;
+ vamsasJarsArePresent = FALSE;
jalview.bin.Cache.log.debug("Vamsas Classes are not present");
}
}
- return (vamsasJarsArePresent > 0);
+ return (vamsasJarsArePresent == TRUE);
}
/**
* internal vamsas class discovery state
*/
- private static int groovyJarsArePresent = -1;
+ private static int groovyJarsArePresent = (Platform.isJS() ? FALSE
+ : UNTESTED);
/**
* Searches for vamsas client classes on class path.
*/
public static boolean groovyJarsPresent()
{
- if (groovyJarsArePresent == -1)
+ if (groovyJarsArePresent == UNTESTED)
{
try
{
{
jalview.bin.Cache.log.debug(
"Found Groovy (groovy.lang.GroovyObject can be loaded)");
- groovyJarsArePresent = 1;
+ groovyJarsArePresent = TRUE;
Logger lgclient = Logger.getLogger("groovy");
lgclient.setLevel(Level.toLevel(Cache
.getDefault("logs.Groovy.Level", Level.INFO.toString())));
}
} catch (Error e)
{
- groovyJarsArePresent = 0;
+ groovyJarsArePresent = FALSE;
jalview.bin.Cache.log.debug("Groovy Classes are not present", e);
} catch (Exception e)
{
- groovyJarsArePresent = 0;
+ groovyJarsArePresent = FALSE;
jalview.bin.Cache.log.debug("Groovy Classes are not present");
}
}
- return (groovyJarsArePresent > 0);
+ return (groovyJarsArePresent == TRUE);
}
/**
*/
protected static Object tracker = null;
- protected static Class trackerfocus = null;
+ protected static Class<?> trackerfocus = null;
- protected static Class jgoogleanalyticstracker = null;
+ protected static Class<?> jgoogleanalyticstracker = null;
/**
* Initialise the google tracker if it is not done already.
*/
public static void initGoogleTracker()
{
+
+ // TODO: SwingJS JavaScript tracker?
+
if (tracker == null)
{
if (jgoogleanalyticstracker == null)
}
if (value == null || value.trim().length() < 1)
{
- Cache.applicationProperties.remove(propName);
+ getInstance().applicationProperties.remove(propName);
}
else
{
- Cache.applicationProperties.setProperty(propName, value);
+ getInstance().applicationProperties.setProperty(propName, value);
}
}
}
else
{
- applicationProperties
+ getInstance().applicationProperties
.remove(UserDefinedColours.USER_DEFINED_COLOURS);
}
}
@SuppressWarnings("unused")
ThreadGroup g = Thread.currentThread().getThreadGroup();
/**
- * @j2s g._jalviewInstance = j;
+ * @j2sNative g._jalviewInstance = j;
*/
{
instance = j;
{
String description;
- public static int TO_LOWER = 0;
+ public final static int TO_LOWER = 0;
- public static int TO_UPPER = 1;
+ public final static int TO_UPPER = 1;
- public static int TOGGLE_CASE = 2;
+ public final static int TOGGLE_CASE = 2;
- int caseChange = -1;
+ private int caseChange;
- SequenceI[] seqs;
+ private SequenceI[] seqs;
- List<int[]> regions;
+ private List<int[]> regions;
public ChangeCaseCommand(String description, SequenceI[] seqs,
List<int[]> regions, int caseChange)
doCommand(null);
}
+ @Override
public String getDescription()
{
return description;
}
+ @Override
public int getSize()
{
return 1;
}
+ @Override
public void doCommand(AlignmentI[] views)
{
changeCase(true);
}
+ @Override
public void undoCommand(AlignmentI[] views)
{
changeCase(false);
/**
* Make a new alignment from an array of SeqCigars
*
- * @param seqs
- * SeqCigar[]
+ * @param alseqs
*/
public Alignment(SeqCigar[] alseqs)
{
public static final String UNIPROT = "UNIPROT";
- public static final String UP_NAME = "UNIPROT_NAME".toUpperCase();
+
+ public static final String UP_NAME = "UNIPROT_NAME";
/**
* Uniprot Knowledgebase/TrEMBL as served from EMBL protein products.
*/
public static final String EMBLCDSProduct = "EMBLCDSProtein".toUpperCase();
public static final String PDB = "PDB";
- public static final String PFAM = "PFAM";
+
+ public static final String PFAM = "PFAM";
+
public static final String RFAM = "RFAM";
public static final String GENEDB = "GeneDB".toUpperCase();
+ public static final String PFAM_FULL = "PFAM (Full)";
+
+ public static final String PFAM_SEED = "PFAM (Seed)";
+
+ public static final String RFAM_SEED = "RFAM (Seed)";
+
public static final String PDB_CANONICAL_NAME = PDB;
// CODINGDBS, DNACODINGDBS, PROTEINDBS };
//
public static final int PRIMARY_SOURCES_MASK = CODING_MASK | DNA_CODING_MASK | PROTEIN_MASK;
-
+
public static boolean isPrimarySource(String source)
{
return ((PRIMARY_SOURCES_MASK & getSourceKey(source)) != 0);
* fast lookup tables holding the index into our count
* arrays of each symbol; index 0 is reserved for gap counting
*/
- private static int[] NUC_INDEX = new int[26];
+ private final static int[] NUC_INDEX = new int[26];
+
+ private final static int[] AA_INDEX = new int[26];
- private static int[] AA_INDEX = new int[26];
static
{
for (int i = 0; i < NUCS.length(); i++)
public class SecondaryStructureAnnotation extends AlignmentAnnotation
{
- private static RNA _rna = null;
+ // was static, but that cannot work here
+
+ private RNA _rna = null;
public SecondaryStructureAnnotation(RNA rna)
{
Annotation[] ann = new Annotation[rna.getSize()];
for (int i = 0; i < ann.length; i++)
{
- ann[i] = new Annotation(_rna.getStructDBN(true), "", ' ', 0f);
+ ann[i] = new Annotation(rna.getStructDBN(true), "", ' ', 0f);
;
}
return ann;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefSource;
-import jalview.util.JSONUtils;
-import java.io.BufferedReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
public class EnsemblInfo extends EnsemblRestClient
{
+ private static EnsemblInfo instance;
+
+ /**
+ * Some question as to whether it is necessary to do this for each applet. IN
+ * PRINCIPLE, applets could set different properties for the origin of Ensembl
+ * data. But I suggest this is unlikely. If we DO care about that possibility,
+ * then we need to set doICare to Platform.isJS();
+ *
+ */
+ private final static boolean doICare = false;// Platform.isJS();
+
+ /**
+ * On first request only, populate the lookup map by fetching the list of
+ * divisions known to EnsemblGenomes.
+ *
+ */
+ private static EnsemblInfo getInstance()
+ {
+
+ // BH 2019.05.08 need to isolate static fields in JavaScript
+
+ EnsemblInfo i = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+
+ if (doICare)
+ {
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative i = g._jalviewEnsemblInstance;
+ *
+ */
+ }
+ if (i == null)
+ {
+ i = new EnsemblInfo();
+
+ if (doICare)
+ {
+ /**
+ * @j2sNative g._jalviewEnsemblInstance = i;
+ *
+ */
+ }
+ else
+ {
+ instance = i;
+ }
+ }
+ return i;
+ }
+
/*
* cached results of REST /info/divisions service, currently
* <pre>
* The values for EnsemblGenomes are retrieved by a REST call, that for
* Ensembl is added programmatically for convenience of lookup
*/
- private static Map<String, String> divisions;
+ private Map<String, String> divisions = new HashMap<>();
+
+ private EnsemblInfo()
+ {
+
+ /*
+ * for convenience, pre-fill ensembl.org as the domain for "ENSEMBL"
+ */
+ divisions.put(DBRefSource.ENSEMBL.toUpperCase(), ensemblDomain);
+ try
+ {
+ @SuppressWarnings("unchecked")
+ Iterator<Object> rvals = (Iterator<Object>) getJSON(
+ getDivisionsUrl(ensemblGenomesDomain), null, -1,
+ MODE_ITERATOR, null);
+ if (rvals == null)
+ {
+ return;
+ }
+ while (rvals.hasNext())
+ {
+ String division = rvals.next().toString();
+ divisions.put(division.toUpperCase(), ensemblGenomesDomain);
+ }
+ } catch (IOException | ParseException | NumberFormatException e)
+ {
+ // ignore
+ }
+ }
@Override
public String getDbName()
* @param division
* @return
*/
- public String getDomain(String division)
+ public static String getDomain(String division)
{
- if (divisions == null)
- {
- fetchDivisions();
- }
- return divisions.get(division.toUpperCase());
- }
-
- /**
- * On first request only, populate the lookup map by fetching the list of
- * divisions known to EnsemblGenomes.
- */
- void fetchDivisions()
- {
- divisions = new HashMap<>();
-
- /*
- * for convenience, pre-fill ensembl.org as the domain for "ENSEMBL"
- */
- divisions.put(DBRefSource.ENSEMBL.toUpperCase(), ensemblDomain);
- try
- {
- @SuppressWarnings("unchecked")
- Iterator<Object> rvals = (Iterator<Object>) getJSON(getDivisionsUrl(ensemblGenomesDomain), null, -1, MODE_ITERATOR, null);
- if (rvals == null)
- return;
- while (rvals.hasNext())
- {
- String division = rvals.next().toString();
- divisions.put(division.toUpperCase(), ensemblGenomesDomain);
- }
- } catch (IOException | ParseException | NumberFormatException e)
- {
- // ignore
- }
+ return getInstance().divisions.get(division.toUpperCase());
}
/**
*
* @return
*/
- public Set<String> getDivisions() {
- if (divisions == null)
- {
- fetchDivisions();
- }
-
- return divisions.keySet();
+ public static Set<String> getDivisions()
+ {
+ return getInstance().divisions.keySet();
}
}
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefSource;
import jalview.datamodel.GeneLociI;
-import jalview.util.JSONUtils;
import jalview.util.MapList;
-import java.io.BufferedReader;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
{
Iterator<Object> rvals = (Iterator<Object>) getJSON(url, null, -1, MODE_ITERATOR, MAPPINGS);
if (rvals == null)
- return null;
+ {
+ return null;
+ }
while (rvals.hasNext())
{
// todo check for "mapped"
URL url = null;
try
{
- String domain = new EnsemblInfo().getDomain(division);
+ String domain = EnsemblInfo.getDomain(division);
if (domain != null)
{
url = getIdMapUrl(domain, accession, start, end, cdsOrCdna);
{
Iterator<Object> rvals = (Iterator<Object>) getJSON(url, null, -1, MODE_ITERATOR, MAPPINGS);
if (rvals == null)
- return null;
+ {
+ return null;
+ }
String assembly = null;
String chromosome = null;
int fromEnd = 0;
private static final String REST_CHANGE_LOG = "https://github.com/Ensembl/ensembl-rest/wiki/Change-log";
- private static Map<String, EnsemblData> domainData;
+ private static final Map<String, EnsemblData> domainData;
private final static long AVAILABILITY_RETEST_INTERVAL = 10000L; // 10 seconds
private static FTSRestClientI instance = null;
+ public static FTSRestClientI getInstance()
+ {
+
+ // BH 2019.05.08 need to isolate static fields in JavaScript
+
+ FTSRestClientI i = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+ if (Platform.isJS())
+ {
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative i = g._jalviewPDBFTSRestClientInstance;
+ *
+ */
+ }
+ if (i == null)
+ {
+ i = new PDBFTSRestClient();
+
+ if (Platform.isJS())
+ {
+ /**
+ * @j2sNative g._jalviewPDBFTSRestClientInstance = i;
+ *
+ */
+ }
+ else
+ {
+ instance = i;
+ }
+ }
+ return i;
+ }
+
public static final String PDB_SEARCH_ENDPOINT = "https://www.ebi.ac.uk/pdbe/search/pdb/select?";
protected PDBFTSRestClient()
return "/fts/pdb_data_columns.txt";
}
- public static FTSRestClientI getInstance()
- {
- if (instance == null)
- {
- instance = new PDBFTSRestClient();
- }
- return instance;
- }
-
private Collection<FTSDataColumnI> allDefaultDisplayedStructureDataColumns;
public Collection<FTSDataColumnI> getAllDefaultDisplayedStructureDataColumns()
private static FTSRestClientI instance = null;
+ public static FTSRestClientI getInstance()
+ {
+
+ // BH 2019.05.08 need to isolate static fields in JavaScript
+
+ FTSRestClientI i = instance;
+ @SuppressWarnings("unused")
+ ThreadGroup g = null;
+ if (Platform.isJS())
+ {
+ g = Thread.currentThread().getThreadGroup();
+ /**
+ * @j2sNative i = g._jalviewUniProtFTSRestClientInstance;
+ *
+ */
+ }
+ if (i == null)
+ {
+ i = new UniProtFTSRestClient();
+
+ if (Platform.isJS())
+ {
+ /**
+ * @j2sNative g._jalviewUniProtFTSRestClientInstance = i;
+ *
+ */
+ }
+ else
+ {
+ instance = i;
+ }
+ }
+ return i;
+ }
+
public final String uniprotSearchEndpoint;
public UniProtFTSRestClient()
};
}
- public static FTSRestClientI getInstance()
- {
- if (instance == null)
- {
- instance = new UniProtFTSRestClient();
- }
- return instance;
- }
-
@Override
public String getColumnDataConfigFileName()
{
StringSelection ss = new StringSelection(output);
+ Desktop d = Desktop.getInstance();
try
{
- jalview.gui.Desktop.internalCopy = true;
+ d.internalCopy = true;
// Its really worth setting the clipboard contents
// to empty before setting the large StringSelection!!
Toolkit.getDefaultToolkit().getSystemClipboard()
hiddenCutoff, hiddenOffset);
}
- Desktop.jalviewClipboard = new Object[] { seqs,
+ d.jalviewClipboard = new Object[] { seqs,
viewport.getAlignment().getDataset(), hiddenColumns };
setStatus(MessageManager.formatMessage(
"label.copied_sequences_to_clipboard", new Object[]
boolean annotationAdded = false;
AlignmentI alignment = null;
- if (Desktop.jalviewClipboard != null)
+ Desktop d = Desktop.getInstance();
+
+ if (d.jalviewClipboard != null)
{
// The clipboard was filled from within Jalview, we must use the
// sequences
// And dataset from the copied alignment
- SequenceI[] newseq = (SequenceI[]) Desktop.jalviewClipboard[0];
+ SequenceI[] newseq = (SequenceI[]) d.jalviewClipboard[0];
// be doubly sure that we create *new* sequence objects.
sequences = new SequenceI[newseq.length];
for (int i = 0; i < newseq.length; i++)
if (newAlignment)
{
- if (Desktop.jalviewClipboard != null)
+ if (d.jalviewClipboard != null)
{
// dataset is inherited
- alignment.setDataset((Alignment) Desktop.jalviewClipboard[1]);
+ alignment.setDataset((Alignment) d.jalviewClipboard[1]);
}
else
{
alignment = viewport.getAlignment();
alwidth = alignment.getWidth() + 1;
// decide if we need to import sequences from an existing dataset
- boolean importDs = Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[1] != alignment.getDataset();
+ boolean importDs = d.jalviewClipboard != null
+ && d.jalviewClipboard[1] != alignment.getDataset();
// importDs==true instructs us to copy over new dataset sequences from
// an existing alignment
Vector<SequenceI> newDs = (importDs) ? new Vector<>() : null; // used to
DEFAULT_HEIGHT);
String newtitle = new String("Copied sequences");
- if (Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[2] != null)
+ if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null)
{
- HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2];
+ HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2];
af.viewport.setHiddenColumns(hc);
}
DEFAULT_HEIGHT);
String newtitle = new String("Flanking alignment");
- if (Desktop.jalviewClipboard != null
- && Desktop.jalviewClipboard[2] != null)
+ Desktop d = Desktop.getInstance();
+
+ if (d.jalviewClipboard != null && d.jalviewClipboard[2] != null)
{
- HiddenColumns hc = (HiddenColumns) Desktop.jalviewClipboard[2];
+ HiddenColumns hc = (HiddenColumns) d.jalviewClipboard[2];
af.viewport.setHiddenColumns(hc);
}
}
if (otherdb.size() == 1)
{
- final DbSourceProxy[] dassource = otherdb
- .toArray(new DbSourceProxy[0]);
DbSourceProxy src = otherdb.get(0);
+ DbSourceProxy[] dassource = new DbSourceProxy[] {
+ src };
fetchr = new JMenuItem(src.getDbSource());
fetchr.addActionListener(new ActionListener()
{
public static final int ACTION_OPTION_SELECT = 1;
- public static int ACTION_OPTION_HIDE = 2;
+ public static final int ACTION_OPTION_HIDE = 2;
- public static String NO_GRAPH_VIEW = "0";
+ public static final String NO_GRAPH_VIEW = "0";
- public static String GRAPH_VIEW = "1";
+ public static final String GRAPH_VIEW = "1";
private int actionOption = ACTION_OPTION_SELECT;
/**
* height in pixels for allowing height adjuster to be active
*/
- private static int HEIGHT_ADJUSTER_HEIGHT = 10;
+ private static final int HEIGHT_ADJUSTER_HEIGHT = 10;
private static final Font font = new Font("Arial", Font.PLAIN, 11);
av.getAlignment().getHiddenColumns());
}
- Desktop.jalviewClipboard = new Object[] { seqs, ds, // what is the dataset
+ Desktop.getInstance().jalviewClipboard = new Object[] { seqs, ds, // what is
+ // the
+ // dataset
// of a consensus
// sequence ? need to
// flag
private ReorderableJList _sideList = null;
- private static String errorOpt = "error";
+ private final static String errorOpt = "error";
@SuppressWarnings("unused")
private boolean _error;
*/
private void init()
{
- DefaultListModel<FullBackup> dlm = new DefaultListModel<FullBackup>();
+ DefaultListModel<FullBackup> dlm = new DefaultListModel<>();
int marginTools = 40;
_sideList.setPreferredSize(new Dimension(100, 0));
_sideList.addListSelectionListener(new ListSelectionListener()
{
+ @Override
public void valueChanged(ListSelectionEvent evt)
{
changeSelectedStructure_actionPerformed(evt);
{
private DefaultListModel<FullBackup> _rnalist;
- private List<RNA> _rnas = new ArrayList<RNA>();
+ private List<RNA> _rnas = new ArrayList<>();
JList _l;
}
else
{
- Cache.applicationProperties.remove("USER_DEFINED_COLOURS");
+ Cache.removePropertyNoSave("USER_DEFINED_COLOURS");
}
}
}
initConsole(false);
JalviewAppender jappender = new JalviewAppender();
jappender.setLayout(new SimpleLayout());
- JalviewAppender.setTextArea(textArea);
+ // BH 2019 JalviewAppender.setTextArea(textArea);
+ jappender.setTextArea(textArea);
org.apache.log4j.Logger.getRootLogger().addAppender(jappender);
}
return;
}
- Set<String> ensemblDivisions = new EnsemblInfo().getDivisions();
+ Set<String> ensemblDivisions = EnsemblInfo.getDivisions();
/*
* first look for direct dbrefs from sequence to Ensembl
@SuppressWarnings("unused")
ThreadGroup g = Thread.currentThread().getThreadGroup();
/**
- * @j2s g._jalviewDesktopInstance = d;
+ * @j2sNative g._jalviewDesktopInstance = d;
*/
{
instance = d;
static final int yOffset = 30;
- public static jalview.ws.jws1.Discoverer discoverer;
+ public jalview.ws.jws1.Discoverer discoverer;
- public static Object[] jalviewClipboard;
+ public Object[] jalviewClipboard;
- public static boolean internalCopy = false;
+ public boolean internalCopy = false;
- static int fileLoadingCount = 0;
+ private static int fileLoadingCount = 0;
class MyDesktopManager implements DesktopManager
{
// A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN
// IF JALVIEW IS RUNNING HEADLESS
// ///////////////////////////////////////////////
- if (instance == null || Jalview.isHeadlessMode())
+ if (getInstance() == null || Jalview.isHeadlessMode())
{
return;
}
{
if (!internalCopy)
{
- Desktop.jalviewClipboard = null;
+ Desktop.getInstance().jalviewClipboard = null;
}
internalCopy = false;
{
progressPanel = new JPanel(new GridLayout(1, 1));
totalProgressCount = 0;
- instance.getContentPane().add(progressPanel, BorderLayout.SOUTH);
+ getInstance().getContentPane().add(progressPanel, BorderLayout.SOUTH);
}
JPanel thisprogress = new JPanel(new BorderLayout(10, 5));
JProgressBar progressBar = new JProgressBar();
((GridLayout) progressPanel.getLayout()).setRows(
((GridLayout) progressPanel.getLayout()).getRows() + 1);
++totalProgressCount;
- instance.validate();
+ getInstance().validate();
return thisprogress;
}
*/
java.util.concurrent.Semaphore block = new Semaphore(0);
- private static groovy.ui.Console groovyConsole;
+ private groovy.ui.Console groovyConsole;
/**
* add another dialog thread to the queue
public static groovy.ui.Console getGroovyConsole()
{
- return groovyConsole;
+ return getInstance().groovyConsole;
}
/**
public class JalviewAppender extends WriterAppender
{
- static private JTextArea jTextArea = null;
+ // BH 2019 was static
+
+ private JTextArea jTextArea = null;
/** Set the target JTextArea for the logging information to appear. */
- static public void setTextArea(JTextArea jTextArea)
+ public void setTextArea(JTextArea jTextArea)
{
- JalviewAppender.jTextArea = jTextArea;
+ this.jTextArea = jTextArea;
}
/**
* Format and then append the loggingEvent to the stored JTextArea.
*/
+ @Override
public void append(LoggingEvent loggingEvent)
{
final String message = this.layout.format(loggingEvent);
// Append formatted message to textarea using the Swing Thread.
SwingUtilities.invokeLater(new Runnable()
{
+ @Override
public void run()
{
if (jTextArea != null)
}
else
{
- Cache.applicationProperties.remove(preferencesKey);
+ Cache.removePropertyNoSave(preferencesKey);
}
}
public class MenuChooser implements ActionListener
{
- public static boolean protein;
+ // public static boolean protein;
private JFrame choosemenu = new JFrame("Animation");
/**
* C'est la méthode qui sera appelée lors d'un clic sur notre bouton
*/
+ @Override
public void actionPerformed(ActionEvent arg0)
{
if (arg0.getSource() == bouton)
- protein = false;
- label.setText("RNA menu");
+ {
+ // protein = false;
+ label.setText("RNA menu");
+ }
if (arg0.getSource() == bouton2)
+ {
label.setText("Protein menu");
- protein = true;
+// protein = true;
+ }
}
}
* @author $author$
* @version $Revision$
*/
+@SuppressWarnings("serial")
public class Preferences extends GPreferences
{
public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
* Holds name and link separated with | character. Sequence ID must be
* $SEQUENCE_ID$ or $SEQUENCE_ID=/.possible | chars ./=$
*/
- public static UrlProviderI sequenceUrlLinks;
+ public static UrlProviderI sequenceUrlLinks; // must be nonfinal for test
- public static UrlLinkTableModel dataModel;
+ public final static UrlLinkTableModel dataModel;
/**
* Holds name and link separated with | character. Sequence IDS and Sequences
* (TODO: proper escape for using | to separate ids or sequences
*/
- public static List<String> groupURLLinks;
+ public static final List<String> groupURLLinks;
static
{
// get links selected to be in the menu (SEQUENCE_LINKS)
/*
* Save Visual settings
*/
- Cache.applicationProperties.setProperty("SHOW_JVSUFFIX",
+ Cache.setPropertyNoSave("SHOW_JVSUFFIX",
Boolean.toString(seqLimit.isSelected()));
- Cache.applicationProperties.setProperty("RIGHT_ALIGN_IDS",
+ Cache.setPropertyNoSave("RIGHT_ALIGN_IDS",
Boolean.toString(rightAlign.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_FULLSCREEN",
+ Cache.setPropertyNoSave("SHOW_FULLSCREEN",
Boolean.toString(fullScreen.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_OVERVIEW",
+ Cache.setPropertyNoSave("SHOW_OVERVIEW",
Boolean.toString(openoverv.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
Boolean.toString(annotations.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
+ Cache.setPropertyNoSave("SHOW_CONSERVATION",
Boolean.toString(conservation.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_QUALITY",
+ Cache.setPropertyNoSave("SHOW_QUALITY",
Boolean.toString(quality.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Cache.setPropertyNoSave("SHOW_IDENTITY",
Boolean.toString(identity.isSelected()));
- Cache.applicationProperties.setProperty("GAP_SYMBOL",
+ Cache.setPropertyNoSave("GAP_SYMBOL",
gapSymbolCB.getSelectedItem().toString());
- Cache.applicationProperties.setProperty("FONT_NAME",
+ Cache.setPropertyNoSave("FONT_NAME",
fontNameCB.getSelectedItem().toString());
- Cache.applicationProperties.setProperty("FONT_STYLE",
+ Cache.setPropertyNoSave("FONT_STYLE",
fontStyleCB.getSelectedItem().toString());
- Cache.applicationProperties.setProperty("FONT_SIZE",
+ Cache.setPropertyNoSave("FONT_SIZE",
fontSizeCB.getSelectedItem().toString());
- Cache.applicationProperties.setProperty("ID_ITALICS",
+ Cache.setPropertyNoSave("ID_ITALICS",
Boolean.toString(idItalics.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_UNCONSERVED",
+ Cache.setPropertyNoSave("SHOW_UNCONSERVED",
Boolean.toString(showUnconserved.isSelected()));
- Cache.applicationProperties.setProperty(SHOW_OCCUPANCY,
+ Cache.setPropertyNoSave(SHOW_OCCUPANCY,
Boolean.toString(showOccupancy.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_GROUP_CONSENSUS",
+ Cache.setPropertyNoSave("SHOW_GROUP_CONSENSUS",
Boolean.toString(showGroupConsensus.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_GROUP_CONSERVATION",
+ Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION",
Boolean.toString(showGroupConservation.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_CONSENSUS_HISTOGRAM",
+ Cache.setPropertyNoSave("SHOW_CONSENSUS_HISTOGRAM",
Boolean.toString(showConsensHistogram.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_CONSENSUS_LOGO",
+ Cache.setPropertyNoSave("SHOW_CONSENSUS_LOGO",
Boolean.toString(showConsensLogo.isSelected()));
- Cache.applicationProperties.setProperty("ANTI_ALIAS",
+ Cache.setPropertyNoSave("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
- Cache.applicationProperties.setProperty(SCALE_PROTEIN_TO_CDNA,
+ Cache.setPropertyNoSave(SCALE_PROTEIN_TO_CDNA,
Boolean.toString(scaleProteinToCdna.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_NPFEATS_TOOLTIP",
+ Cache.setPropertyNoSave("SHOW_NPFEATS_TOOLTIP",
Boolean.toString(showNpTooltip.isSelected()));
- Cache.applicationProperties.setProperty("SHOW_DBREFS_TOOLTIP",
+ Cache.setPropertyNoSave("SHOW_DBREFS_TOOLTIP",
Boolean.toString(showDbRefTooltip.isSelected()));
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT",
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT",
Boolean.toString(wrap.isSelected()));
- Cache.applicationProperties.setProperty("STARTUP_FILE",
+ Cache.setPropertyNoSave("STARTUP_FILE",
startupFileTextfield.getText());
- Cache.applicationProperties.setProperty("SHOW_STARTUP_FILE",
+ Cache.setPropertyNoSave("SHOW_STARTUP_FILE",
Boolean.toString(startupCheckbox.isSelected()));
- Cache.applicationProperties.setProperty("SORT_ALIGNMENT",
+ Cache.setPropertyNoSave("SORT_ALIGNMENT",
sortby.getSelectedItem().toString());
// convert description of sort order to enum name for save
.forDescription(sortAnnBy.getSelectedItem().toString());
if (annSortOrder != null)
{
- Cache.applicationProperties.setProperty(SORT_ANNOTATIONS,
+ Cache.setPropertyNoSave(SORT_ANNOTATIONS,
annSortOrder.name());
}
final boolean showAutocalcFirst = sortAutocalc.getSelectedIndex() == 0;
- Cache.applicationProperties.setProperty(SHOW_AUTOCALC_ABOVE,
+ Cache.setPropertyNoSave(SHOW_AUTOCALC_ABOVE,
Boolean.valueOf(showAutocalcFirst).toString());
/*
* Save Colours settings
*/
- Cache.applicationProperties.setProperty(DEFAULT_COLOUR_PROT,
+ Cache.setPropertyNoSave(DEFAULT_COLOUR_PROT,
protColour.getSelectedItem().toString());
- Cache.applicationProperties.setProperty(DEFAULT_COLOUR_NUC,
+ Cache.setPropertyNoSave(DEFAULT_COLOUR_NUC,
nucColour.getSelectedItem().toString());
Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
minColour.getBackground());
*/
Cache.setColourProperty(GAP_COLOUR, gapColour.getBackground());
Cache.setColourProperty(HIDDEN_COLOUR, hiddenColour.getBackground());
- Cache.applicationProperties.setProperty(USE_LEGACY_GAP,
+ Cache.setPropertyNoSave(USE_LEGACY_GAP,
Boolean.toString(useLegacyGap.isSelected()));
- Cache.applicationProperties.setProperty(SHOW_OV_HIDDEN_AT_START,
+ Cache.setPropertyNoSave(SHOW_OV_HIDDEN_AT_START,
Boolean.toString(showHiddenAtStart.isSelected()));
/*
* Save Structure settings
*/
- Cache.applicationProperties.setProperty(ADD_TEMPFACT_ANN,
+ Cache.setPropertyNoSave(ADD_TEMPFACT_ANN,
Boolean.toString(addTempFactor.isSelected()));
- Cache.applicationProperties.setProperty(ADD_SS_ANN,
+ Cache.setPropertyNoSave(ADD_SS_ANN,
Boolean.toString(addSecondaryStructure.isSelected()));
- Cache.applicationProperties.setProperty(USE_RNAVIEW,
+ Cache.setPropertyNoSave(USE_RNAVIEW,
Boolean.toString(useRnaView.isSelected()));
- Cache.applicationProperties.setProperty(STRUCT_FROM_PDB,
+ Cache.setPropertyNoSave(STRUCT_FROM_PDB,
Boolean.toString(structFromPdb.isSelected()));
- Cache.applicationProperties.setProperty(STRUCTURE_DISPLAY,
+ Cache.setPropertyNoSave(STRUCTURE_DISPLAY,
structViewer.getSelectedItem().toString());
Cache.setOrRemove(CHIMERA_PATH, chimeraPath.getText());
- Cache.applicationProperties.setProperty("MAP_WITH_SIFTS",
+ Cache.setPropertyNoSave("MAP_WITH_SIFTS",
Boolean.toString(siftsMapping.isSelected()));
SiftsSettings.setMapWithSifts(siftsMapping.isSelected());
/*
* Save Output settings
*/
- Cache.applicationProperties.setProperty("EPS_RENDERING",
+ Cache.setPropertyNoSave("EPS_RENDERING",
((OptionsParam) epsRendering.getSelectedItem()).getCode());
- Cache.applicationProperties.setProperty("HTML_RENDERING",
+ Cache.setPropertyNoSave("HTML_RENDERING",
((OptionsParam) htmlRendering.getSelectedItem()).getCode());
- Cache.applicationProperties.setProperty("SVG_RENDERING",
+ Cache.setPropertyNoSave("SVG_RENDERING",
((OptionsParam) svgRendering.getSelectedItem()).getCode());
/*
String menuLinks = sequenceUrlLinks.writeUrlsAsString(true);
if (menuLinks.isEmpty())
{
- Cache.applicationProperties.remove("SEQUENCE_LINKS");
+ Cache.removePropertyNoSave("SEQUENCE_LINKS");
}
else
{
- Cache.applicationProperties.setProperty("SEQUENCE_LINKS",
+ Cache.setPropertyNoSave("SEQUENCE_LINKS",
menuLinks.toString());
}
String nonMenuLinks = sequenceUrlLinks.writeUrlsAsString(false);
if (nonMenuLinks.isEmpty())
{
- Cache.applicationProperties.remove("STORED_LINKS");
+ Cache.removePropertyNoSave("STORED_LINKS");
}
else
{
- Cache.applicationProperties.setProperty("STORED_LINKS",
+ Cache.setPropertyNoSave("STORED_LINKS",
nonMenuLinks.toString());
}
- Cache.applicationProperties.setProperty("DEFAULT_URL",
+ Cache.setPropertyNoSave("DEFAULT_URL",
sequenceUrlLinks.getPrimaryUrlId());
- Cache.applicationProperties.setProperty("USE_PROXY",
+ Cache.setPropertyNoSave("USE_PROXY",
Boolean.toString(useProxy.isSelected()));
Cache.setOrRemove("PROXY_SERVER", proxyServerTB.getText());
/*
* Save Output settings
*/
- Cache.applicationProperties.setProperty("BLC_JVSUFFIX",
+ Cache.setPropertyNoSave("BLC_JVSUFFIX",
Boolean.toString(blcjv.isSelected()));
- Cache.applicationProperties.setProperty("CLUSTAL_JVSUFFIX",
+ Cache.setPropertyNoSave("CLUSTAL_JVSUFFIX",
Boolean.toString(clustaljv.isSelected()));
- Cache.applicationProperties.setProperty("FASTA_JVSUFFIX",
+ Cache.setPropertyNoSave("FASTA_JVSUFFIX",
Boolean.toString(fastajv.isSelected()));
- Cache.applicationProperties.setProperty("MSF_JVSUFFIX",
+ Cache.setPropertyNoSave("MSF_JVSUFFIX",
Boolean.toString(msfjv.isSelected()));
- Cache.applicationProperties.setProperty("PFAM_JVSUFFIX",
+ Cache.setPropertyNoSave("PFAM_JVSUFFIX",
Boolean.toString(pfamjv.isSelected()));
- Cache.applicationProperties.setProperty("PILEUP_JVSUFFIX",
+ Cache.setPropertyNoSave("PILEUP_JVSUFFIX",
Boolean.toString(pileupjv.isSelected()));
- Cache.applicationProperties.setProperty("PIR_JVSUFFIX",
+ Cache.setPropertyNoSave("PIR_JVSUFFIX",
Boolean.toString(pirjv.isSelected()));
- Cache.applicationProperties.setProperty("PIR_MODELLER",
+ Cache.setPropertyNoSave("PIR_MODELLER",
Boolean.toString(modellerOutput.isSelected()));
- Cache.applicationProperties.setProperty("EXPORT_EMBBED_BIOJSON",
+ Cache.setPropertyNoSave("EXPORT_EMBBED_BIOJSON",
Boolean.toString(embbedBioJSON.isSelected()));
jalview.io.PIRFile.useModellerOutput = modellerOutput.isSelected();
- Cache.applicationProperties.setProperty("FIGURE_AUTOIDWIDTH",
+ Cache.setPropertyNoSave("FIGURE_AUTOIDWIDTH",
Boolean.toString(autoIdWidth.isSelected()));
userIdWidth_actionPerformed();
- Cache.applicationProperties.setProperty("FIGURE_FIXEDIDWIDTH",
+ Cache.setPropertyNoSave("FIGURE_FIXEDIDWIDTH",
userIdWidth.getText());
/*
* Save Editing settings
*/
- Cache.applicationProperties.setProperty("AUTO_CALC_CONSENSUS",
+ Cache.setPropertyNoSave("AUTO_CALC_CONSENSUS",
Boolean.toString(autoCalculateConsCheck.isSelected()));
- Cache.applicationProperties.setProperty("SORT_BY_TREE",
+ Cache.setPropertyNoSave("SORT_BY_TREE",
Boolean.toString(sortByTree.isSelected()));
- Cache.applicationProperties.setProperty("PAD_GAPS",
+ Cache.setPropertyNoSave("PAD_GAPS",
Boolean.toString(padGaps.isSelected()));
if (!Platform.isJS())
/*
* Save Backups settings
*/
- Cache.applicationProperties.setProperty(BackupFiles.CONFIRM_DELETE_OLD,
+ Cache.setPropertyNoSave(BackupFiles.CONFIRM_DELETE_OLD,
Boolean.toString(backupfilesConfirmDelete.isSelected()));
- Cache.applicationProperties.setProperty(BackupFiles.ENABLED,
+ Cache.setPropertyNoSave(BackupFiles.ENABLED,
Boolean.toString(enableBackupFiles.isSelected()));
- Cache.applicationProperties.setProperty(BackupFiles.NO_MAX,
+ Cache.setPropertyNoSave(BackupFiles.NO_MAX,
Boolean.toString(backupfilesKeepAll.isSelected()));
- Cache.applicationProperties.setProperty(BackupFiles.REVERSE_ORDER,
+ Cache.setPropertyNoSave(BackupFiles.REVERSE_ORDER,
Boolean.toString(suffixReverse.isSelected()));
- Cache.applicationProperties.setProperty(BackupFiles.SUFFIX,
+ Cache.setPropertyNoSave(BackupFiles.SUFFIX,
suffixTemplate.getText());
- Cache.applicationProperties.setProperty(BackupFiles.ROLL_MAX,
+ Cache.setPropertyNoSave(BackupFiles.ROLL_MAX,
Integer.toString(getSpinnerInt(backupfilesRollMaxSpinner, 4)));
- Cache.applicationProperties.setProperty(BackupFiles.SUFFIX_DIGITS,
+ Cache.setPropertyNoSave(BackupFiles.SUFFIX_DIGITS,
Integer.toString(getSpinnerInt(suffixDigitsSpinner, 3)));
- Cache.applicationProperties.setProperty(BackupFiles.NS+"_PRESET",
+ Cache.setPropertyNoSave(BackupFiles.NS + "_PRESET",
Integer.toString(getComboIntStringKey(backupfilesPresetsCombo)));
Cache.saveProperties();
FileFormatI format = chooser.getSelectedFormat();
if (format != null)
{
- Cache.applicationProperties.setProperty("DEFAULT_FILE_FORMAT",
+ Cache.setPropertyNoSave("DEFAULT_FILE_FORMAT",
format.getName());
}
startupFileTextfield
* Returns true if chimera path is to a valid executable, else show an error
* dialog.
*/
- private boolean validateChimeraPath()
+ protected boolean validateChimeraPath()
{
if (chimeraPath.getText().trim().length() > 0)
{
}
}
- private class UrlListSelectionHandler implements ListSelectionListener
+ protected class UrlListSelectionHandler implements ListSelectionListener
{
@Override
* @author $author$
* @version $Revision$
*/
+@SuppressWarnings("serial")
public class GPreferences extends JPanel
{
private static final Font LABEL_FONT = JvSwingUtils.getLabelFont();
/*
* Connections tab components
*/
- protected JTable linkUrlTable = new JTable();
+ public JTable linkUrlTable = new JTable();
- protected JButton editLink = new JButton();
+ public JButton editLink = new JButton();
- protected JButton deleteLink = new JButton();
+ public JButton deleteLink = new JButton();
- protected JTextField filterTB = new JTextField();
+ public JTextField filterTB = new JTextField();
protected JButton doReset = new JButton();
updateBackupFilesExampleLabel();
}
- private boolean warnAboutSuffixReverseChange()
+ protected boolean warnAboutSuffixReverseChange()
{
boolean savedSuffixReverse = Cache.getDefault(BackupFiles.REVERSE_ORDER,
false);
return exampleFilesPanel;
}
- private void backupsTabUpdatePresets()
+ protected void backupsTabUpdatePresets()
{
IntKeyStringValueEntry entry = (IntKeyStringValueEntry) backupfilesPresetsCombo
.getSelectedItem();
return suffixPanel;
}
- private boolean confirmSuffixReverseChange()
+ protected boolean confirmSuffixReverseChange()
{
boolean ret = false;
String warningMessage = MessageManager
return i;
}
- private void keepRollMaxOptionsEnabled()
+ protected void keepRollMaxOptionsEnabled()
{
boolean enabled = backupfilesKeepAll.isEnabled()
&& !backupfilesKeepAll.isSelected();
backupfilesConfirmDelete.setEnabled(enabled);
}
- private void backupfilesKeepAllSetEnabled(boolean tryEnabled)
+ protected void backupfilesKeepAllSetEnabled(boolean tryEnabled)
{
boolean enabled = tryEnabled && enableBackupFiles.isSelected()
&& getComboIntStringKey(backupfilesPresetsCombo) == 0
{ Integer.valueOf(pe).toString() }));
}
final String nullChain = "TheNullChain";
- List<SequenceI> s = new ArrayList<SequenceI>();
- List<String> c = new ArrayList<String>();
+ List<SequenceI> s = new ArrayList<>();
+ List<String> c = new ArrayList<>();
if (getChains() == null)
{
setChains(new String[getPdbCount()][]);
public synchronized PDBEntry[] addSequenceAndChain(PDBEntry[] pdbe,
SequenceI[][] seq, String[][] chns)
{
- List<PDBEntry> v = new ArrayList<PDBEntry>();
- List<int[]> rtn = new ArrayList<int[]>();
+ List<PDBEntry> v = new ArrayList<>();
+ List<int[]> rtn = new ArrayList<>();
for (int i = 0; i < getPdbCount(); i++)
{
v.add(getPdbEntry(i));
}
/**
- * Returns a readable description of all mappings for the wrapped pdbfile to
- * any mapped sequences
*
- * @param pdbfile
- * @param seqs
- * @return
+ * @return a readable description of all mappings for the wrapped pdbfile to
+ * any mapped sequences
+ *
*/
public String printMappings()
{
*/
package jalview.ws;
+import jalview.datamodel.DBRefSource;
import jalview.ext.ensembl.EnsemblGene;
-import jalview.ws.dbsources.EmblCdsSource;
-import jalview.ws.dbsources.EmblSource;
-import jalview.ws.dbsources.Pdb;
-import jalview.ws.dbsources.PfamFull;
-import jalview.ws.dbsources.PfamSeed;
-import jalview.ws.dbsources.RfamSeed;
import jalview.ws.dbsources.Uniprot;
import jalview.ws.seqfetcher.ASequenceFetcher;
import jalview.ws.seqfetcher.DbSourceProxy;
*/
public SequenceFetcher()
{
- addDBRefSourceImpl(EnsemblGene.class);
- // addDBRefSourceImpl(EnsemblGenomes.class);
- addDBRefSourceImpl(EmblSource.class);
- addDBRefSourceImpl(EmblCdsSource.class);
- addDBRefSourceImpl(Uniprot.class);
- addDBRefSourceImpl(Pdb.class);
- addDBRefSourceImpl(PfamFull.class);
- addDBRefSourceImpl(PfamSeed.class);
- addDBRefSourceImpl(RfamSeed.class);
+ addAllDatabases();
+ }
+
+ public void addAllDatabases()
+ {
+ addDBRefSourceImpl(EnsemblGene.class); // includes EnsemblGenomes.class
+ addDBRefSourceImpl(Uniprot.class); // includes UniprotName.class
+ // addDBRefSourceImpl(EmblSource.class);
+ // addDBRefSourceImpl(EmblCdsSource.class);
+ // addDBRefSourceImpl(Pdb.class);
+ // addDBRefSourceImpl(PfamFull.class);
+ // addDBRefSourceImpl(PfamSeed.class);
+ // addDBRefSourceImpl(RfamSeed.class);
+ addDBRefSourceImpl(DBRefSource.EMBL,
+ "jalview.ws.dbsources.EmblSource");
+ addDBRefSourceImpl(DBRefSource.EMBLCDS,
+ "jalview.ws.dbsources.EmblCdsSource");
+ addDBRefSourceImpl(DBRefSource.PDB, "jalview.ws.dbsources.Pdb");
+ addDBRefSourceImpl(DBRefSource.PFAM_FULL,
+ "jalview.ws.dbsources.PfamFull");
+ addDBRefSourceImpl(DBRefSource.PFAM_SEED,
+ "jalview.ws.dbsources.PfamSeed");
+ addDBRefSourceImpl(DBRefSource.RFAM_SEED,
+ "jalview.ws.dbsources.RfamSeed");
}
/**
*/
package jalview.ws.dbsources;
+import jalview.datamodel.DBRefSource;
+
/**
* flyweight class specifying retrieval of Full family alignments from PFAM
*
@Override
public String getDbName()
{
- return "PFAM (Full)";
+ return DBRefSource.PFAM_FULL;
}
@Override
*/
package jalview.ws.dbsources;
+import jalview.datamodel.DBRefSource;
+
/**
* flyweight class specifying retrieval of Seed alignments from PFAM
*
@Override
public String getDbName()
{
- return "PFAM (Seed)";
+ return DBRefSource.PFAM_SEED;
}
@Override
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Stack;
import java.util.Vector;
/*
* set of databases we can retrieve entries from
*/
- protected Hashtable<String, Map<String, DbSourceProxy>> fetchableDbs;
+ protected Hashtable<String, Map<String, DbSourceProxyRoot>> fetchableDbs;
/*
* comparator to sort by tier (0/1/2) and name
public List<DbSourceProxy> getSourceProxy(String db)
{
db = DBRefUtils.getCanonicalName(db);
- Map<String, DbSourceProxy> dblist = fetchableDbs.get(db);
+ Map<String, DbSourceProxyRoot> dblist = fetchableDbs.get(db);
if (dblist == null)
{
return new ArrayList<>();
/*
* sort so that primary sources precede secondary
*/
- List<DbSourceProxy> dbs = new ArrayList<>(dblist.values());
+ List<DbSourceProxy> dbs = new ArrayList<>();
+ for (Entry<String, DbSourceProxyRoot> entry : dblist.entrySet())
+ {
+ DbSourceProxyRoot proxy = entry.getValue();
+ if (proxy instanceof DbRoot)
+ {
+ proxy = setProxy((DbRoot) proxy, dblist);
+ }
+ dbs.add((DbSourceProxy) proxy);
+ }
Collections.sort(dbs, proxyComparator);
return dbs;
}
+ class DbRoot implements DbSourceProxyRoot
+ {
+
+ private String sourceName;
+
+ private String className;
+
+ DbRoot(String sourceName, String className)
+ {
+ this.sourceName = sourceName;
+ this.className = className;
+ }
+
+ @Override
+ public String getDbSource()
+ {
+ return sourceName;
+ }
+
+ /**
+ * lazy class creation
+ *
+ * @return the actual proxy object
+ */
+ public DbSourceProxy getProxy()
+ {
+ try
+ {
+ System.err.println("ASeqFetch " + className);
+ return (DbSourceProxy) Class.forName(className).newInstance();
+ } catch (Exception e)
+ {
+ // Serious problems if this happens.
+ throw new Error(MessageManager.getString(
+ "error.dbrefsource_implementation_exception"), e);
+ }
+ }
+
+ }
+
/**
* constructs an instance of the proxy and registers it as a valid dbrefsource
*
- * @param dbSourceProxy
+ * @param dbSourceProxyClass
* reference for class implementing
* jalview.ws.seqfetcher.DbSourceProxy
*/
protected void addDBRefSourceImpl(
- Class<? extends DbSourceProxy> dbSourceProxy)
+ Class<? extends DbSourceProxy> dbSourceProxyClass)
throws IllegalArgumentException
{
DbSourceProxy proxy = null;
try
{
- DbSourceProxy proxyObj = dbSourceProxy.getConstructor().newInstance();
- proxy = proxyObj;
+ proxy = dbSourceProxyClass.getConstructor().newInstance();
} catch (IllegalArgumentException e)
{
throw e;
addDbRefSourceImpl(proxy);
}
+ public void addDBRefSourceImpl(String sourceName, String className)
+ {
+ addDbRefSourceImpl(new DbRoot(sourceName, className));
+ }
+
/**
* add the properly initialised DbSourceProxy object 'proxy' to the list of
* sequence fetchers
*
* @param proxy
*/
- protected void addDbRefSourceImpl(DbSourceProxy proxy)
+ void addDbRefSourceImpl(DbSourceProxyRoot proxy)
{
if (proxy != null)
{
{
fetchableDbs = new Hashtable<>();
}
- Map<String, DbSourceProxy> slist = fetchableDbs
- .get(proxy.getDbSource());
+ String key = proxy.getDbSource();
+ Map<String, DbSourceProxyRoot> slist = fetchableDbs.get(key);
if (slist == null)
{
- fetchableDbs.put(proxy.getDbSource(),
- slist = new Hashtable<>());
+ fetchableDbs.put(key, slist = new Hashtable<>());
+ }
+ if (proxy instanceof DbRoot)
+ {
+ slist.put("", proxy);
+ }
+ else
+ {
+ slist.put(((DbSourceProxy) proxy).getDbName(), proxy);
}
- slist.put(proxy.getDbName(), proxy);
}
}
/**
* select sources which are implemented by instances of the given class
*
- * @param class
+ * @param class1
* that implements DbSourceProxy
* @return null or vector of source names for fetchers
*/
- public String[] getDbInstances(Class class1)
+ public String[] getDbInstances(Class<?> class1)
{
if (!DbSourceProxy.class.isAssignableFrom(class1))
{
{
return null;
}
- String[] sources = null;
Vector<String> src = new Vector<>();
- Enumeration<String> dbs = fetchableDbs.keys();
- while (dbs.hasMoreElements())
+ for (String dbSource : fetchableDbs.keySet())
{
- String dbn = dbs.nextElement();
- for (DbSourceProxy dbp : fetchableDbs.get(dbn).values())
+ Map<String, DbSourceProxyRoot> dblist = fetchableDbs.get(dbSource);
+ for (Entry<String, DbSourceProxyRoot> entry : dblist.entrySet())
{
- if (class1.isAssignableFrom(dbp.getClass()))
+ DbSourceProxyRoot proxy = entry.getValue();
+ if (proxy instanceof DbRoot)
{
- src.addElement(dbn);
+ proxy = setProxy((DbRoot) proxy, dblist);
+ }
+ Class<?> c = proxy.getClass();
+ if (class1 == c || class1.isAssignableFrom(c))
+ {
+ src.addElement(dbSource);
}
}
}
+ String[] sources = null;
if (src.size() > 0)
{
src.copyInto(sources = new String[src.size()]);
return sources;
}
- public DbSourceProxy[] getDbSourceProxyInstances(Class class1)
+ private DbSourceProxyRoot setProxy(DbRoot root,
+ Map<String, DbSourceProxyRoot> dblist)
+ {
+ DbSourceProxy proxy = root.getProxy();
+ // Time to create the actual proxy
+ dblist.remove("");
+ dblist.put(proxy.getDbName(), proxy);
+ return proxy;
+ }
+
+ public DbSourceProxy[] getDbSourceProxyInstances(Class<?> class1)
{
+ if (fetchableDbs == null)
+ {
+ return null;
+ }
List<DbSourceProxy> prlist = new ArrayList<>();
- for (String fetchable : getSupportedDb())
+ for (String fetchable : fetchableDbs.keySet())
{
for (DbSourceProxy pr : getSourceProxy(fetchable))
{
*
* @author JimP
*/
-public interface DbSourceProxy
+public interface DbSourceProxy extends DbSourceProxyRoot
{
/**
- *
- * @return source string constant used for this DB source
- */
- String getDbSource();
-
- /**
* Short meaningful name for this data source for display in menus or
* selection boxes.
*
--- /dev/null
+package jalview.ws.seqfetcher;
+
+public interface DbSourceProxyRoot
+{
+ /**
+ *
+ * @return source string constant used for this DB source
+ */
+ String getDbSource();
+
+}
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("PAD_GAPS",
+ Cache.setPropertyNoSave("PAD_GAPS",
Boolean.FALSE.toString());
String seqData = "seq1seq1/8-18 ABCD--EF-GHIJI\n" + "seq2 A--BCDefHI\n"
@Test(groups = "Functional")
public void testGetCodeTable()
{
- GeneticCodes codes = GeneticCodes.getInstance();
- assertEquals(codes.getStandardCodeTable().getName(), "Standard");
- assertEquals(codes.getStandardCodeTable().getId(), "1");
- assertSame(codes.getStandardCodeTable(), codes.getCodeTable("1"));
- assertEquals(codes.getCodeTable("2").getName(),
+ assertEquals(GeneticCodes.getStandardCodeTable().getName(), "Standard");
+ assertEquals(GeneticCodes.getStandardCodeTable().getId(), "1");
+ assertSame(GeneticCodes.getStandardCodeTable(),
+ GeneticCodes.getCodeTable("1"));
+ assertEquals(GeneticCodes.getCodeTable("2").getName(),
"Vertebrate Mitochondrial");
- assertEquals(codes.getCodeTable("11").getName(),
+ assertEquals(GeneticCodes.getCodeTable("11").getName(),
"Bacterial, Archaeal and Plant Plastid");
- assertEquals(codes.getCodeTable("31").getName(),
+ assertEquals(GeneticCodes.getCodeTable("31").getName(),
"Blastocrithidia Nuclear");
}
@Test(groups = "Functional")
public void testGetCodeTables()
{
- GeneticCodes codes = GeneticCodes.getInstance();
- Iterator<GeneticCodeI> tableIterator = codes.getCodeTables().iterator();
+ Iterator<GeneticCodeI> tableIterator = GeneticCodes.getCodeTables()
+ .iterator();
String[] ids = new String[] { "1", "2", "3", "4", "5", "6", "9", "10",
"11", "12", "13", "14", "15", "16", "21", "22", "23", "24", "25",
"26", "27", "28", "29", "30", "31" };
@Test(groups = "Functional")
public void testTranslate()
{
- GeneticCodes codes = GeneticCodes.getInstance();
-
- GeneticCodeI gc = codes.getCodeTable("1");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("1");
assertNull(gc.translate("XYZ"));
assertEquals(gc.translate("AGA"), "R");
- gc = codes.getCodeTable("2");
+ gc = GeneticCodes.getCodeTable("2");
assertEquals(gc.translate("AGA"), "*"); // variant
assertEquals(gc.translate("ttc"), "F"); // non-variant
// table 11 has no variant translations - should serve the standard values
- gc = codes.getCodeTable("11");
+ gc = GeneticCodes.getCodeTable("11");
assertEquals(gc.translate("ttc"), "F");
- gc = codes.getCodeTable("31");
+ gc = GeneticCodes.getCodeTable("31");
assertEquals(gc.translate("TGA"), "W"); // variant
assertEquals(gc.translate("tag"), "E"); // variant
assertEquals(gc.translate("AGC"), "S"); // non-variant
@Test(groups = { "Functional" })
public void testTranslate_standardTable()
{
- GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable();
+ GeneticCodeI st = GeneticCodes.getStandardCodeTable();
assertEquals("F", st.translate("TTT"));
assertEquals("F", st.translate("TTC"));
assertEquals("L", st.translate("TTA"));
@Test(groups = { "Functional" })
public void testTranslate_standardTableAmbiguityCodes()
{
- GeneticCodeI st = GeneticCodes.getInstance().getStandardCodeTable();
+ GeneticCodeI st = GeneticCodes.getStandardCodeTable();
// Y is C or T
assertEquals("C", st.translate("TGY"));
// Phenylalanine first base variation
@Test(groups = { "Functional" })
public void testTranslate_nonStandardTableAmbiguityCodes()
{
- GeneticCodeI standard = GeneticCodes.getInstance()
+ GeneticCodeI standard = GeneticCodes
.getStandardCodeTable();
/*
* Vertebrate Mitochondrial (Table 2)
*/
- GeneticCodeI gc = GeneticCodes.getInstance().getCodeTable("2");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("2");
// AGR is AGA or AGG - R in standard code, * in table 2
assertEquals(gc.translate("AGR"), "*");
assertEquals(standard.translate("AGR"), "R");
/*
* Yeast Mitochondrial (Table 3)
*/
- gc = GeneticCodes.getInstance().getCodeTable("3");
+ gc = GeneticCodes.getCodeTable("3");
// CTN is L in standard code, T in table 3
assertEquals(gc.translate("ctn"), "T");
assertEquals(standard.translate("CTN"), "L");
/*
* Alternative Yeast Nuclear (Table 12)
*/
- gc = GeneticCodes.getInstance().getCodeTable("12");
+ gc = GeneticCodes.getCodeTable("12");
// CTG is S; in the standard code CTN is L
assertEquals(gc.translate("CTG"), "S");
assertNull(gc.translate("CTK")); // K is G or T -> S or L
/*
* Trematode Mitochondrial (Table 21)
*/
- gc = GeneticCodes.getInstance().getCodeTable("21");
+ gc = GeneticCodes.getCodeTable("21");
// AAR is K in standard code, ambiguous in table 21 as AAA=N not K
assertNull(gc.translate("AAR"));
assertEquals(standard.translate("AAR"), "K");
@Test(groups = "Functional")
public void testTranslateCanonical()
{
- GeneticCodes codes = GeneticCodes.getInstance();
-
- GeneticCodeI gc = codes.getCodeTable("1");
+ GeneticCodeI gc = GeneticCodes.getCodeTable("1");
assertNull(gc.translateCanonical("XYZ"));
assertEquals(gc.translateCanonical("AGA"), "R");
// translateCanonical should not resolve ambiguity codes
assertNull(gc.translateCanonical("TGY"));
- gc = codes.getCodeTable("2");
+ gc = GeneticCodes.getCodeTable("2");
assertNull(gc.translateCanonical("AGR"));
assertEquals(gc.translateCanonical("AGA"), "*"); // variant
assertEquals(gc.translateCanonical("ttc"), "F"); // non-variant
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Cache.setPropertyNoSave("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_TEMPFACT_ANN",
+ Cache.setPropertyNoSave("ADD_TEMPFACT_ANN",
Boolean.FALSE.toString());
- Cache.applicationProperties.setProperty("ADD_SS_ANN",
+ Cache.setPropertyNoSave("ADD_SS_ANN",
Boolean.TRUE.toString());
StructureImportSettings.setDefaultStructureFileFormat("PDB");
StructureImportSettings
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Cache.setPropertyNoSave("SHOW_IDENTITY",
Boolean.TRUE.toString());
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
DataSourceType.FILE);
@Test(groups = { "Functional" }, timeOut=2000)
public void testUpdateConservation_qualityOnly()
{
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("SHOW_QUALITY",
+ Cache.setPropertyNoSave("SHOW_QUALITY",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
+ Cache.setPropertyNoSave("SHOW_CONSERVATION",
Boolean.FALSE.toString());
- Cache.applicationProperties.setProperty("SHOW_OCCUPANCY",
+ Cache.setPropertyNoSave("SHOW_OCCUPANCY",
Boolean.FALSE.toString());
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Cache.setPropertyNoSave("SHOW_IDENTITY",
Boolean.FALSE.toString());
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
/*
* test for JAL-2283: don't inadvertently turn on colour by conservation
*/
- Cache.applicationProperties.setProperty("DEFAULT_COLOUR_PROT", "None");
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION",
+ Cache.setPropertyNoSave("DEFAULT_COLOUR_PROT", "None");
+ Cache.setPropertyNoSave("SHOW_CONSERVATION",
Boolean.TRUE.toString());
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
Jalview.main(new String[] { "-nonews", "-props",
"test/jalview/testProps.jvprops" });
- Cache.applicationProperties.setProperty("SHOW_IDENTITY",
+ Cache.setPropertyNoSave("SHOW_IDENTITY",
Boolean.TRUE.toString());
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
DataSourceType.FILE);
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
// pin down annotation sort order for test
- Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
+ Cache.setPropertyNoSave(Preferences.SORT_ANNOTATIONS,
SequenceAnnotationOrder.NONE.name());
final String TRUE = Boolean.TRUE.toString();
- Cache.applicationProperties.setProperty(
+ Cache.setPropertyNoSave(
Preferences.SHOW_AUTOCALC_ABOVE, TRUE);
- Cache.applicationProperties.setProperty("SHOW_QUALITY", TRUE);
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION", TRUE);
- Cache.applicationProperties.setProperty("SHOW_IDENTITY", TRUE);
+ Cache.setPropertyNoSave("SHOW_QUALITY", TRUE);
+ Cache.setPropertyNoSave("SHOW_CONSERVATION", TRUE);
+ Cache.setPropertyNoSave("SHOW_IDENTITY", TRUE);
AlignmentI al = new FormatAdapter().readFile(TEST_DATA,
DataSourceType.PASTE, FileFormat.Fasta);
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
// pin down annotation sort order for test
- Cache.applicationProperties.setProperty(Preferences.SORT_ANNOTATIONS,
+ Cache.setPropertyNoSave(Preferences.SORT_ANNOTATIONS,
SequenceAnnotationOrder.NONE.name());
final String TRUE = Boolean.TRUE.toString();
- Cache.applicationProperties.setProperty(Preferences.SHOW_AUTOCALC_ABOVE,
+ Cache.setPropertyNoSave(Preferences.SHOW_AUTOCALC_ABOVE,
TRUE);
- Cache.applicationProperties.setProperty("SHOW_QUALITY", TRUE);
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION", TRUE);
- Cache.applicationProperties.setProperty("SHOW_IDENTITY", TRUE);
+ Cache.setPropertyNoSave("SHOW_QUALITY", TRUE);
+ Cache.setPropertyNoSave("SHOW_CONSERVATION", TRUE);
+ Cache.setPropertyNoSave("SHOW_IDENTITY", TRUE);
AlignmentI al = new FormatAdapter().readFile(TEST_DATA,
DataSourceType.PASTE, FileFormat.Fasta);
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS",
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty(
+ Cache.setPropertyNoSave(
Preferences.SHOW_AUTOCALC_ABOVE, Boolean.TRUE.toString());
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
DataSourceType.FILE);
{
// read-only Jalview properties
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("BLOSUM62_PCA_FOR_NUCLEOTIDE",
+ Cache.setPropertyNoSave("BLOSUM62_PCA_FOR_NUCLEOTIDE",
Boolean.FALSE.toString());
}
/*
* enable inclusion of BLOSUM62 for nucleotide PCA (JAL-2962)
*/
- Cache.applicationProperties.setProperty("BLOSUM62_PCA_FOR_NUCLEOTIDE",
+ Cache.setPropertyNoSave("BLOSUM62_PCA_FOR_NUCLEOTIDE",
Boolean.TRUE.toString());
/*
Jalview.main(new String[] { "-nonews", "-props",
"test/jalview/testProps.jvprops" });
String True = Boolean.TRUE.toString();
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", True);
- Cache.applicationProperties.setProperty("SHOW_QUALITY", True);
- Cache.applicationProperties.setProperty("SHOW_CONSERVATION", True);
- Cache.applicationProperties.setProperty("SHOW_OCCUPANCY", True);
- Cache.applicationProperties.setProperty("SHOW_IDENTITY", True);
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS", True);
+ Cache.setPropertyNoSave("SHOW_QUALITY", True);
+ Cache.setPropertyNoSave("SHOW_CONSERVATION", True);
+ Cache.setPropertyNoSave("SHOW_OCCUPANCY", True);
+ Cache.setPropertyNoSave("SHOW_IDENTITY", True);
}
/**
@Test(groups = "Functional")
public void testFindMousePosition_wrapped_annotations()
{
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "true");
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "true");
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
AlignViewportI av = alignFrame.getViewport();
@Test(groups = "Functional")
public void testFindMousePosition_wrapped_scaleAbove()
{
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "true");
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "true");
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
AlignViewportI av = alignFrame.getViewport();
@Test(groups = "Functional")
public void testFindMousePosition_wrapped_noAnnotations()
{
- Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", "false");
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+ Cache.setPropertyNoSave("SHOW_ANNOTATIONS", "false");
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
AlignViewportI av = alignFrame.getViewport();
@Test(groups = "Functional")
public void testFindColumn_unwrapped()
{
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "false");
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT", "false");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
SeqPanel testee = alignFrame.alignPanel.getSeqPanel();
@Test(groups = "Functional")
public void testFindColumn_wrapped()
{
- Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
+ Cache.setPropertyNoSave("WRAP_ALIGNMENT", "true");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
"examples/uniref50.fa", DataSourceType.FILE);
AlignViewport av = alignFrame.getViewport();
@BeforeMethod(alwaysRun = true)
public void setup() throws Exception
{
- Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Cache.setPropertyNoSave("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_SS_ANN",
+ Cache.setPropertyNoSave("ADD_SS_ANN",
Boolean.TRUE.toString());
FileLoader loader = new FileLoader(false);
AlignFrame af = loader.LoadFileWaitTillLoaded("examples/1gaq.txt",
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty(BackupFiles.ENABLED,
+ Cache.setPropertyNoSave(BackupFiles.ENABLED,
Boolean.toString(enabled));
- Cache.applicationProperties.setProperty(BackupFiles.SUFFIX, suffix);
- Cache.applicationProperties.setProperty(BackupFiles.SUFFIX_DIGITS,
+ Cache.setPropertyNoSave(BackupFiles.SUFFIX, suffix);
+ Cache.setPropertyNoSave(BackupFiles.SUFFIX_DIGITS,
Integer.toString(digits));
- Cache.applicationProperties.setProperty(BackupFiles.REVERSE_ORDER,
+ Cache.setPropertyNoSave(BackupFiles.REVERSE_ORDER,
Boolean.toString(reverse));
- Cache.applicationProperties.setProperty(BackupFiles.NO_MAX,
+ Cache.setPropertyNoSave(BackupFiles.NO_MAX,
Boolean.toString(noMax));
- Cache.applicationProperties.setProperty(BackupFiles.ROLL_MAX,
+ Cache.setPropertyNoSave(BackupFiles.ROLL_MAX,
Integer.toString(rollMax));
- Cache.applicationProperties.setProperty(BackupFiles.CONFIRM_DELETE_OLD,
+ Cache.setPropertyNoSave(BackupFiles.CONFIRM_DELETE_OLD,
"false");
}
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
// ensure 'add annotation from structure' is selected
- Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Cache.setPropertyNoSave("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_SS_ANN",
+ Cache.setPropertyNoSave("ADD_SS_ANN",
Boolean.TRUE.toString());
sf = new SequenceFetcher();
@Test(groups = { "Network" }, enabled = true)
public void testRnaSeqRetrieve() throws Exception
{
- Cache.applicationProperties.setProperty("PDB_DOWNLOAD_FORMAT", "PDB");
+ Cache.setPropertyNoSave("PDB_DOWNLOAD_FORMAT", "PDB");
List<DbSourceProxy> sps = sf.getSourceProxy("PDB");
AlignmentI response = sps.get(0).getSequenceRecords("2GIS");
assertTrue(response != null);
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
// ensure 'add annotation from structure' is selected
- Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Cache.setPropertyNoSave("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_SS_ANN",
+ Cache.setPropertyNoSave("ADD_SS_ANN",
Boolean.TRUE.toString());
sf = new SequenceFetcher();
public void setUp()
{
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Cache.applicationProperties.setProperty("STRUCT_FROM_PDB",
+ Cache.setPropertyNoSave("STRUCT_FROM_PDB",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_TEMPFACT_ANN",
+ Cache.setPropertyNoSave("ADD_TEMPFACT_ANN",
Boolean.TRUE.toString());
- Cache.applicationProperties.setProperty("ADD_SS_ANN",
+ Cache.setPropertyNoSave("ADD_SS_ANN",
Boolean.TRUE.toString());
StructureImportSettings.setDefaultStructureFileFormat("PDB");
}