import java.util.HashMap;
import java.util.Map;
+import java.util.Vector;
/**
* Collection of all known applet tags from JalviewLite
put("_code", code);
}
+ public AppletParams()
+ {
+ // TODO Auto-generated constructor stub
+ }
+
+ public static AppletParams getAppletParams(String[] args,
+ Vector<String> vargs)
+ {
+ AppletParams appletParams = new AppletParams();
+ String resourcePath = null;
+ for (int i = args.length; --i > 0;) // > 0 is correct, not >=0
+ {
+ if (args[i].startsWith("name=\"Info.resourcePath\""))
+ {
+ resourcePath = getAttr(args[i], "value");
+ if (resourcePath.length() > 0 && !resourcePath.endsWith("/"))
+ {
+ resourcePath += "/";
+ }
+ break;
+ }
+ }
+ for (int i = 1; i < args.length; i++)
+ {
+ String arg = args[i].trim();
+ if (arg.startsWith("name="))
+ {
+ String key = getAttr(arg, "name");
+ String value = getAttr(arg, "value");
+ String name = key;
+ switch (name)
+ {
+ case "alignpdbfiles":
+ break;
+ case "annotationcolour_max":
+ name = "ANNOTATIONCOLOUR_MAX";
+ break;
+ case "annotationcolour_min":
+ name = "ANNOTATIONCOLOUR_MIN";
+ break;
+ case "annotations":
+ value = checkTF(value);
+ break;
+ case "application_url":
+ name = "APPLICATION_URL";
+ break;
+ case "automaticscrolling":
+ name = "automaticScrolling";
+ break;
+ case "centrecolumnlabels":
+ break;
+ case "defaultcolour":
+ name = "defaultColour";
+ break;
+ case "defaultcolournuc":
+ name = "defaultColourNuc";
+ break;
+ case "defaultcolourprot":
+ name = "defaultColourProt";
+ break;
+ case "enablesplitframe":
+ name = "enableSplitFrame";
+ break;
+ case "externalstructureviewer":
+ break;
+ case "features":
+ value = resourcePath + value;
+ break;
+ case "format":
+ break;
+ case "heightscale":
+ name = "heightScale";
+ break;
+ case "hidefeaturegroups":
+ break;
+ case "jalviewhelpurl":
+ break;
+ case "jnetfile":
+ value = resourcePath + value;
+ break;
+ case "jpredfile":
+ value = resourcePath + value;
+ break;
+ case "label":
+ break;
+ case "linklabel_":
+ name = "linkLabel_";
+ break;
+ case "linklabel_1":
+ name = "linkLabel_1";
+ break;
+ case "linkurl_":
+ name = "linkURL_";
+ break;
+ case "nojmol":
+ break;
+ case "normaliselogo":
+ name = "normaliseLogo";
+ break;
+ case "normalisesequencelogo":
+ name = "normaliseSequenceLogo";
+ break;
+ case "oninit":
+ break;
+ case "pdbfile":
+ name = "PDBFILE";
+ break;
+ case "pdbseq":
+ name = "PDBSEQ";
+ break;
+ case "relaxedidmatch":
+ break;
+ case "resolvetocodebase":
+ break;
+ case "rgb":
+ name = "RGB";
+ break;
+ case "scaleproteinascdna":
+ name = "scaleProteinAsCdna";
+ break;
+ case "scorefile":
+ name = "scoreFile";
+ value = resourcePath + value;
+ break;
+ case "separator":
+ break;
+ case "sequence":
+ break;
+ case "sortby":
+ name = "sortBy";
+ break;
+ case "sortbytree":
+ value = checkTF(value);
+ key = null; // taken care of by Jalview
+ break;
+ case "tree":
+ case "treefile":
+ name = "tree";
+ value = resourcePath + value;
+ key = null; // taken care of by Jalview
+ break;
+ case "uppercase":
+ name = "upperCase";
+ break;
+ case "userdefinedcolour":
+ name = "userDefinedColour";
+ break;
+ case "widthscale":
+ name = "widthScale";
+ break;
+ case "windowheight":
+ name = "windowHeight";
+ break;
+ case "windowwidth":
+ name = "windowWidth";
+ break;
+ case "wrap":
+ break;
+
+ // cases not handled in doc/parameters.xlsx
+ case "debug":
+ value = checkTF(value);
+ break;
+ case "file":
+ name = "open";
+ value = resourcePath + value;
+ break;
+ case "file2":
+ value = resourcePath + value;
+ break;
+ case "embedded":
+ value = checkTF(value);
+ break;
+ case "showannotation":
+ name = "SHOW_ANNOTATIONS";
+ value = checkTF(value);
+ break;
+ case "showbutton":
+ value = checkTF(value);
+ break;
+ case "showconsensus":
+ name = "SHOW_CONSENSUS_LOGO";
+ value = checkTF(value);
+ break;
+ case "showconsensushistogram":
+ name = "SHOW_CONSENSUS_HISTOGRAM";
+ value = checkTF(value);
+ break;
+ case "showconservation":
+ name = "SHOW_CONSERVATION";
+ value = checkTF(value);
+ break;
+ case "showfeaturegroups":
+ value = checkTF(value);
+ break;
+ case "showfeaturesettings":
+ name = "showFeatureSettings";
+ value = checkTF(value);
+ break;
+ case "showfullid":
+ name = "showFullId";
+ value = checkTF(value);
+ break;
+ case "showgroupconsensus":
+ name = "SHOW_GROUP_CONSENSUS";
+ value = checkTF(value);
+ break;
+ case "showgroupconservation":
+ name = "SHOW_GROUP_CONSERVATION";
+ value = checkTF(value);
+ break;
+ case "showoccupancy":
+ name = "SHOW_OCCUPANCY";
+ value = checkTF(value);
+ break;
+ case "showquality":
+ name = "SHOW_QUALITY";
+ value = checkTF(value);
+ break;
+ case "showsequencelogo":
+ name = "showSequenceLogo";
+ value = checkTF(value);
+ break;
+ case "showtreebootstraps":
+ name = "showTreeBootstraps";
+ value = checkTF(value);
+ break;
+ case "showtreedistances":
+ name = "showTreeDistances";
+ value = checkTF(value);
+ break;
+ case "showunconserved":
+ name = "showUnconserved";
+ value = checkTF(value);
+ break;
+ case "showunlinkedtreenodes":
+ name = "showUnlinkedTreeNodes";
+ value = checkTF(value);
+ break;
+ default:
+ break;
+ }
+ if (value != null)
+ {
+ vargs.add(name);
+ if (value != "true")
+ {
+ vargs.add(value);
+ }
+ }
+ if (value == null)
+ {
+ value = "false";
+ }
+ System.out.println("AppletParams name=" + name + " value=" + value);
+ Cache.setPropertyNoSave(name, value);
+ if (key != null)
+ {
+ appletParams.put(key, value);
+ }
+ }
+ }
+ return appletParams;
+ }
+
+ /**
+ * Check for a single-argument option.
+ *
+ * @param value
+ * @return "true" or null
+ */
+ private static String checkTF(String value)
+ {
+ return (value.toLowerCase() == "true" ? "true" : null);
+ }
+
/**
* Crude applet innerHTML parser
*
* @param attr
* @return
*/
- private String getAttr(String tag, String attr)
+ private static String getAttr(String tag, String attr)
{
int pt = tag.indexOf(attr + "=\"");
if (pt < 0)