Jalview.processAllAppletElements = function(PageInfo) {
- var apps = document.getElementsByTagName("applet");
- for (var i = apps.length; --i >= 0;) {
+ var applets = document.getElementsByTagName("applet");
+ var apps=[];
+ for (var i = 0; i < applets.length; i++)
+ apps[i] = applets[i];
+ for (var i = 0; i < apps.length; i++) {
Jalview.processAppletElement(apps[i], PageInfo);
}
}
// generate name/value pairs for parameters in Applet tag
- if (!Info.j2sAppletID) {
- Info.j2sAppletID = Info.idPrefix.replace(/%ID%/g, "jalview" + Jalview.jvid++);
-}
-
-
-Info.jalview_SCREEN_X= 10,Info.jalview_SCREEN_Y= 10;
-Info.jalview_EMBEDDED= true;
-Info.jalview_SCREEN_WIDTH = 400;
-Info.jalview_SCREEN_HEIGHT = 100;
+ Info.j2sAppletID = Info.j2sAppletID
+ || element.getAttribute("name")
+ || element.getAttribute("id")
+ || Info.idPrefix.replace(/%ID%/g, "jalview" + ++Jalview.jvid);
+
+//Info.jalview_SCREEN_X= 10,Info.jalview_SCREEN_Y= 10;
+//Info.jalview_EMBEDDED= true;
+//Info.jalview_SCREEN_WIDTH = 400;
+//Info.jalview_SCREEN_HEIGHT = 100;
var addParam = function(key,value) {
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.SequenceGroup;
+import jalview.gui.Preferences;
import jalview.schemes.AnnotationColourGradient;
import jalview.schemes.ColourSchemeI;
import jalview.util.MessageManager;
private void setDefaultMinMax()
{
minColour.setBackground(av.applet.getDefaultColourParameter(
- "ANNOTATIONCOLOUR_MIN", Color.orange));
+ Preferences.ANNOTATIONCOLOUR_MIN, Color.orange));
maxColour.setBackground(av.applet
- .getDefaultColourParameter("ANNOTATIONCOLOUR_MAX", Color.red));
+ .getDefaultColourParameter(Preferences.ANNOTATIONCOLOUR_MAX, Color.red));
}
package jalview.bin;
+import jalview.gui.Preferences;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
{
private final static String[] params = { "alignpdbfiles",
- "ANNOTATIONCOLOUR_MAX", "ANNOTATIONCOLOUR_MIN", "annotations",
+ Preferences.ANNOTATIONCOLOUR_MAX, Preferences.ANNOTATIONCOLOUR_MIN,
+ "annotations",
"APPLICATION_URL", "automaticScrolling", "centrecolumnlabels",
"debug", "defaultColour", "defaultColourNuc", "defaultColourProt",
"embedded", "enableSplitFrame", "externalstructureviewer", "features",
switch (appletName)
{
+
// tested, working:
+
+ case "file":
+ appName = "open";
+ value = resourcePath + value;
+ appletName = null;
+ break;
+ case "file2":
+ value = resourcePath + value;
+ appName = null;
+ break;
case "jnetfile":
value = resourcePath + value;
appName = null;
appName = null;
break;
case "pdbfile":
- appName = "PDBFILE";
value = resourcePath + value;
appName = null;
break;
value = resourcePath + value;
appletName = null; // taken care of by Jalview
break;
- // implemented; not tested:
- case "annotations":
- value = resourcePath + value;
- appName = null;
- break;
case "defaultcolour":
- appName = "DEFAULT_COLOUR"; // defaultColour
+ appName = Preferences.DEFAULT_COLOUR;
break;
case "defaultcolournuc":
- appName = "DEFAULT_COLOUR_NUC";// defaultColourNuc
+ appName = Preferences.DEFAULT_COLOUR_NUC;
break;
case "defaultcolourprot":
- appName = "DEFAULT_COLOUR_PROT";// defaultColourProt";
+ appName = Preferences.DEFAULT_COLOUR_PROT;
+ break;
+
+ // implemented; not tested:
+
+ case "oninit":
+ appName = null;
+ break;
+ case "annotations":
+ value = resourcePath + value;
+ appName = null;
break;
case "annotationcolour_max":
- appName = "ANNOTATIONCOLOUR_MAX";
+ appName = Preferences.ANNOTATIONCOLOUR_MAX;
break;
case "annotationcolour_min":
- appName = "ANNOTATIONCOLOUR_MIN";
+ appName = Preferences.ANNOTATIONCOLOUR_MIN;
+ break;
+ case "enablesplitframe":
+ appName = Preferences.ENABLE_SPLIT_FRAME;
+ break;
+ case "hidefeaturegroups":
break;
case "centrecolumnlabels":
appName = null;
break;
- case "enablesplitframe":
- appName = "enableSplitFrame";
+ case "pdbseq":
+ appName = null;
+ break;
+ case "sortby":
+ appName = Preferences.SORT_ALIGNMENT; // id, etc.
+ break;
+ case "sortbytree":
+ appName = Preferences.SORT_BY_TREE;
+ value = checkTF(value);
+ appletName = null; // taken care of by Jalview
break;
+ case "format":
+ break;
+
+ // probably not relevant:
+
case "externalstructureviewer":
break;
case "alignpdbfiles":
case "heightscale":
appName = "heightScale";
break;
- case "hidefeaturegroups":
- break;
case "jalviewhelpurl":
break;
case "label":
case "linkurl_":
appName = "linkURL_";
break;
+ case "rgb":
+ appName = null; // no background for application
+ break;
+
+ // unknown:
+
case "nojmol":
break;
case "normaliselogo":
- appName = "normaliseLogo";
+ appName = Preferences.NORMALISE_LOGO;
break;
case "normalisesequencelogo":
- appName = "normaliseSequenceLogo";
- break;
- case "oninit":
- break;
- case "pdbseq":
- appName = "PDBSEQ";
+ appName = Preferences.NORMALISE_CONSENSUS_LOGO;
break;
case "relaxedidmatch":
break;
case "resolvetocodebase":
break;
- case "rgb":
- appName = "RGB";
- break;
case "scaleproteinascdna":
appName = "scaleProteinAsCdna";
break;
break;
case "sequence":
break;
- case "sortby":
- break;
- case "sortbytree":
- value = checkTF(value);
- appletName = null; // taken care of by Jalview
- break;
- case "format":
- break;
- case "scorefile":
- appName = "scoreFile";
- value = resourcePath + value;
- break;
case "uppercase":
appName = "upperCase";
break;
appName = "windowWidth";
break;
case "wrap":
+ appName = Preferences.WRAP_ALIGNMENT;
break;
+ case "scorefile":
+ appName = "scoreFile";
+ value = resourcePath + value;
+ break;
+
+ // TRUE/FALSE
- // cases not handled in doc/parameters.xlsx
case "debug":
value = checkTF(value);
break;
- case "file":
- appName = "open";
- value = resourcePath + value;
- break;
- case "file2":
- value = resourcePath + value;
- break;
case "embedded":
value = checkTF(value);
break;
- case "showannotation":
- appName = "SHOW_ANNOTATIONS";
+ case "showbutton":
value = checkTF(value);
break;
- case "showbutton":
+ case "showannotation":
+ appName = Preferences.SHOW_ANNOTATIONS;
value = checkTF(value);
break;
case "showconsensus":
- appName = "SHOW_CONSENSUS_LOGO";
+ appName = Preferences.SHOW_CONSENSUS_LOGO;
value = checkTF(value);
break;
case "showconsensushistogram":
- appName = "SHOW_CONSENSUS_HISTOGRAM";
+ appName = Preferences.SHOW_CONSENSUS_HISTOGRAM;
value = checkTF(value);
break;
case "showconservation":
- appName = "SHOW_CONSERVATION";
+ appName = Preferences.SHOW_CONSERVATION;
value = checkTF(value);
break;
- case "showfeaturegroups":
+ case "showgroupconsensus":
+ appName = Preferences.SHOW_GROUP_CONSENSUS;
value = checkTF(value);
break;
- case "showfeaturesettings":
- appName = "showFeatureSettings";
+ case "showgroupconservation":
+ appName = Preferences.SHOW_GROUP_CONSERVATION;
value = checkTF(value);
break;
- case "showfullid":
- appName = "showFullId";
+ case "showoccupancy":
+ appName = Preferences.SHOW_OCCUPANCY;
value = checkTF(value);
break;
- case "showgroupconsensus":
- appName = "SHOW_GROUP_CONSENSUS";
+ case "showquality":
+ appName = Preferences.SHOW_QUALITY;
value = checkTF(value);
break;
- case "showgroupconservation":
- appName = "SHOW_GROUP_CONSERVATION";
+ case "showsequencelogo":
+ appName = Preferences.SHOW_CONSENSUS_LOGO;
value = checkTF(value);
break;
- case "showoccupancy":
- appName = "SHOW_OCCUPANCY";
+ case "showfeaturegroups":
value = checkTF(value);
break;
- case "showquality":
- appName = "SHOW_QUALITY";
+ case "showfeaturesettings":
+ appName = "showFeatureSettings";
value = checkTF(value);
break;
- case "showsequencelogo":
- appName = "showSequenceLogo";
+ case "showfullid":
+ appName = "showFullId";
value = checkTF(value);
break;
case "showtreebootstraps":
value = checkTF(value);
break;
case "showunconserved":
- appName = "showUnconserved";
+ appName = Preferences.SHOW_UNCONSERVED;
value = checkTF(value);
break;
case "showunlinkedtreenodes":
value = checkTF(value);
break;
default:
+ // could be pdbFile2, for example
+ // or one of the app preference names
break;
}
if (value != null)
import jalview.datamodel.SequenceI;
import jalview.ext.so.SequenceOntology;
import jalview.gui.AlignFrame;
+import jalview.gui.AlignViewport;
import jalview.gui.Desktop;
import jalview.gui.Preferences;
import jalview.gui.PromptUserConfig;
}
}
- String data = null;
- FileLoader fileLoader = new FileLoader(!headless);
// script to execute after all loading is
// completed one way or another
.getString("status.processing_commandline_args"),
progress = System.currentTimeMillis());
}
- System.out.println("CMD [-open " + file + "] executed successfully!");
if (!isJS)
/**
// TODO ?
}
- AlignFrame af = fileLoader.LoadFileWaitTillLoaded(file, protocol,
+ AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
+ protocol,
format);
if (af == null)
{
}
else
{
+ System.out
+ .println("CMD [-open " + file + "] executed successfully!");
+ if (file2 != null)
+ {
+ protocol = AppletFormatAdapter.checkProtocol(file2);
+ try
+ {
+ format = new IdentifyFile().identify(file2, protocol);
+ } catch (FileFormatException e1)
+ {
+ // TODO ?
+ }
+ AlignFrame af2 = new FileLoader(!headless).loadFileWaitTillLoaded(
+ file2,
+ protocol, format);
+ if (af2 == null)
+ {
+ System.out.println("error");
+ }
+ else
+ {
+ AlignViewport.openLinkedAlignmentAs(af,
+ af.getViewport().getAlignment(),
+ af2.getViewport().getAlignment(), "",
+ AlignViewport.SPLIT_FRAME);
+ }
+ }
+
setCurrentAlignFrame(af);
// TODO: file2 How to implement file2 for the applet spit screen?
- data = aparser.getValue(ArgsParser.COLOUR, true);
+ String data = aparser.getValue(ArgsParser.COLOUR, true);
if (data != null)
{
data.replaceAll("%20", " ");
loadAppletParams(aparser, af);
}
else if (!isJS)
- /**
- * Java only
- *
- * @j2sIgnore
- */
+ /**
+ * Java only
+ *
+ * @j2sIgnore
+ */
{
if (groovyscript != null)
{
- // Execute the groovy script after we've done all the rendering stuff
+ // Execute the groovy script after we've done all the rendering
+ // stuff
// and before any images or figures are generated.
System.out.println("Executing script " + groovyscript);
executeGroovyScript(groovyscript, af);
}
}
- startUpAlframe = fileLoader.LoadFileWaitTillLoaded(file, protocol,
+ startUpAlframe = new FileLoader(!headless)
+ .loadFileWaitTillLoaded(file, protocol,
format);
// extract groovy arguments before anything else.
}
@Override
public boolean loadScoreFile(String sScoreFile) throws IOException
{
- af.loadJalviewDataFile(sScoreFile, null,
- null, null);
+ af.loadJalviewDataFile(sScoreFile, null, null, null);
return true;
}
};
new JalviewAppLoader(true).load(app);
-
}
}
public class JalviewAppLoader
{
- private JalviewApp app;
+ private JalviewApp app; // Jalview or JalviewJS or JalviewLite
private boolean debug;
.getString("error.invalid_separator_parameter"));
}
}
+
+ // Background color
+
int r = 255;
int g = 255;
int b = 255;
b = 255;
}
}
+ setBackground(new Color(r, g, b));
+
param = getParameter("label");
if (param != null)
{
launcher.setLabel(param);
}
- setBackground(new Color(r, g, b));
-
file = getParameter("file");
if (file == null)
// modifyPID.setEnabled(false);
}
- String sortby = jalview.bin.Cache.getDefault("SORT_ALIGNMENT",
+ String sortby = jalview.bin.Cache.getDefault(Preferences.SORT_ALIGNMENT,
"No sort");
if (sortby.equals("Id"))
DataSourceType protocol = fileName.startsWith("http:")
? DataSourceType.URL
: DataSourceType.FILE;
- loader.LoadFile(viewport, fileName, protocol, currentFileFormat);
+ loader.loadFile(viewport, fileName, protocol, currentFileFormat);
}
else
{
DataSourceType protocol = (fileName.startsWith("http:")
? DataSourceType.URL
: DataSourceType.FILE);
- newframe = loader.LoadFileWaitTillLoaded(fileName, protocol,
+ newframe = loader.loadFileWaitTillLoaded(fileName, protocol,
currentFileFormat);
}
else
{
- newframe = loader.LoadFileWaitTillLoaded(fileObject,
+ newframe = loader.loadFileWaitTillLoaded(fileObject,
DataSourceType.FILE, currentFileFormat);
}
if (Cache.getDefault(Preferences.ENABLE_SPLIT_FRAME, true))
{
final SequenceI[] seqs = viewport.getSelectionAsNewSequence();
- viewport.openSplitFrame(af, new Alignment(seqs));
+ AlignViewport.openSplitFrame(this, af, new Alignment(seqs));
}
else
{
}
else
{
- new FileLoader().LoadFile(viewport, file, sourceType, format);
+ new FileLoader().loadFile(viewport, file, sourceType, format);
}
}
}
antiAlias = Cache.getDefault("ANTI_ALIAS", false);
viewStyle.setShowJVSuffix(Cache.getDefault("SHOW_JVSUFFIX", true));
- setShowAnnotation(Cache.getDefault("SHOW_ANNOTATIONS", true));
+ setShowAnnotation(Cache.getDefault(Preferences.SHOW_ANNOTATIONS, true));
setRightAlignIds(Cache.getDefault("RIGHT_ALIGN_IDS", false));
setCentreColumnLabels(Cache.getDefault("CENTRE_COLUMN_LABELS", false));
setShowNPFeats(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
setShowDBRefs(Cache.getDefault("SHOW_DBREFS_TOOLTIP", true));
viewStyle.setSeqNameItalics(Cache.getDefault("ID_ITALICS", true));
- viewStyle.setWrapAlignment(Cache.getDefault("WRAP_ALIGNMENT", false));
+ viewStyle.setWrapAlignment(
+ Cache.getDefault(Preferences.WRAP_ALIGNMENT, false));
viewStyle.setShowUnconserved(
- Cache.getDefault("SHOW_UNCONSERVED", false));
- sortByTree = Cache.getDefault("SORT_BY_TREE", false);
+ Cache.getDefault(Preferences.SHOW_UNCONSERVED, false));
+ sortByTree = Cache.getDefault(Preferences.SORT_BY_TREE, false);
followSelection = Cache.getDefault("FOLLOW_SELECTIONS", true);
sortAnnotationsBy = SequenceAnnotationOrder
.valueOf(Cache.getDefault(Preferences.SORT_ANNOTATIONS,
{
if (!alignment.isNucleotide())
{
- showConservation = Cache.getDefault("SHOW_CONSERVATION", true);
- showQuality = Cache.getDefault("SHOW_QUALITY", true);
+ showConservation = Cache.getDefault(Preferences.SHOW_CONSERVATION, true);
+ showQuality = Cache.getDefault(Preferences.SHOW_QUALITY, true);
showGroupConservation = Cache.getDefault("SHOW_GROUP_CONSERVATION",
false);
}
showConsensusHistogram = Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM",
true);
- showSequenceLogo = Cache.getDefault("SHOW_CONSENSUS_LOGO", false);
- normaliseSequenceLogo = Cache.getDefault("NORMALISE_CONSENSUS_LOGO",
+ showSequenceLogo = Cache.getDefault(Preferences.SHOW_CONSENSUS_LOGO, false);
+
+ normaliseSequenceLogo = Cache.getDefault(
+ Preferences.NORMALISE_CONSENSUS_LOGO,
false);
- showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
+ showGroupConsensus = Cache
+ .getDefault(Preferences.SHOW_GROUP_CONSENSUS, false);
showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
showOccupancy = Cache.getDefault(Preferences.SHOW_OCCUPANCY, true);
firePropertyChange("alignment", null, getAlignment().getSequences());
}
+ public final static int NO_SPLIT = 0;
+
+ public final static int SPLIT_FRAME = 1;
+
+ public final static int NEW_WINDOW = 2;
+
/**
* Show a dialog with the option to open and link (cDNA <-> protein) as a new
* alignment, either as a standalone alignment or in a split frame. Returns
MessageManager.getString("label.new_window"), };
final String question = JvSwingUtils.wrapTooltip(true,
MessageManager.getString("label.open_split_window?"));
- final AlignViewport us = this;
+
/*
* options No, Split Window, New Window correspond to
* dialog responses 0, 1, 2 (even though JOptionPane shows them
* in reverse order)
*/
JvOptionPane dialog = JvOptionPane.newOptionDialog(Desktop.getDesktopPane())
- .setResponseHandler(0, new Runnable()
+ .setResponseHandler(NO_SPLIT, new Runnable()
{
@Override
public void run()
{
addDataToAlignment(al);
}
- }).setResponseHandler(1, new Runnable()
+ }).setResponseHandler(SPLIT_FRAME, new Runnable()
{
@Override
public void run()
{
- us.openLinkedAlignmentAs(al, title, true);
+ openLinkedAlignmentAs(getAlignPanel().alignFrame,
+ new Alignment(getAlignment()), al,
+ title, SPLIT_FRAME);
}
- }).setResponseHandler(2, new Runnable()
+ }).setResponseHandler(NEW_WINDOW, new Runnable()
{
@Override
public void run()
{
- us.openLinkedAlignmentAs(al, title, false);
+ openLinkedAlignmentAs(null, getAlignment(), al, title,
+ NEW_WINDOW);
}
});
- dialog.showDialog(question,
+ dialog.showDialog(question,
MessageManager.getString("label.open_split_window"),
JvOptionPane.DEFAULT_OPTION, JvOptionPane.PLAIN_MESSAGE, null,
options, options[0]);
}
- protected void openLinkedAlignmentAs(AlignmentI al, String title,
- boolean newWindowOrSplitPane)
- {
+ /**
+ * Open a split frame or a new window
+ *
+ * @param al
+ * @param title
+ * @param mode
+ * SPLIT_FRAME or NEW_WINDOW
+ */
+ public static void openLinkedAlignmentAs(AlignFrame thisFrame, AlignmentI thisAlignment,
+ AlignmentI al, String title,
+ int mode)
+ {
/*
* Identify protein and dna alignments. Make a copy of this one if opening
* in a new split pane.
*/
- AlignmentI thisAlignment = newWindowOrSplitPane
- ? new Alignment(getAlignment())
- : getAlignment();
AlignmentI protein = al.isNucleotide() ? thisAlignment : al;
- final AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
+ AlignmentI cdna = al.isNucleotide() ? al : thisAlignment;
/*
* Map sequences. At least one should get mapped as we have already passed
// alignFrame.setFileName(file, format);
// }
- if (!newWindowOrSplitPane)
+ if (mode == NEW_WINDOW)
{
Desktop.addInternalFrame(newAlignFrame, title,
AlignFrame.DEFAULT_WIDTH, AlignFrame.DEFAULT_HEIGHT);
{
}
- if (newWindowOrSplitPane)
+ if (mode == SPLIT_FRAME)
{
al.alignAs(thisAlignment);
- protein = openSplitFrame(newAlignFrame, thisAlignment);
+ openSplitFrame(thisFrame, newAlignFrame, thisAlignment);
}
}
* cdna/protein complement alignment to show in the other split half
* @return the protein alignment in the split frame
*/
- protected AlignmentI openSplitFrame(AlignFrame newAlignFrame,
+ static protected AlignmentI openSplitFrame(AlignFrame thisFrame,
+ AlignFrame newAlignFrame,
AlignmentI complement)
{
/*
*/
AlignFrame copyMe = new AlignFrame(complement, AlignFrame.DEFAULT_WIDTH,
AlignFrame.DEFAULT_HEIGHT);
- copyMe.setTitle(getAlignPanel().alignFrame.getTitle());
+ copyMe.setTitle(thisFrame.getTitle());
AlignmentI al = newAlignFrame.viewport.getAlignment();
final AlignFrame proteinFrame = al.isNucleotide() ? copyMe
private void setDefaultMinMax()
{
minColour.setBackground(
- Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
+ Cache.getDefaultColour(Preferences.ANNOTATIONCOLOUR_MIN, Color.orange));
maxColour.setBackground(
- Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
+ Cache.getDefaultColour(Preferences.ANNOTATIONCOLOUR_MAX, Color.red));
}
protected void showColourChooser(JPanel colourPanel, String titleKey)
FileFormatI format = new IdentifyFile().identify(file,
DataSourceType.PASTE);
- new FileLoader().LoadFile(file, DataSourceType.PASTE, format);
+ new FileLoader().loadFile(file, DataSourceType.PASTE, format);
}
} catch (Exception ex)
{
Platform.cacheFileData((File) file);
}
- new FileLoader().LoadFile(null, file, protocol, format);
+ new FileLoader().loadFile(null, file, protocol, format);
}
} catch (Exception ex)
}
}
- new FileLoader().LoadFile(viewport, selectedFile,
+ new FileLoader().loadFile(viewport, selectedFile,
DataSourceType.FILE, format);
}
});
{
if (viewport != null)
{
- new FileLoader().LoadFile(viewport, url, DataSourceType.URL,
+ new FileLoader().loadFile(viewport, url, DataSourceType.URL,
FileFormat.Jalview);
}
else
{
- new FileLoader().LoadFile(url, DataSourceType.URL,
+ new FileLoader().loadFile(url, DataSourceType.URL,
FileFormat.Jalview);
}
}
if (viewport != null)
{
- new FileLoader().LoadFile(viewport, url, DataSourceType.URL,
+ new FileLoader().loadFile(viewport, url, DataSourceType.URL,
format);
}
else
{
- new FileLoader().LoadFile(url, DataSourceType.URL, format);
+ new FileLoader().loadFile(url, DataSourceType.URL, format);
}
}
}
@SuppressWarnings("serial")
public class Preferences extends GPreferences
{
+ public static final String ANNOTATIONCOLOUR_MAX = "ANNOTATIONCOLOUR_MAX";
+
+ public static final String ANNOTATIONCOLOUR_MIN = "ANNOTATIONCOLOUR_MIN";
+
public static final String ENABLE_SPLIT_FRAME = "ENABLE_SPLIT_FRAME";
public static final String SCALE_PROTEIN_TO_CDNA = "SCALE_PROTEIN_TO_CDNA";
public static final String CHIMERA_PATH = "CHIMERA_PATH";
+ public static final String SORT_ALIGNMENT = "SORT_ALIGNMENT";
+
+ public static final String WRAP_ALIGNMENT = "WRAP_ALIGNMENT";
+
public static final String SORT_ANNOTATIONS = "SORT_ANNOTATIONS";
+ public static final String SORT_BY_TREE = "SORT_BY_TREE";
+
+ public static final String SHOW_ANNOTATIONS = "SHOW_ANNOTATIONS";
+
public static final String SHOW_AUTOCALC_ABOVE = "SHOW_AUTOCALC_ABOVE";
+ public static final String SHOW_CONSERVATION = "SHOW_CONSERVATION";
+
+ public static final String SHOW_QUALITY = "SHOW_QUALITY";
+
+ public static final String SHOW_CONSENSUS_HISTOGRAM = "SHOW_CONSENSUS_HISTOGRAM";
+
+ public static final String SHOW_CONSENSUS = "SHOW_CONSENSUS";
+
+ public static final String SHOW_CONSENSUS_LOGO = "SHOW_CONSENSUS_LOGO";
+
+ public static final String SHOW_GROUP_CONSENSUS = "SHOW_GROUP_CONSENSUS";
+
+ public static final String SHOW_GROUP_CONSERVATION = "SHOW_GROUP_CONSERVATION";
+
+ public static final String NORMALISE_CONSENSUS_LOGO = "NORMALISE_CONSENSUS_LOGO";
+
+ public static final String NORMALISE_LOGO = "NORMALISE_LOGO";
+
public static final String SHOW_OCCUPANCY = "SHOW_OCCUPANCY";
+ public static final String SHOW_OVERVIEW = "SHOW_OVERVIEW";
+
+ public static final String SHOW_UNCONSERVED = "SHOW_UNCONSERVED";
+
public static final String SHOW_OV_HIDDEN_AT_START = "SHOW_OV_HIDDEN_AT_START";
public static final String USE_LEGACY_GAP = "USE_LEGACY_GAP";
fullScreen.setSelected(Cache.getDefault("SHOW_FULLSCREEN", false));
annotations.setSelected(Cache.getDefault("SHOW_ANNOTATIONS", true));
- conservation.setSelected(Cache.getDefault("SHOW_CONSERVATION", true));
- quality.setSelected(Cache.getDefault("SHOW_QUALITY", true));
+ conservation.setSelected(Cache.getDefault(SHOW_CONSERVATION, true));
+ quality.setSelected(Cache.getDefault(SHOW_QUALITY, true));
identity.setSelected(Cache.getDefault("SHOW_IDENTITY", true));
- openoverv.setSelected(Cache.getDefault("SHOW_OVERVIEW", false));
+ openoverv.setSelected(Cache.getDefault(SHOW_OVERVIEW, false));
showUnconserved
- .setSelected(Cache.getDefault("SHOW_UNCONSERVED", false));
+ .setSelected(Cache.getDefault(SHOW_UNCONSERVED, false));
showOccupancy.setSelected(Cache.getDefault(SHOW_OCCUPANCY, false));
showGroupConsensus
- .setSelected(Cache.getDefault("SHOW_GROUP_CONSENSUS", false));
+ .setSelected(Cache.getDefault(SHOW_GROUP_CONSENSUS, false));
showGroupConservation.setSelected(
- Cache.getDefault("SHOW_GROUP_CONSERVATION", false));
+ Cache.getDefault(SHOW_GROUP_CONSERVATION, false));
showConsensHistogram.setSelected(
- Cache.getDefault("SHOW_CONSENSUS_HISTOGRAM", true));
+ Cache.getDefault(SHOW_CONSENSUS_HISTOGRAM, true));
showConsensLogo
- .setSelected(Cache.getDefault("SHOW_CONSENSUS_LOGO", false));
+ .setSelected(Cache.getDefault(SHOW_CONSENSUS_LOGO, false));
showNpTooltip
.setSelected(Cache.getDefault("SHOW_NPFEATS_TOOLTIP", true));
showDbRefTooltip
sortby.addItem("No sort");
sortby.addItem("Id");
sortby.addItem("Pairwise Identity");
- sortby.setSelectedItem(Cache.getDefault("SORT_ALIGNMENT", "No sort"));
+ sortby.setSelectedItem(Cache.getDefault(SORT_ALIGNMENT, "No sort"));
sortAnnBy.addItem(SequenceAnnotationOrder.NONE.toString());
sortAnnBy
newProp = Cache.getDefault(DEFAULT_COLOUR_NUC, null);
nucColour.setSelectedItem(newProp != null ? newProp : oldProp);
minColour.setBackground(
- Cache.getDefaultColour("ANNOTATIONCOLOUR_MIN", Color.orange));
+ Cache.getDefaultColour(ANNOTATIONCOLOUR_MIN, Color.orange));
maxColour.setBackground(
- Cache.getDefaultColour("ANNOTATIONCOLOUR_MAX", Color.red));
+ Cache.getDefaultColour(ANNOTATIONCOLOUR_MAX, Color.red));
/*
* Set overview panel defaults
autoCalculateConsCheck
.setSelected(Cache.getDefault("AUTO_CALC_CONSENSUS", true));
padGaps.setSelected(Cache.getDefault("PAD_GAPS", false));
- sortByTree.setSelected(Cache.getDefault("SORT_BY_TREE", false));
+ sortByTree.setSelected(Cache.getDefault(SORT_BY_TREE, false));
annotations_actionPerformed(null); // update the display of the annotation
// settings
Boolean.toString(openoverv.isSelected()));
Cache.setPropertyNoSave("SHOW_ANNOTATIONS",
Boolean.toString(annotations.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSERVATION",
+ Cache.setPropertyNoSave(SHOW_CONSERVATION,
Boolean.toString(conservation.isSelected()));
- Cache.setPropertyNoSave("SHOW_QUALITY",
+ Cache.setPropertyNoSave(SHOW_QUALITY,
Boolean.toString(quality.isSelected()));
Cache.setPropertyNoSave("SHOW_IDENTITY",
Boolean.toString(identity.isSelected()));
Boolean.toString(showUnconserved.isSelected()));
Cache.setPropertyNoSave(SHOW_OCCUPANCY,
Boolean.toString(showOccupancy.isSelected()));
- Cache.setPropertyNoSave("SHOW_GROUP_CONSENSUS",
+ Cache.setPropertyNoSave(SHOW_GROUP_CONSENSUS,
Boolean.toString(showGroupConsensus.isSelected()));
- Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION",
+ Cache.setPropertyNoSave(SHOW_GROUP_CONSERVATION,
Boolean.toString(showGroupConservation.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSENSUS_HISTOGRAM",
+ Cache.setPropertyNoSave(SHOW_CONSENSUS_HISTOGRAM,
Boolean.toString(showConsensHistogram.isSelected()));
- Cache.setPropertyNoSave("SHOW_CONSENSUS_LOGO",
+ Cache.setPropertyNoSave(SHOW_CONSENSUS_LOGO,
Boolean.toString(showConsensLogo.isSelected()));
Cache.setPropertyNoSave("ANTI_ALIAS",
Boolean.toString(smoothFont.isSelected()));
Cache.setPropertyNoSave("SHOW_STARTUP_FILE",
Boolean.toString(startupCheckbox.isSelected()));
- Cache.setPropertyNoSave("SORT_ALIGNMENT",
+ Cache.setPropertyNoSave(SORT_ALIGNMENT,
sortby.getSelectedItem().toString());
// convert description of sort order to enum name for save
protColour.getSelectedItem().toString());
Cache.setPropertyNoSave(DEFAULT_COLOUR_NUC,
nucColour.getSelectedItem().toString());
- Cache.setColourProperty("ANNOTATIONCOLOUR_MIN",
+ Cache.setColourProperty(ANNOTATIONCOLOUR_MIN,
minColour.getBackground());
- Cache.setColourProperty("ANNOTATIONCOLOUR_MAX",
+ Cache.setColourProperty(ANNOTATIONCOLOUR_MAX,
maxColour.getBackground());
/*
// showSequenceLogo true of false (default is false) When true, shows a
// sequence logo above the consensus sequence (overlaid above the Consensus
- Cache.setPropertyNoSave("SHOW_CONSERVATION", "true");
- Cache.setPropertyNoSave("SHOW_QUALITY", "false");
- Cache.setPropertyNoSave("SHOW_CONCENSUS", "true");
+ Cache.setPropertyNoSave(SHOW_CONSERVATION, "true");
+ Cache.setPropertyNoSave(SHOW_QUALITY, "false");
+ Cache.setPropertyNoSave(SHOW_CONSENSUS, "true");
Cache.setPropertyNoSave("SHOW_UNCONSERVED", "false");
Cache.setPropertyNoSave("SHOW_GROUP_CONSERVATION", "false");
Cache.setPropertyNoSave("SHOW_GROUP_CONCENSUS", "false");
public class FileLoader implements Runnable
{
+ private File selectedFile;
+
String file;
DataSourceType protocol;
FileFormatI format;
- AlignmentFileReaderI source = null; // alternative specification of where data
- // comes
+ AlignmentFileReaderI source; // alternative specification of where data
+ // comes from
- // from
+ /**
+ * It is critical that all these fields are set, as this instance is reused.
+ *
+ * @param source
+ * @param file
+ * @param inFile
+ * @param dataSourceType
+ * @param format
+ */
+ private void setFileFields(AlignmentFileReaderI source, File file,
+ String inFile, DataSourceType dataSourceType, FileFormatI format)
+ {
+ this.source = source;
+ this.file = inFile;
+ this.selectedFile = file;
+ this.protocol = dataSourceType;
+ this.format = format;
+ }
AlignViewport viewport;
boolean raiseGUI = true;
- private File selectedFile;
-
/**
* default constructor always raised errors in GUI dialog boxes
*/
this.raiseGUI = raiseGUI;
}
- public void LoadFile(AlignViewport viewport, Object file,
+ public void loadFile(AlignViewport viewport, Object file,
DataSourceType protocol, FileFormatI format)
{
this.viewport = viewport;
this.selectedFile = (File) file;
file = selectedFile.getPath();
}
- LoadFile(file.toString(), protocol, format);
+ loadFile(file.toString(), protocol, format);
}
- public void LoadFile(String file, DataSourceType protocol,
+ public void loadFile(String file, DataSourceType protocol,
FileFormatI format)
{
this.file = file;
*/
public void LoadFile(String file, DataSourceType protocol)
{
- LoadFile(file, protocol, null);
+ loadFile(file, protocol, null);
}
/**
public AlignFrame LoadFileWaitTillLoaded(String file,
DataSourceType sourceType)
{
- return LoadFileWaitTillLoaded(file, sourceType, null);
+ return loadFileWaitTillLoaded(file, sourceType, null);
}
/**
* @param format
* @return alignFrame constructed from file contents
*/
- public AlignFrame LoadFileWaitTillLoaded(String file,
+ public AlignFrame loadFileWaitTillLoaded(String file,
DataSourceType sourceType, FileFormatI format)
{
- this.file = file;
- this.protocol = sourceType;
- this.format = format;
- return _LoadFileWaitTillLoaded();
+ setFileFields(null, null, file, sourceType, format);
+ return _loadFileWaitTillLoaded();
}
/**
* @param format
* @return alignFrame constructed from file contents
*/
- public AlignFrame LoadFileWaitTillLoaded(File file,
+ public AlignFrame loadFileWaitTillLoaded(File file,
DataSourceType sourceType, FileFormatI format)
{
- this.selectedFile = file;
- this.file = file.getPath();
- this.protocol = sourceType;
- this.format = format;
- return _LoadFileWaitTillLoaded();
+ setFileFields(null, file, null, sourceType, format);
+ return _loadFileWaitTillLoaded();
}
/**
* @param format
* @return alignFrame constructed from file contents
*/
- public AlignFrame LoadFileWaitTillLoaded(AlignmentFileReaderI source,
+ public AlignFrame loadFileWaitTillLoaded(AlignmentFileReaderI source,
FileFormatI format)
{
- this.source = source;
-
- file = source.getInFile();
- protocol = source.getDataSourceType();
- this.format = format;
- return _LoadFileWaitTillLoaded();
+ setFileFields(source, null, source.getInFile(),
+ source.getDataSourceType(), format);
+ return _loadFileWaitTillLoaded();
}
/**
*
* @return
*/
- protected AlignFrame _LoadFileWaitTillLoaded()
+ private AlignFrame _loadFileWaitTillLoaded()
{
this.run();
return alignFrame;
final String _inFile = "examples/3W5V.pdb";
inFile = _inFile;
FileLoader fl = new FileLoader();
- fl.LoadFile(af.getCurrentView(), _inFile, DataSourceType.FILE,
+ fl.loadFile(af.getCurrentView(), _inFile, DataSourceType.FILE,
FileFormat.PDB);
try
{
{
String urlFile = "http://www.jalview.org/builds/develop/examples/3W5V.pdb";
FileLoader fileLoader = new FileLoader();
- fileLoader.LoadFileWaitTillLoaded(urlFile, DataSourceType.URL,
+ fileLoader.loadFileWaitTillLoaded(urlFile, DataSourceType.URL,
FileFormat.PDB);
Assert.assertNotNull(fileLoader.file);
// The FileLoader's file is expected to be same as the original URL.
public void mapFer1From3W5V() throws Exception
{
AlignFrame seqf = new FileLoader(false)
- .LoadFileWaitTillLoaded(
+ .loadFileWaitTillLoaded(
">FER1_MAIZE/1-150 Ferredoxin-1, chloroplast precursor\nMATVLGSPRAPAFFFSSSSLRAAPAPTAVALPAAKVGIMGRSASSRRRLRAQATYNVKLITPEGEVELQVPD\nDVYILDQAEEDGIDLPYSCRAGSCSSCAGKVVSGSVDQSDQSYLDDGQIADGWVLTCHAYPTSDVVIETHKE\nEELTGA",
DataSourceType.PASTE, FileFormat.Fasta);
SequenceI newseq = seqf.getViewport().getAlignment().getSequenceAt(0);