String arg = args[i].trim();
if (arg.startsWith("name="))
{
- String appName = getAttr(arg, "name");
+ String prefName = getAttr(arg, "name");
+ String appletName = prefName.toLowerCase();
+ String argName = prefName;
String value = getAttr(arg, "value");
- String appletName = appName.toLowerCase();
// note that Application arguments ARE case-sensitive, but
// Applet.getParameter() is not.
switch (appletName)
{
- // tested, working:
-
case "file":
- appName = "open";
- value = resourcePath + value;
+ argName = "open";
appletName = null;
+ value = resourcePath + value;
break;
case "file2":
+ argName = "open2";
+ prefName = null;
value = resourcePath + value;
- appName = null;
break;
+ case "features":
case "jnetfile":
- value = resourcePath + value;
- appName = null;
- break;
case "jpredfile":
- value = resourcePath + value;
- appName = null;
- break;
- case "features":
- value = resourcePath + value;
- appName = null;
- break;
case "pdbfile":
+ case "scorefile":
+ case "sequence":
+ // setting argName to null indicates that we want
+ // JalviewAppLoader to take care of this.
+ prefName = argName = null;
value = resourcePath + value;
- appName = null;
break;
case "tree":
case "treefile":
- appName = "tree";
+ // setting appletName to null indicates that we want
+ // Jalview.doMain to taken care of this as Jalview args
+ argName = "tree";
+ appletName = null;
value = resourcePath + value;
- appletName = null; // taken care of by Jalview
break;
+
+ // non-loading preferences
+
case "defaultcolour":
- appName = Preferences.DEFAULT_COLOUR;
+ prefName = Preferences.DEFAULT_COLOUR;
break;
case "defaultcolournuc":
- appName = Preferences.DEFAULT_COLOUR_NUC;
+ prefName = Preferences.DEFAULT_COLOUR_NUC;
break;
case "defaultcolourprot":
- appName = Preferences.DEFAULT_COLOUR_PROT;
+ prefName = Preferences.DEFAULT_COLOUR_PROT;
+ break;
+ case "annotationcolour_max":
+ prefName = Preferences.ANNOTATIONCOLOUR_MAX;
+ break;
+ case "annotationcolour_min":
+ prefName = Preferences.ANNOTATIONCOLOUR_MIN;
+ break;
+ case "enablesplitframe":
+ prefName = Preferences.ENABLE_SPLIT_FRAME;
+ break;
+ case "centrecolumnlabels":
+ prefName = Preferences.CENTRE_COLUMN_LABELS;
+ break;
+ case "sortby":
+ prefName = Preferences.SORT_ALIGNMENT; // id, etc.
+ break;
+ case "normalisesequencelogo":
+ prefName = Preferences.NORMALISE_CONSENSUS_LOGO;
+ break;
+ case "relaxedidmatch":
+ prefName = Preferences.RELAXEDSEQIDMATCHING;
+ break;
+ case "scaleproteinascdna":
+ prefName = Preferences.SCALE_PROTEIN_TO_CDNA;
+ break;
+ case "userdefinedcolour":
+ argName = "colour";
+ prefName = Preferences.USER_DEFINED_COLOURS;
+ break;
+ case "wrap":
+ prefName = Preferences.WRAP_ALIGNMENT;
break;
// implemented; not tested:
case "oninit":
- appName = null;
+ prefName = null;
break;
case "annotations":
value = resourcePath + value;
- appName = null;
- break;
- case "annotationcolour_max":
- appName = Preferences.ANNOTATIONCOLOUR_MAX;
- break;
- case "annotationcolour_min":
- appName = Preferences.ANNOTATIONCOLOUR_MIN;
- break;
- case "enablesplitframe":
- appName = Preferences.ENABLE_SPLIT_FRAME;
+ argName = null;
break;
case "hidefeaturegroups":
- break;
- case "centrecolumnlabels":
- appName = null;
+ // TODO
break;
case "pdbseq":
- appName = null;
- break;
- case "sortby":
- appName = Preferences.SORT_ALIGNMENT; // id, etc.
+ argName = prefName = null;
break;
case "sortbytree":
- appName = Preferences.SORT_BY_TREE;
+ prefName = Preferences.SORT_BY_TREE;
value = checkTF(value);
appletName = null; // taken care of by Jalview
break;
case "format":
break;
+ case "alignpdbfiles":
+ argName = prefName = null;
+ break;
+ case "separator":
+ break;
- // probably not relevant:
+ // TODO: probably not relevant?
- case "externalstructureviewer":
+ case "rgb":
+ prefName = null; // TODO no background for application?
break;
- case "alignpdbfiles":
+ case "externalstructureviewer":
break;
case "application_url":
- appName = "APPLICATION_URL";
break;
case "automaticscrolling":
- appName = "automaticScrolling";
break;
case "heightscale":
- appName = "heightScale";
break;
case "jalviewhelpurl":
break;
case "label":
break;
case "linklabel_":
- appName = "linkLabel_";
+ prefName = "linkLabel_";
break;
case "linklabel_1":
- appName = "linkLabel_1";
+ prefName = "linkLabel_1";
break;
case "linkurl_":
- appName = "linkURL_";
- break;
- case "rgb":
- appName = null; // no background for application
+ prefName = "linkURL_";
break;
// unknown:
case "nojmol":
- break;
case "normaliselogo":
- appName = Preferences.NORMALISE_LOGO;
- break;
- case "normalisesequencelogo":
- appName = Preferences.NORMALISE_CONSENSUS_LOGO;
- break;
- case "relaxedidmatch":
- break;
case "resolvetocodebase":
- break;
- case "scaleproteinascdna":
- appName = "scaleProteinAsCdna";
- break;
- case "separator":
- break;
- case "sequence":
- break;
case "uppercase":
- appName = "upperCase";
- break;
- case "userdefinedcolour":
- appName = "colour";
- break;
case "widthscale":
- appName = "widthScale";
- break;
case "windowheight":
- appName = "windowHeight";
- break;
case "windowwidth":
- appName = "windowWidth";
- break;
- case "wrap":
- appName = Preferences.WRAP_ALIGNMENT;
- break;
- case "scorefile":
- appName = "scoreFile";
- value = resourcePath + value;
+ argName = prefName = null;
break;
// TRUE/FALSE
value = checkTF(value);
break;
case "showannotation":
- appName = Preferences.SHOW_ANNOTATIONS;
+ prefName = Preferences.SHOW_ANNOTATIONS;
value = checkTF(value);
break;
case "showconsensus":
- appName = Preferences.SHOW_CONSENSUS_LOGO;
+ prefName = Preferences.SHOW_CONSENSUS_LOGO;
value = checkTF(value);
break;
case "showconsensushistogram":
- appName = Preferences.SHOW_CONSENSUS_HISTOGRAM;
+ prefName = Preferences.SHOW_CONSENSUS_HISTOGRAM;
value = checkTF(value);
break;
case "showconservation":
- appName = Preferences.SHOW_CONSERVATION;
+ prefName = Preferences.SHOW_CONSERVATION;
value = checkTF(value);
break;
case "showgroupconsensus":
- appName = Preferences.SHOW_GROUP_CONSENSUS;
+ prefName = Preferences.SHOW_GROUP_CONSENSUS;
value = checkTF(value);
break;
case "showgroupconservation":
- appName = Preferences.SHOW_GROUP_CONSERVATION;
+ prefName = Preferences.SHOW_GROUP_CONSERVATION;
value = checkTF(value);
break;
case "showoccupancy":
- appName = Preferences.SHOW_OCCUPANCY;
+ prefName = Preferences.SHOW_OCCUPANCY;
value = checkTF(value);
break;
case "showquality":
- appName = Preferences.SHOW_QUALITY;
+ prefName = Preferences.SHOW_QUALITY;
value = checkTF(value);
break;
case "showsequencelogo":
- appName = Preferences.SHOW_CONSENSUS_LOGO;
+ prefName = Preferences.SHOW_CONSENSUS_LOGO;
value = checkTF(value);
break;
case "showfeaturegroups":
value = checkTF(value);
break;
case "showfeaturesettings":
- appName = "showFeatureSettings";
value = checkTF(value);
break;
case "showfullid":
- appName = "showFullId";
value = checkTF(value);
break;
case "showtreebootstraps":
- appName = "showTreeBootstraps";
value = checkTF(value);
break;
case "showtreedistances":
- appName = "showTreeDistances";
value = checkTF(value);
break;
case "showunconserved":
- appName = Preferences.SHOW_UNCONSERVED;
+ prefName = Preferences.SHOW_UNCONSERVED;
value = checkTF(value);
break;
case "showunlinkedtreenodes":
- appName = "showUnlinkedTreeNodes";
value = checkTF(value);
break;
default:
- // could be pdbFile2, for example
+ if (appletName.startsWith("pdbfile")
+ || appletName.startsWith("sequence") && Character.isDigit(
+ appletName.charAt(appletName.length() - 1)))
+ {
+ // could be pdbFile2, for example
+ prefName = argName = null;
+ value = resourcePath + value;
+ break;
+ }
// or one of the app preference names
break;
}
- if (value != null)
+ // put name and value into application args
+ if (value != null && argName != null)
{
- vargs.add(appName);
+ vargs.add(argName);
if (value != "true")
{
vargs.add(value);
{
value = "false";
}
- System.out.println("AppletParams appName=" + appName + "appletName="
+ System.out.println("AppletParams propName=" + prefName + " argName="
+ + argName + " appletName="
+ appletName + " value=" + value);
- Cache.setPropertyNoSave(appName, value);
if (appletName != null)
{
appletParams.put(appletName, value);
}
+ if (prefName != null)
+ {
+ Cache.setPropertyNoSave(prefName, value);
+ }
}
}
return appletParams;
}
}
-
// script to execute after all loading is
// completed one way or another
// extract groovy argument and execute if necessary
String groovyscript = (isJS ? null
: aparser.getValue(ArgsParser.GROOVY, true));
String file = aparser.getValue(ArgsParser.OPEN, true);
- String file2 = (isJavaAppletTag ? aparser.getAppletValue("file2", null)
- : null);
+ // BH this here to allow split frame; not working as of 5/17/2019
+ String file2 = aparser.getValue(ArgsParser.OPEN2, true);
String fileFormat = (isJavaAppletTag
? aparser.getAppletValue("format", null)
: null);
+
FileFormatI format = null;
DataSourceType protocol = null;
boolean haveImport = checkStartVamas(aparser);
// Finally, deal with the remaining input data.
long progress = -1;
+ if (file == null && isJavaAppletTag)
+ {
+ // Maybe the sequences are added as parameters
+ StringBuffer data = new StringBuffer("PASTE");
+ int i = 1;
+ while ((file = aparser.getAppletValue("sequence" + i, null)) != null)
+ {
+ data.append(file.toString() + "\n");
+ i++;
+ }
+ if (data.length() > 5)
+ {
+ file = data.toString();
+ }
+ }
+
if (file != null)
{
if (!headless)
}
AlignFrame af = new FileLoader(!headless).loadFileWaitTillLoaded(file,
- protocol,
- format);
+ protocol, format);
if (af == null)
{
System.out.println("error");
{
// TODO ?
}
- AlignFrame af2 = new FileLoader(!headless).loadFileWaitTillLoaded(
- file2,
- protocol, format);
+ AlignFrame af2 = new FileLoader(!headless)
+ .loadFileWaitTillLoaded(file2, protocol, format);
if (af2 == null)
{
System.out.println("error");
af.getViewport().getAlignment(),
af2.getViewport().getAlignment(), "",
AlignViewport.SPLIT_FRAME);
+ System.out.println(
+ "CMD [-open2 " + file2 + "] executed successfully!");
}
}
}
startUpAlframe = new FileLoader(!headless)
- .loadFileWaitTillLoaded(file, protocol,
- format);
+ .loadFileWaitTillLoaded(file, protocol, format);
// extract groovy arguments before anything else.
}
if (file == null)
{
- // Maybe the sequences are added as parameters
- StringBuffer data = new StringBuffer("PASTE");
- int i = 1;
- while ((file = getParameter("sequence" + i)) != null)
- {
- data.append(file.toString() + "\n");
- i++;
- }
- if (data.length() > 5)
- {
- file = data.toString();
- }
+ file = appLoader.getPastedSequence(this);
}
if (getDefaultParameter("enableSplitFrame", true))
{
file2 = getParameter("file2");
}
- embedded = TRUE.equalsIgnoreCase(getParameter("embedded"));
+ embedded = (TRUE.equalsIgnoreCase(getParameter("embedded"))
+ || file != null
+ && FALSE.equalsIgnoreCase(getParameter("showbutton")));
if (embedded)
{
- LoadingThread loader = new LoadingThread(file, file2, this);
- loader.start();
- }
- else if (file != null)
- {
- /*
- * Start the applet immediately or show a button to start it
- */
- if (FALSE.equalsIgnoreCase(getParameter("showbutton")))
- {
- LoadingThread loader = new LoadingThread(file, file2, this);
- loader.start();
- }
- else
- {
- add(launcher);
- launcher.addActionListener(new java.awt.event.ActionListener()
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- LoadingThread loader = new LoadingThread(file, file2,
- JalviewLite.this);
- loader.start();
- }
- });
- }
+ startLoading();
}
- else
+ else if (file == null)
{
// jalview initialisation with no alignment. loadAlignment() method can
// still be called to open new alignments.
fileFound = false;
callInitCallback();
}
+ else
+ {
+ add(launcher);
+ launcher.addActionListener(new java.awt.event.ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ startLoading();
+ }
+ });
+ }
+ }
+
+ protected void startLoading()
+ {
+ LoadingThread loader = new LoadingThread(file, file2, this);
+ loader.start();
}
private void initLiveConnect()