From 1901363236478f0d50feda5a2f5835036ff04615 Mon Sep 17 00:00:00 2001 From: hansonr Date: Thu, 16 May 2019 10:56:32 -0500 Subject: [PATCH] Jalview-JS/JAL-3253 applet param GROUPS --- src/jalview/bin/AppletParams.java | 167 ++++++++++++++++++++----------------- src/jalview/gui/AlignFrame.java | 27 ++++++ 2 files changed, 117 insertions(+), 77 deletions(-) diff --git a/src/jalview/bin/AppletParams.java b/src/jalview/bin/AppletParams.java index 0ccbdc5..290ae01 100644 --- a/src/jalview/bin/AppletParams.java +++ b/src/jalview/bin/AppletParams.java @@ -125,134 +125,146 @@ public class AppletParams extends HashMap String arg = args[i].trim(); if (arg.startsWith("name=")) { - String key = getAttr(arg, "name"); + String appName = getAttr(arg, "name"); String value = getAttr(arg, "value"); - String name = key; - switch (name.toLowerCase()) + String appletName = appName.toLowerCase(); + + // note that Application arguments ARE case-sensitive, but + // Applet.getParameter() is not. + + switch (appletName) { - case "alignpdbfiles": - break; - case "annotationcolour_max": - name = "ANNOTATIONCOLOUR_MAX"; + // tested, working: + case "jnetfile": + value = resourcePath + value; + appName = null; break; - case "annotationcolour_min": - name = "ANNOTATIONCOLOUR_MIN"; + case "jpredfile": + value = resourcePath + value; + appName = null; break; - case "annotations": - value = checkTF(value); + case "features": + value = resourcePath + value; + appName = null; break; - case "application_url": - name = "APPLICATION_URL"; + case "pdbfile": + appName = "PDBFILE"; + value = resourcePath + value; + appName = null; break; - case "automaticscrolling": - name = "automaticScrolling"; + case "tree": + case "treefile": + appName = "tree"; + value = resourcePath + value; + appletName = null; // taken care of by Jalview break; - case "centrecolumnlabels": + // implemented; not tested: + case "annotations": + value = resourcePath + value; + appName = null; break; case "defaultcolour": - name = "DEFAULT_COLOUR"; // defaultColour + appName = "DEFAULT_COLOUR"; // defaultColour break; case "defaultcolournuc": - name = "DEFAULT_COLOUR_NUC";// defaultColourNuc + appName = "DEFAULT_COLOUR_NUC";// defaultColourNuc break; case "defaultcolourprot": - name = "DEFAULT_COLOUR_PROT";// defaultColourProt"; + appName = "DEFAULT_COLOUR_PROT";// defaultColourProt"; + break; + case "annotationcolour_max": + appName = "ANNOTATIONCOLOUR_MAX"; + break; + case "annotationcolour_min": + appName = "ANNOTATIONCOLOUR_MIN"; + break; + case "centrecolumnlabels": + appName = null; break; case "enablesplitframe": - name = "enableSplitFrame"; + appName = "enableSplitFrame"; break; case "externalstructureviewer": break; - case "features": - value = resourcePath + value; + case "alignpdbfiles": break; - case "format": + case "application_url": + appName = "APPLICATION_URL"; + break; + case "automaticscrolling": + appName = "automaticScrolling"; break; case "heightscale": - name = "heightScale"; + appName = "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_"; + appName = "linkLabel_"; break; case "linklabel_1": - name = "linkLabel_1"; + appName = "linkLabel_1"; break; case "linkurl_": - name = "linkURL_"; + appName = "linkURL_"; break; case "nojmol": break; case "normaliselogo": - name = "normaliseLogo"; + appName = "normaliseLogo"; break; case "normalisesequencelogo": - name = "normaliseSequenceLogo"; + appName = "normaliseSequenceLogo"; break; case "oninit": break; - case "pdbfile": - name = "PDBFILE"; - break; case "pdbseq": - name = "PDBSEQ"; + appName = "PDBSEQ"; break; case "relaxedidmatch": break; case "resolvetocodebase": break; case "rgb": - name = "RGB"; + appName = "RGB"; break; case "scaleproteinascdna": - name = "scaleProteinAsCdna"; - break; - case "scorefile": - name = "scoreFile"; - value = resourcePath + value; + appName = "scaleProteinAsCdna"; break; case "separator": break; case "sequence": break; case "sortby": - name = "sortBy"; break; case "sortbytree": value = checkTF(value); - key = null; // taken care of by Jalview + appletName = null; // taken care of by Jalview break; - case "tree": - case "treefile": - name = "tree"; + case "format": + break; + case "scorefile": + appName = "scoreFile"; value = resourcePath + value; - key = null; // taken care of by Jalview break; case "uppercase": - name = "upperCase"; + appName = "upperCase"; break; case "userdefinedcolour": - name = "colour"; + appName = "colour"; break; case "widthscale": - name = "widthScale"; + appName = "widthScale"; break; case "windowheight": - name = "windowHeight"; + appName = "windowHeight"; break; case "windowwidth": - name = "windowWidth"; + appName = "windowWidth"; break; case "wrap": break; @@ -262,7 +274,7 @@ public class AppletParams extends HashMap value = checkTF(value); break; case "file": - name = "open"; + appName = "open"; value = resourcePath + value; break; case "file2": @@ -272,69 +284,69 @@ public class AppletParams extends HashMap value = checkTF(value); break; case "showannotation": - name = "SHOW_ANNOTATIONS"; + appName = "SHOW_ANNOTATIONS"; value = checkTF(value); break; case "showbutton": value = checkTF(value); break; case "showconsensus": - name = "SHOW_CONSENSUS_LOGO"; + appName = "SHOW_CONSENSUS_LOGO"; value = checkTF(value); break; case "showconsensushistogram": - name = "SHOW_CONSENSUS_HISTOGRAM"; + appName = "SHOW_CONSENSUS_HISTOGRAM"; value = checkTF(value); break; case "showconservation": - name = "SHOW_CONSERVATION"; + appName = "SHOW_CONSERVATION"; value = checkTF(value); break; case "showfeaturegroups": value = checkTF(value); break; case "showfeaturesettings": - name = "showFeatureSettings"; + appName = "showFeatureSettings"; value = checkTF(value); break; case "showfullid": - name = "showFullId"; + appName = "showFullId"; value = checkTF(value); break; case "showgroupconsensus": - name = "SHOW_GROUP_CONSENSUS"; + appName = "SHOW_GROUP_CONSENSUS"; value = checkTF(value); break; case "showgroupconservation": - name = "SHOW_GROUP_CONSERVATION"; + appName = "SHOW_GROUP_CONSERVATION"; value = checkTF(value); break; case "showoccupancy": - name = "SHOW_OCCUPANCY"; + appName = "SHOW_OCCUPANCY"; value = checkTF(value); break; case "showquality": - name = "SHOW_QUALITY"; + appName = "SHOW_QUALITY"; value = checkTF(value); break; case "showsequencelogo": - name = "showSequenceLogo"; + appName = "showSequenceLogo"; value = checkTF(value); break; case "showtreebootstraps": - name = "showTreeBootstraps"; + appName = "showTreeBootstraps"; value = checkTF(value); break; case "showtreedistances": - name = "showTreeDistances"; + appName = "showTreeDistances"; value = checkTF(value); break; case "showunconserved": - name = "showUnconserved"; + appName = "showUnconserved"; value = checkTF(value); break; case "showunlinkedtreenodes": - name = "showUnlinkedTreeNodes"; + appName = "showUnlinkedTreeNodes"; value = checkTF(value); break; default: @@ -342,7 +354,7 @@ public class AppletParams extends HashMap } if (value != null) { - vargs.add(name); + vargs.add(appName); if (value != "true") { vargs.add(value); @@ -352,11 +364,12 @@ public class AppletParams extends HashMap { value = "false"; } - System.out.println("AppletParams name=" + name + " value=" + value); - Cache.setPropertyNoSave(name, value); - if (key != null) + System.out.println("AppletParams appName=" + appName + "appletName=" + + appletName + " value=" + value); + Cache.setPropertyNoSave(appName, value); + if (appletName != null) { - appletParams.put(key, value); + appletParams.put(appletName, value); } } } diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java index f2b790d..ecd9155 100644 --- a/src/jalview/gui/AlignFrame.java +++ b/src/jalview/gui/AlignFrame.java @@ -4928,6 +4928,32 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener, } /** + * Change the display state for the given feature groups -- Added by BH from + * JalviewLite + * + * @param groups + * list of group strings + * @param state + * visible or invisible + */ + public void setFeatureGroupState(String[] groups, boolean state) + { + jalview.api.FeatureRenderer fr = null; + viewport.setShowSequenceFeatures(true); + if (alignPanel != null + && (fr = alignPanel.getFeatureRenderer()) != null) + { + + fr.setGroupVisibility(Arrays.asList(groups), state); + alignPanel.getSeqPanel().seqCanvas.repaint(); + if (alignPanel.overviewPanel != null) + { + alignPanel.overviewPanel.updateOverviewImage(); + } + } + } + + /** * Open the dialog for regex description parsing. */ @Override @@ -5799,4 +5825,5 @@ class PrintThread extends Thread } } } + } -- 1.7.10.2