JAL-1807 still testing
[jalviewjs.git] / bin / jalview / appletgui / APopupMenu.js
index 1e89852..eac223b 100644 (file)
-Clazz.declarePackage ("jalview.appletgui");
-Clazz.load (["awt2swing.PopupMenu", "java.awt.event.ActionListener", "$.ItemListener", "awt2swing.CheckboxMenuItem", "$.Menu", "$.MenuItem", "jalview.util.MessageManager"], "jalview.appletgui.APopupMenu", ["awt2swing.Frame", "jalview.analysis.AAFrequency", "$.AlignmentAnnotationUtils", "$.AlignmentUtils", "$.Conservation", "jalview.appletgui.AppletJmol", "$.CutAndPasteTransfer", "$.EditNameDialog", "$.SliderPanel", "$.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.commands.ChangeCaseCommand", "$.EditCommand", "jalview.datamodel.SequenceFeature", "jalview.io.AppletFormatAdapter", "$.SequenceAnnotationReport", "jalview.schemes.Blosum62ColourScheme", "$.BuriedColourScheme", "$.ClustalxColourScheme", "$.HelixColourScheme", "$.HydrophobicColourScheme", "$.NucleotideColourScheme", "$.PIDColourScheme", "$.ResidueProperties", "$.StrandColourScheme", "$.TaylorColourScheme", "$.TurnColourScheme", "$.ZappoColourScheme", "jalview.util.DBRefUtils", "$.UrlLink", "java.lang.StringBuffer", "$.StringBuilder", "java.util.Arrays", "$.Collections", "$.LinkedHashMap", "$.TreeMap"], function () {
-c$ = Clazz.decorateAsClass (function () {
-this.groupMenu = null;
-this.editGroupName = null;
-this.clustalColour = null;
-this.zappoColour = null;
-this.taylorColour = null;
-this.hydrophobicityColour = null;
-this.helixColour = null;
-this.strandColour = null;
-this.turnColour = null;
-this.buriedColour = null;
-this.abovePIDColour = null;
-this.userDefinedColour = null;
-this.PIDColour = null;
-this.BLOSUM62Colour = null;
-this.noColourmenuItem = null;
-this.conservationMenuItem = null;
-this.ap = null;
-this.unGroupMenuItem = null;
-this.createGroupMenuItem = null;
-this.nucleotideMenuItem = null;
-this.colourMenu = null;
-this.showBoxes = null;
-this.showText = null;
-this.showColourText = null;
-this.displayNonconserved = null;
-this.seqShowAnnotationsMenu = null;
-this.seqHideAnnotationsMenu = null;
-this.seqAddReferenceAnnotations = null;
-this.groupShowAnnotationsMenu = null;
-this.groupHideAnnotationsMenu = null;
-this.groupAddReferenceAnnotations = null;
-this.editMenu = null;
-this.copy = null;
-this.cut = null;
-this.toUpper = null;
-this.toLower = null;
-this.toggleCase = null;
-this.outputmenu = null;
-this.seqMenu = null;
-this.pdb = null;
-this.hideSeqs = null;
-this.repGroup = null;
-this.sequenceName = null;
-this.sequenceFeature = null;
-this.editSequence = null;
-this.sequenceDetails = null;
-this.selSeqDetails = null;
-this.makeReferenceSeq = null;
-this.seq = null;
-this.revealAll = null;
-this.revealSeq = null;
-this.revealSeq_index = -1;
-this.menu1 = null;
-Clazz.instantialize (this, arguments);
-}, jalview.appletgui, "APopupMenu", awt2swing.PopupMenu, [java.awt.event.ActionListener, java.awt.event.ItemListener]);
-Clazz.prepareFields (c$, function () {
-this.groupMenu =  new awt2swing.Menu ();
-this.editGroupName =  new awt2swing.MenuItem ();
-this.clustalColour =  new awt2swing.MenuItem ();
-this.zappoColour =  new awt2swing.MenuItem ();
-this.taylorColour =  new awt2swing.MenuItem ();
-this.hydrophobicityColour =  new awt2swing.MenuItem ();
-this.helixColour =  new awt2swing.MenuItem ();
-this.strandColour =  new awt2swing.MenuItem ();
-this.turnColour =  new awt2swing.MenuItem ();
-this.buriedColour =  new awt2swing.MenuItem ();
-this.abovePIDColour =  new awt2swing.CheckboxMenuItem ();
-this.userDefinedColour =  new awt2swing.MenuItem ();
-this.PIDColour =  new awt2swing.MenuItem ();
-this.BLOSUM62Colour =  new awt2swing.MenuItem ();
-this.noColourmenuItem =  new awt2swing.MenuItem ();
-this.conservationMenuItem =  new awt2swing.CheckboxMenuItem ();
-this.unGroupMenuItem =  new awt2swing.MenuItem ();
-this.createGroupMenuItem =  new awt2swing.MenuItem ();
-this.nucleotideMenuItem =  new awt2swing.MenuItem ();
-this.colourMenu =  new awt2swing.Menu ();
-this.showBoxes =  new awt2swing.CheckboxMenuItem ();
-this.showText =  new awt2swing.CheckboxMenuItem ();
-this.showColourText =  new awt2swing.CheckboxMenuItem ();
-this.displayNonconserved =  new awt2swing.CheckboxMenuItem ();
-this.seqShowAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.show_annotations"));
-this.seqHideAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.hide_annotations"));
-this.seqAddReferenceAnnotations =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.add_reference_annotations"));
-this.groupShowAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.show_annotations"));
-this.groupHideAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.hide_annotations"));
-this.groupAddReferenceAnnotations =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.add_reference_annotations"));
-this.editMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("action.edit"));
-this.copy =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("action.copy"));
-this.cut =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("action.cut"));
-this.toUpper =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.to_upper_case"));
-this.toLower =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.to_lower_case"));
-this.toggleCase =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.toggle_case"));
-this.outputmenu =  new awt2swing.Menu ();
-this.seqMenu =  new awt2swing.Menu ();
-this.pdb =  new awt2swing.MenuItem ();
-this.hideSeqs =  new awt2swing.MenuItem ();
-this.repGroup =  new awt2swing.MenuItem ();
-this.sequenceName =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.edit_name_description"));
-this.sequenceFeature =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.create_sequence_feature"));
-this.editSequence =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.edit_sequence"));
-this.sequenceDetails =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sequence_details") + "...");
-this.selSeqDetails =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sequence_details") + "...");
-this.makeReferenceSeq =  new awt2swing.MenuItem ();
-this.revealAll =  new awt2swing.MenuItem ();
-this.revealSeq =  new awt2swing.MenuItem ();
-this.menu1 =  new awt2swing.Menu ();
-});
-Clazz.makeConstructor (c$, 
-function (apanel, seq, links) {
-Clazz.superConstructor (this, jalview.appletgui.APopupMenu, []);
-this.ap = apanel;
-this.seq = seq;
-try {
-this.jbInit ();
-} catch (e) {
-if (Clazz.exceptionOf (e, Exception)) {
-e.printStackTrace ();
-} else {
-throw e;
-}
-}
-for (var i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++) {
-var item =  new awt2swing.MenuItem (jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);
-item.addActionListener (this);
-this.outputmenu.add (item);
-}
-this.buildAnnotationSubmenus ();
-var sg = this.ap.av.getSelectionGroup ();
-if (sg != null && sg.getSize () > 0) {
-this.editGroupName.setLabel (jalview.util.MessageManager.formatMessage ("label.name_param",  Clazz.newArray (-1, [sg.getName ()])));
-this.showText.setState (sg.getDisplayText ());
-this.showColourText.setState (sg.getColourText ());
-this.showBoxes.setState (sg.getDisplayBoxes ());
-this.displayNonconserved.setState (sg.getShowNonconserved ());
-if (!this.ap.av.getAlignment ().getGroups ().contains (sg)) {
-this.menu1.setLabel (jalview.util.MessageManager.getString ("action.edit_new_group"));
-this.groupMenu.remove (this.unGroupMenuItem);
-} else {
-this.menu1.setLabel (jalview.util.MessageManager.getString ("action.edit_group"));
-this.groupMenu.remove (this.createGroupMenuItem);
-}} else {
-this.remove (this.hideSeqs);
-this.remove (this.groupMenu);
-}if (links != null && links.size () > 0) {
-var linkMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("action.link"));
-for (var i = 0; i < links.size (); i++) {
-var link = links.elementAt (i);
-var urlLink =  new jalview.util.UrlLink (link);
-if (!urlLink.isValid ()) {
-System.err.println (urlLink.getInvalidMessage ());
-continue;
-}var target = urlLink.getTarget ();
-var label = urlLink.getLabel ();
-if (seq != null && urlLink.isDynamic ()) {
-var dbr = jalview.util.DBRefUtils.selectRefs (seq.getDBRef (),  Clazz.newArray (-1, [target]));
-var id = seq.getName ();
-var descr = seq.getDescription ();
-if (descr != null && descr.length < 1) {
-descr = null;
-}if (dbr != null) {
-for (var r = 0; r < dbr.length; r++) {
-if (id != null && dbr[r].getAccessionId ().equals (id)) {
-id = null;
-}var urls = urlLink.makeUrls (dbr[r].getAccessionId (), true);
-if (urls != null) {
-for (var u = 0; u < urls.length; u += 2) {
-this.addshowLink (linkMenu, label + "|" + urls[u], urls[u + 1]);
-}
-}}
-}if (id != null) {
-var urls = urlLink.makeUrls (id, true);
-if (urls != null) {
-for (var u = 0; u < urls.length; u += 2) {
-this.addshowLink (linkMenu, label, urls[u + 1]);
-}
-}}if (descr != null && urlLink.getRegexReplace () != null) {
-var urls = urlLink.makeUrls (descr, true);
-if (urls != null) {
-for (var u = 0; u < urls.length; u += 2) {
-this.addshowLink (linkMenu, label, urls[u + 1]);
-}
-}}} else {
-this.addshowLink (linkMenu, target, urlLink.getUrl_prefix ());
-}}
-if (linkMenu.getItemCount () > 0) {
-if (seq != null) {
-this.seqMenu.add (linkMenu);
-} else {
-this.add (linkMenu);
-}}}if (seq != null) {
-this.seqMenu.setLabel (seq.getName ());
-if (seq === this.ap.av.getAlignment ().getSeqrep ()) {
-this.makeReferenceSeq.setLabel (jalview.util.MessageManager.getString ("action.unmark_as_reference"));
-} else {
-this.makeReferenceSeq.setLabel (jalview.util.MessageManager.getString ("action.set_as_reference"));
-}this.repGroup.setLabel (jalview.util.MessageManager.formatMessage ("label.represent_group_with",  Clazz.newArray (-1, [seq.getName ()])));
-} else {
-this.remove (this.seqMenu);
-}if (!this.ap.av.hasHiddenRows ()) {
-this.remove (this.revealAll);
-this.remove (this.revealSeq);
-} else {
-var index = this.ap.av.getAlignment ().findIndex (seq);
-if (this.ap.av.adjustForHiddenSeqs (index) - this.ap.av.adjustForHiddenSeqs (index - 1) > 1) {
-this.revealSeq_index = index;
-} else {
-this.remove (this.revealSeq);
-}}}, "jalview.appletgui.AlignmentPanel,jalview.datamodel.SequenceI,java.util.Vector");
-Clazz.defineMethod (c$, "buildAnnotationSubmenus", 
-($fz = function () {
-var selectedSequence = (this.seq == null ? java.util.Collections.emptyList () : java.util.Arrays.asList ([this.seq]));
-this.buildAnnotationTypesMenus (this.seqShowAnnotationsMenu, this.seqHideAnnotationsMenu, selectedSequence);
-this.configureReferenceAnnotationsMenu (this.seqAddReferenceAnnotations, selectedSequence);
-var selectedGroup = (this.ap.av.getSelectionGroup () == null ? java.util.Collections.emptyList () : this.ap.av.getSelectionGroup ().getSequences ());
-this.buildAnnotationTypesMenus (this.groupShowAnnotationsMenu, this.groupHideAnnotationsMenu, selectedGroup);
-this.configureReferenceAnnotationsMenu (this.groupAddReferenceAnnotations, selectedGroup);
-}, $fz.isPrivate = true, $fz));
-Clazz.defineMethod (c$, "configureReferenceAnnotationsMenu", 
-($fz = function (menuItem, forSequences) {
-menuItem.setEnabled (false);
-var tipEntries =  new java.util.TreeMap ();
-var candidates =  new java.util.LinkedHashMap ();
-var al = this.ap.av.getAlignment ();
-jalview.analysis.AlignmentUtils.findAddableReferenceAnnotations (forSequences, tipEntries, candidates, al);
-if (!candidates.isEmpty ()) {
-var tooltip =  new StringBuilder (64);
-tooltip.append (jalview.util.MessageManager.getString ("label.add_annotations_for"));
-menuItem.setEnabled (true);
-menuItem.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$1") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$1, this, Clazz.cloneFinals ("candidates", candidates))));
-}}, $fz.isPrivate = true, $fz), "awt2swing.MenuItem,java.util.List");
-Clazz.defineMethod (c$, "addReferenceAnnotations_actionPerformed", 
-function (candidates) {
-var selectionGroup = this.ap.av.getSelectionGroup ();
-var alignment = this.ap.getAlignment ();
-jalview.analysis.AlignmentUtils.addReferenceAnnotations (candidates, alignment, selectionGroup);
-this.refresh ();
-}, "java.util.Map");
-Clazz.defineMethod (c$, "addshowLink", 
-($fz = function (linkMenu, target, url) {
-this.addshowLink (linkMenu, target, target, url);
-}, $fz.isPrivate = true, $fz), "awt2swing.Menu,~S,~S");
-Clazz.defineMethod (c$, "addshowLink", 
-($fz = function (linkMenu, target, label, url) {
-var item =  new awt2swing.MenuItem (label);
-item.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$2") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$2$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$2, this, Clazz.cloneFinals ("url", url, "target", target))));
-linkMenu.add (item);
-}, $fz.isPrivate = true, $fz), "awt2swing.Menu,~S,~S,~S");
-Clazz.overrideMethod (c$, "itemStateChanged", 
-function (evt) {
-if (evt.getSource () === this.abovePIDColour) {
-this.abovePIDColour_itemStateChanged ();
-} else if (evt.getSource () === this.showColourText) {
-this.showColourText_itemStateChanged ();
-} else if (evt.getSource () === this.showText) {
-this.showText_itemStateChanged ();
-} else if (evt.getSource () === this.showBoxes) {
-this.showBoxes_itemStateChanged ();
-} else if (evt.getSource () === this.displayNonconserved) {
-this.showNonconserved_itemStateChanged ();
-}}, "java.awt.event.ItemEvent");
-Clazz.overrideMethod (c$, "actionPerformed", 
-function (evt) {
-var source = evt.getSource ();
-if (source === this.clustalColour) {
-this.clustalColour_actionPerformed ();
-} else if (source === this.zappoColour) {
-this.zappoColour_actionPerformed ();
-} else if (source === this.taylorColour) {
-this.taylorColour_actionPerformed ();
-} else if (source === this.hydrophobicityColour) {
-this.hydrophobicityColour_actionPerformed ();
-} else if (source === this.helixColour) {
-this.helixColour_actionPerformed ();
-} else if (source === this.strandColour) {
-this.strandColour_actionPerformed ();
-} else if (source === this.turnColour) {
-this.turnColour_actionPerformed ();
-} else if (source === this.buriedColour) {
-this.buriedColour_actionPerformed ();
-} else if (source === this.nucleotideMenuItem) {
-this.nucleotideMenuItem_actionPerformed ();
-} else if (source === this.userDefinedColour) {
-this.userDefinedColour_actionPerformed ();
-} else if (source === this.PIDColour) {
-this.PIDColour_actionPerformed ();
-} else if (source === this.BLOSUM62Colour) {
-this.BLOSUM62Colour_actionPerformed ();
-} else if (source === this.noColourmenuItem) {
-this.noColourmenuItem_actionPerformed ();
-} else if (source === this.conservationMenuItem) {
-this.conservationMenuItem_itemStateChanged ();
-} else if (source === this.unGroupMenuItem) {
-this.unGroupMenuItem_actionPerformed ();
-} else if (source === this.createGroupMenuItem) {
-this.createGroupMenuItem_actionPerformed ();
-} else if (source === this.sequenceName) {
-this.editName ();
-} else if (source === this.makeReferenceSeq) {
-this.makeReferenceSeq_actionPerformed ();
-} else if (source === this.sequenceDetails) {
-this.showSequenceDetails ();
-} else if (source === this.selSeqDetails) {
-this.showSequenceSelectionDetails ();
-} else if (source === this.pdb) {
-this.addPDB ();
-} else if (source === this.hideSeqs) {
-this.hideSequences (false);
-} else if (source === this.repGroup) {
-this.hideSequences (true);
-} else if (source === this.revealSeq) {
-this.ap.av.showSequence (this.revealSeq_index);
-} else if (source === this.revealAll) {
-this.ap.av.showAllHiddenSeqs ();
-} else if (source === this.editGroupName) {
-var dialog =  new jalview.appletgui.EditNameDialog (this.getGroup ().getName (), this.getGroup ().getDescription (), "       Group Name", "Group Description", this.ap.alignFrame, "Edit Group Name / Description", 500, 100, true);
-if (dialog.accept) {
-this.getGroup ().setName (dialog.getName ().$replace (' ', '_'));
-this.getGroup ().setDescription (dialog.getDescription ());
-}} else if (source === this.copy) {
-this.ap.alignFrame.copy_actionPerformed ();
-} else if (source === this.cut) {
-this.ap.alignFrame.cut_actionPerformed ();
-} else if (source === this.editSequence) {
-var sg = this.ap.av.getSelectionGroup ();
-if (sg != null) {
-if (this.seq == null) {
-this.seq = sg.getSequenceAt (0);
-}var dialog =  new jalview.appletgui.EditNameDialog (this.seq.getSequenceAsString (sg.getStartRes (), sg.getEndRes () + 1), null, "Edit Sequence ", null, this.ap.alignFrame, "Edit Sequence", 500, 100, true);
-if (dialog.accept) {
-var editCommand =  new jalview.commands.EditCommand (jalview.util.MessageManager.getString ("label.edit_sequences"), jalview.commands.EditCommand.Action.REPLACE, dialog.getName ().$replace (' ', this.ap.av.getGapCharacter ()), sg.getSequencesAsArray (this.ap.av.getHiddenRepSequences ()), sg.getStartRes (), sg.getEndRes () + 1, this.ap.av.getAlignment ());
-this.ap.alignFrame.addHistoryItem (editCommand);
-this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ());
-}}} else if (source === this.toUpper || source === this.toLower || source === this.toggleCase) {
-var sg = this.ap.av.getSelectionGroup ();
-if (sg != null) {
-var startEnd = this.ap.av.getVisibleRegionBoundaries (sg.getStartRes (), sg.getEndRes () + 1);
-var description;
-var caseChange;
-if (source === this.toggleCase) {
-description = "Toggle Case";
-caseChange = jalview.commands.ChangeCaseCommand.TOGGLE_CASE;
-} else if (source === this.toUpper) {
-description = "To Upper Case";
-caseChange = jalview.commands.ChangeCaseCommand.TO_UPPER;
-} else {
-description = "To Lower Case";
-caseChange = jalview.commands.ChangeCaseCommand.TO_LOWER;
-}var caseCommand =  new jalview.commands.ChangeCaseCommand (description, sg.getSequencesAsArray (this.ap.av.getHiddenRepSequences ()), startEnd, caseChange);
-this.ap.alignFrame.addHistoryItem (caseCommand);
-this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ());
-}} else if (source === this.sequenceFeature) {
-var sg = this.ap.av.getSelectionGroup ();
-if (sg == null) {
-return;
-}var rsize = 0;
-var gSize = sg.getSize ();
-var rseqs;
-var seqs =  new Array (gSize);
-var tfeatures;
-var features =  new Array (gSize);
-for (var i = 0; i < gSize; i++) {
-var start = sg.getSequenceAt (i).findPosition (sg.getStartRes ());
-var end = sg.findEndRes (sg.getSequenceAt (i));
-if (start <= end) {
-seqs[rsize] = sg.getSequenceAt (i);
-features[rsize] =  new jalview.datamodel.SequenceFeature (null, null, null, start, end, "Jalview");
-rsize++;
-}}
-rseqs =  new Array (rsize);
-tfeatures =  new Array (rsize);
-System.arraycopy (seqs, 0, rseqs, 0, rsize);
-System.arraycopy (features, 0, tfeatures, 0, rsize);
-features = tfeatures;
-seqs = rseqs;
-if (this.ap.seqPanel.seqCanvas.getFeatureRenderer ().amendFeatures (seqs, features, true, this.ap)) {
-this.ap.alignFrame.sequenceFeatures.setState (true);
-this.ap.av.setShowSequenceFeatures (true);
-;this.ap.highlightSearchResults (null);
-}} else {
-this.outputText (evt);
-}}, "java.awt.event.ActionEvent");
-Clazz.defineMethod (c$, "outputText", 
-function (e) {
-var cap =  new jalview.appletgui.CutAndPasteTransfer (true, this.ap.alignFrame);
-var frame =  new awt2swing.Frame ();
-frame.add (cap);
-jalview.bin.JalviewLite.addFrame (frame, jalview.util.MessageManager.formatMessage ("label.selection_output_command",  Clazz.newArray (-1, [e.getActionCommand ()])), 600, 500);
-cap.setText ( new jalview.io.AppletFormatAdapter ().formatSequences (e.getActionCommand (), this.ap.av.getShowJVSuffix (), this.ap, true));
-}, "java.awt.event.ActionEvent");
-Clazz.defineMethod (c$, "showSequenceSelectionDetails", 
-function () {
-this.createSequenceDetailsReport (this.ap.av.getSequenceSelection ());
-});
-Clazz.defineMethod (c$, "showSequenceDetails", 
-function () {
-this.createSequenceDetailsReport ( Clazz.newArray (-1, [this.seq]));
-});
-Clazz.defineMethod (c$, "createSequenceDetailsReport", 
-function (sequences) {
-var cap =  new jalview.appletgui.CutAndPasteTransfer (false, this.ap.alignFrame);
-var contents =  new StringBuffer ();
-for (var seq, $seq = 0, $$seq = sequences; $seq < $$seq.length && ((seq = $$seq[$seq]) || true); $seq++) {
-contents.append (jalview.util.MessageManager.formatMessage ("label.annotation_for_displayid",  Clazz.newArray (-1, [seq.getDisplayId (true)])));
- new jalview.io.SequenceAnnotationReport (null).createSequenceAnnotationReport (contents, seq, true, true, false, (this.ap.seqPanel.seqCanvas.fr != null) ? this.ap.seqPanel.seqCanvas.fr.getMinMax () : null);
-contents.append ("</p>");
-}
-var frame =  new awt2swing.Frame ();
-frame.add (cap);
-jalview.bin.JalviewLite.addFrame (frame, "Sequence Details for " + (sequences.length == 1 ? sequences[0].getDisplayId (true) : "Selection"), 600, 500);
-cap.setText (jalview.util.MessageManager.formatMessage ("label.html_content",  Clazz.newArray (-1, [contents.toString ()])));
-}, "~A");
-Clazz.defineMethod (c$, "editName", 
-function () {
-var dialog =  new jalview.appletgui.EditNameDialog (this.seq.getName (), this.seq.getDescription (), "       Sequence Name", "Sequence Description", this.ap.alignFrame, "Edit Sequence Name / Description", 500, 100, true);
-if (dialog.accept) {
-this.seq.setName (dialog.getName ());
-this.seq.setDescription (dialog.getDescription ());
-this.ap.paintAlignment (false);
-}});
-Clazz.defineMethod (c$, "addPDB", 
-function () {
-if (this.seq.getPDBId () != null) {
-var entry = this.seq.getPDBId ().firstElement ();
-if (this.ap.av.applet.jmolAvailable) {
- new jalview.appletgui.AppletJmol (entry,  Clazz.newArray (-1, [this.seq]), null, this.ap, jalview.io.AppletFormatAdapter.URL);
-}} else {
-var cap =  new jalview.appletgui.CutAndPasteTransfer (true, this.ap.alignFrame);
-cap.setText (jalview.util.MessageManager.getString ("label.paste_pdb_file"));
-cap.setPDBImport (this.seq);
-var frame =  new awt2swing.Frame ();
-frame.add (cap);
-jalview.bin.JalviewLite.addFrame (frame, jalview.util.MessageManager.formatMessage ("label.paste_pdb_file_for_sequence",  Clazz.newArray (-1, [this.seq.getName ()])), 400, 300);
-}});
-Clazz.defineMethod (c$, "jbInit", 
-($fz = function () {
-this.groupMenu.setLabel (jalview.util.MessageManager.getString ("label.selection"));
-this.sequenceFeature.addActionListener (this);
-this.editGroupName.addActionListener (this);
-this.unGroupMenuItem.setLabel (jalview.util.MessageManager.getString ("action.remove_group"));
-this.unGroupMenuItem.addActionListener (this);
-this.createGroupMenuItem.setLabel (jalview.util.MessageManager.getString ("action.create_group"));
-this.createGroupMenuItem.addActionListener (this);
-this.nucleotideMenuItem.setLabel (jalview.util.MessageManager.getString ("label.nucleotide"));
-this.nucleotideMenuItem.addActionListener (this);
-this.conservationMenuItem.addItemListener (this);
-this.abovePIDColour.addItemListener (this);
-this.colourMenu.setLabel (jalview.util.MessageManager.getString ("label.group_colour"));
-this.showBoxes.setLabel (jalview.util.MessageManager.getString ("action.boxes"));
-this.showBoxes.setState (true);
-this.showBoxes.addItemListener (this);
-this.sequenceName.addActionListener (this);
-this.sequenceDetails.addActionListener (this);
-this.selSeqDetails.addActionListener (this);
-this.displayNonconserved.setLabel (jalview.util.MessageManager.getString ("label.show_non_conversed"));
-this.displayNonconserved.setState (false);
-this.displayNonconserved.addItemListener (this);
-this.showText.setLabel (jalview.util.MessageManager.getString ("action.text"));
-this.showText.addItemListener (this);
-this.showColourText.setLabel (jalview.util.MessageManager.getString ("label.colour_text"));
-this.showColourText.addItemListener (this);
-this.outputmenu.setLabel (jalview.util.MessageManager.getString ("label.out_to_textbox"));
-this.seqMenu.setLabel (jalview.util.MessageManager.getString ("label.sequence"));
-this.pdb.setLabel (jalview.util.MessageManager.getString ("label.view_pdb_structure"));
-this.hideSeqs.setLabel (jalview.util.MessageManager.getString ("action.hide_sequences"));
-this.repGroup.setLabel (jalview.util.MessageManager.formatMessage ("label.represent_group_with",  Clazz.newArray (-1, [""])));
-this.revealAll.setLabel (jalview.util.MessageManager.getString ("action.reveal_all"));
-this.revealSeq.setLabel (jalview.util.MessageManager.getString ("action.reveal_sequences"));
-this.menu1.setLabel (jalview.util.MessageManager.getString ("label.group") + ":");
-this.add (this.groupMenu);
-this.add (this.seqMenu);
-this.add (this.hideSeqs);
-this.add (this.revealSeq);
-this.add (this.revealAll);
-this.groupMenu.add (this.groupShowAnnotationsMenu);
-this.groupMenu.add (this.groupHideAnnotationsMenu);
-this.groupMenu.add (this.groupAddReferenceAnnotations);
-this.groupMenu.add (this.editMenu);
-this.groupMenu.add (this.outputmenu);
-this.groupMenu.add (this.sequenceFeature);
-this.groupMenu.add (this.createGroupMenuItem);
-this.groupMenu.add (this.unGroupMenuItem);
-this.groupMenu.add (this.menu1);
-this.colourMenu.add (this.noColourmenuItem);
-this.colourMenu.add (this.clustalColour);
-this.colourMenu.add (this.BLOSUM62Colour);
-this.colourMenu.add (this.PIDColour);
-this.colourMenu.add (this.zappoColour);
-this.colourMenu.add (this.taylorColour);
-this.colourMenu.add (this.hydrophobicityColour);
-this.colourMenu.add (this.helixColour);
-this.colourMenu.add (this.strandColour);
-this.colourMenu.add (this.turnColour);
-this.colourMenu.add (this.buriedColour);
-this.colourMenu.add (this.nucleotideMenuItem);
-this.colourMenu.add (this.userDefinedColour);
-this.colourMenu.addSeparator ();
-this.colourMenu.add (this.abovePIDColour);
-this.colourMenu.add (this.conservationMenuItem);
-this.noColourmenuItem.setLabel (jalview.util.MessageManager.getString ("label.none"));
-this.noColourmenuItem.addActionListener (this);
-this.clustalColour.setLabel (jalview.util.MessageManager.getString ("label.clustalx_colours"));
-this.clustalColour.addActionListener (this);
-this.zappoColour.setLabel (jalview.util.MessageManager.getString ("label.zappo"));
-this.zappoColour.addActionListener (this);
-this.taylorColour.setLabel (jalview.util.MessageManager.getString ("label.taylor"));
-this.taylorColour.addActionListener (this);
-this.hydrophobicityColour.setLabel (jalview.util.MessageManager.getString ("label.hydrophobicity"));
-this.hydrophobicityColour.addActionListener (this);
-this.helixColour.setLabel (jalview.util.MessageManager.getString ("label.helix_propensity"));
-this.helixColour.addActionListener (this);
-this.strandColour.setLabel (jalview.util.MessageManager.getString ("label.strand_propensity"));
-this.strandColour.addActionListener (this);
-this.turnColour.setLabel (jalview.util.MessageManager.getString ("label.turn_propensity"));
-this.turnColour.addActionListener (this);
-this.buriedColour.setLabel (jalview.util.MessageManager.getString ("label.buried_index"));
-this.buriedColour.addActionListener (this);
-this.abovePIDColour.setLabel (jalview.util.MessageManager.getString ("label.above_identity_percentage"));
-this.userDefinedColour.setLabel (jalview.util.MessageManager.getString ("action.user_defined"));
-this.userDefinedColour.addActionListener (this);
-this.PIDColour.setLabel (jalview.util.MessageManager.getString ("action.percentage_identity"));
-this.PIDColour.addActionListener (this);
-this.BLOSUM62Colour.setLabel ("BLOSUM62");
-this.BLOSUM62Colour.addActionListener (this);
-this.conservationMenuItem.setLabel (jalview.util.MessageManager.getString ("label.conservation"));
-this.editMenu.add (this.copy);
-this.copy.addActionListener (this);
-this.editMenu.add (this.cut);
-this.cut.addActionListener (this);
-this.editMenu.add (this.editSequence);
-this.editSequence.addActionListener (this);
-this.editMenu.add (this.toUpper);
-this.toUpper.addActionListener (this);
-this.editMenu.add (this.toLower);
-this.toLower.addActionListener (this);
-this.editMenu.add (this.toggleCase);
-this.seqMenu.add (this.seqShowAnnotationsMenu);
-this.seqMenu.add (this.seqHideAnnotationsMenu);
-this.seqMenu.add (this.seqAddReferenceAnnotations);
-this.seqMenu.add (this.sequenceName);
-this.seqMenu.add (this.makeReferenceSeq);
-if (!this.ap.av.applet.useXtrnalSviewer) {
-this.seqMenu.add (this.pdb);
-}this.seqMenu.add (this.repGroup);
-this.menu1.add (this.editGroupName);
-this.menu1.add (this.colourMenu);
-this.menu1.add (this.showBoxes);
-this.menu1.add (this.showText);
-this.menu1.add (this.showColourText);
-this.menu1.add (this.displayNonconserved);
-this.toggleCase.addActionListener (this);
-this.pdb.addActionListener (this);
-this.hideSeqs.addActionListener (this);
-this.repGroup.addActionListener (this);
-this.revealAll.addActionListener (this);
-this.revealSeq.addActionListener (this);
-this.makeReferenceSeq.addActionListener (this);
-}, $fz.isPrivate = true, $fz));
-Clazz.defineMethod (c$, "refresh", 
-function () {
-this.ap.paintAlignment (true);
-});
-Clazz.defineMethod (c$, "clustalColour_actionPerformed", 
-function () {
-var sg = this.getGroup ();
-sg.cs =  new jalview.schemes.ClustalxColourScheme (sg, this.ap.av.getHiddenRepSequences ());
-this.refresh ();
-});
-Clazz.defineMethod (c$, "zappoColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.ZappoColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "taylorColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.TaylorColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "hydrophobicityColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.HydrophobicColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "helixColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.HelixColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "strandColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.StrandColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "turnColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.TurnColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "buriedColour_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.BuriedColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "nucleotideMenuItem_actionPerformed", 
-function () {
-this.getGroup ().cs =  new jalview.schemes.NucleotideColourScheme ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "abovePIDColour_itemStateChanged", 
-function () {
-var sg = this.getGroup ();
-if (sg.cs == null) {
-return;
-}if (this.abovePIDColour.getState ()) {
-sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));
-var threshold = jalview.appletgui.SliderPanel.setPIDSliderSource (this.ap, sg.cs, this.getGroup ().getName ());
-sg.cs.setThreshold (threshold, this.ap.av.isIgnoreGapsConsensus ());
-jalview.appletgui.SliderPanel.showPIDSlider ();
-} else {
-sg.cs.setThreshold (0, this.ap.av.isIgnoreGapsConsensus ());
-}this.refresh ();
-});
-Clazz.defineMethod (c$, "userDefinedColour_actionPerformed", 
-function () {
- new jalview.appletgui.UserDefinedColours (this.ap, this.getGroup ());
-});
-Clazz.defineMethod (c$, "PIDColour_actionPerformed", 
-function () {
-var sg = this.getGroup ();
-sg.cs =  new jalview.schemes.PIDColourScheme ();
-sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));
-this.refresh ();
-});
-Clazz.defineMethod (c$, "BLOSUM62Colour_actionPerformed", 
-function () {
-var sg = this.getGroup ();
-sg.cs =  new jalview.schemes.Blosum62ColourScheme ();
-sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));
-this.refresh ();
-});
-Clazz.defineMethod (c$, "noColourmenuItem_actionPerformed", 
-function () {
-this.getGroup ().cs = null;
-this.refresh ();
-});
-Clazz.defineMethod (c$, "conservationMenuItem_itemStateChanged", 
-function () {
-var sg = this.getGroup ();
-if (sg.cs == null) {
-return;
-}if (this.conservationMenuItem.getState ()) {
-sg.cs.setConservation (jalview.analysis.Conservation.calculateConservation ("Group", jalview.schemes.ResidueProperties.propHash, 3, sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth (), false, this.ap.av.getConsPercGaps (), false));
-jalview.appletgui.SliderPanel.setConservationSlider (this.ap, sg.cs, sg.getName ());
-jalview.appletgui.SliderPanel.showConservationSlider ();
-} else {
-sg.cs.setConservation (null);
-}this.refresh ();
-});
-Clazz.defineMethod (c$, "getGroup", 
-function () {
-var sg = this.ap.av.getSelectionGroup ();
-if (sg != null) {
-this.ap.av.getAlignment ().addGroup (sg);
-}return sg;
-});
-Clazz.defineMethod (c$, "unGroupMenuItem_actionPerformed", 
-function () {
-var sg = this.ap.av.getSelectionGroup ();
-this.ap.av.getAlignment ().deleteGroup (sg);
-this.ap.av.setSelectionGroup (null);
-this.ap.paintAlignment (true);
-});
-Clazz.defineMethod (c$, "createGroupMenuItem_actionPerformed", 
-function () {
-this.getGroup ();
-this.refresh ();
-});
-Clazz.defineMethod (c$, "showColourText_itemStateChanged", 
-function () {
-this.getGroup ().setColourText (this.showColourText.getState ());
-this.refresh ();
-});
-Clazz.defineMethod (c$, "showText_itemStateChanged", 
-function () {
-this.getGroup ().setDisplayText (this.showText.getState ());
-this.refresh ();
-});
-Clazz.defineMethod (c$, "makeReferenceSeq_actionPerformed", 
-function () {
-if (!this.ap.av.getAlignment ().hasSeqrep ()) {
-this.ap.av.setDisplayReferenceSeq (true);
-this.ap.av.setColourByReferenceSeq (true);
-this.ap.av.getAlignment ().setSeqrep (this.seq);
-} else {
-if (this.ap.av.getAlignment ().getSeqrep () === this.seq) {
-this.ap.av.getAlignment ().setSeqrep (null);
-} else {
-this.ap.av.getAlignment ().setSeqrep (this.seq);
-}}this.refresh ();
-});
-Clazz.defineMethod (c$, "showNonconserved_itemStateChanged", 
-function () {
-this.getGroup ().setShowNonconserved (this.displayNonconserved.getState ());
-this.refresh ();
-});
-Clazz.defineMethod (c$, "showBoxes_itemStateChanged", 
-function () {
-this.getGroup ().setDisplayBoxes (this.showBoxes.getState ());
-this.refresh ();
-});
-Clazz.defineMethod (c$, "hideSequences", 
-function (representGroup) {
-var sg = this.ap.av.getSelectionGroup ();
-if (sg == null || sg.getSize () < 1) {
-this.ap.av.hideSequence ( Clazz.newArray (-1, [this.seq]));
-return;
-}this.ap.av.setSelectionGroup (null);
-if (representGroup) {
-this.ap.av.hideRepSequences (this.seq, sg);
-return;
-}var gsize = sg.getSize ();
-var hseqs;
-hseqs =  new Array (gsize);
-var index = 0;
-for (var i = 0; i < gsize; i++) {
-hseqs[index++] = sg.getSequenceAt (i);
-}
-this.ap.av.hideSequence (hseqs);
-this.ap.av.sendSelection ();
-}, "~B");
-Clazz.defineMethod (c$, "buildAnnotationTypesMenus", 
-function (showMenu, hideMenu, forSequences) {
-showMenu.removeAll ();
-hideMenu.removeAll ();
-var all = java.util.Arrays.asList (["All"]);
-this.addAnnotationTypeToShowHide (showMenu, forSequences, "", all, true, true);
-this.addAnnotationTypeToShowHide (hideMenu, forSequences, "", all, true, false);
-showMenu.addSeparator ();
-hideMenu.addSeparator ();
-var annotations = this.ap.getAlignment ().getAlignmentAnnotation ();
-var shownTypes =  new java.util.LinkedHashMap ();
-var hiddenTypes =  new java.util.LinkedHashMap ();
-jalview.analysis.AlignmentAnnotationUtils.getShownHiddenTypes (shownTypes, hiddenTypes, jalview.analysis.AlignmentAnnotationUtils.asList (annotations), forSequences);
-for (var calcId, $calcId = hiddenTypes.keySet ().iterator (); $calcId.hasNext () && ((calcId = $calcId.next ()) || true);) {
-for (var type, $type = hiddenTypes.get (calcId).iterator (); $type.hasNext () && ((type = $type.next ()) || true);) {
-this.addAnnotationTypeToShowHide (showMenu, forSequences, calcId, type, false, true);
-}
-}
-showMenu.setEnabled (!hiddenTypes.isEmpty ());
-for (var calcId, $calcId = shownTypes.keySet ().iterator (); $calcId.hasNext () && ((calcId = $calcId.next ()) || true);) {
-for (var type, $type = shownTypes.get (calcId).iterator (); $type.hasNext () && ((type = $type.next ()) || true);) {
-this.addAnnotationTypeToShowHide (hideMenu, forSequences, calcId, type, false, false);
-}
-}
-hideMenu.setEnabled (!shownTypes.isEmpty ());
-}, "awt2swing.Menu,awt2swing.Menu,java.util.List");
-Clazz.defineMethod (c$, "addAnnotationTypeToShowHide", 
-function (showOrHideMenu, forSequences, calcId, types, allTypes, actionIsShow) {
-var label = types.toString ();
-label = label.substring (1, label.length - 1);
-var item =  new awt2swing.MenuItem (label);
-item.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$3") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$3$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$3, this, Clazz.cloneFinals ("types", types, "forSequences", forSequences, "allTypes", allTypes, "actionIsShow", actionIsShow))));
-showOrHideMenu.add (item);
-}, "awt2swing.Menu,java.util.List,~S,java.util.List,~B,~B");
-c$.$APopupMenu$1$ = function () {
-Clazz.pu$h ();
-c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$1", null, java.awt.event.ActionListener);
-Clazz.overrideMethod (c$, "actionPerformed", 
-function (e) {
-this.b$["jalview.appletgui.APopupMenu"].addReferenceAnnotations_actionPerformed (this.f$.candidates);
-}, "java.awt.event.ActionEvent");
-c$ = Clazz.p0p ();
-};
-c$.$APopupMenu$2$ = function () {
-Clazz.pu$h ();
-c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$2", null, java.awt.event.ActionListener);
-Clazz.overrideMethod (c$, "actionPerformed", 
-function (e) {
-this.b$["jalview.appletgui.APopupMenu"].ap.alignFrame.showURL (this.f$.url, this.f$.target);
-}, "java.awt.event.ActionEvent");
-c$ = Clazz.p0p ();
-};
-c$.$APopupMenu$3$ = function () {
-Clazz.pu$h ();
-c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$3", null, java.awt.event.ActionListener);
-Clazz.overrideMethod (c$, "actionPerformed", 
-function (e) {
-jalview.analysis.AlignmentUtils.showOrHideSequenceAnnotations (this.b$["jalview.appletgui.APopupMenu"].ap.getAlignment (), this.f$.types, this.f$.forSequences, this.f$.allTypes, this.f$.actionIsShow);
-this.b$["jalview.appletgui.APopupMenu"].refresh ();
-}, "java.awt.event.ActionEvent");
-c$ = Clazz.p0p ();
-};
-Clazz.defineStatics (c$,
-"ALL_ANNOTATIONS", "All");
-});
+Clazz.declarePackage ("jalview.appletgui");\r
+Clazz.load (["awt2swing.PopupMenu", "java.awt.event.ActionListener", "$.ItemListener", "awt2swing.CheckboxMenuItem", "$.Menu", "$.MenuItem", "jalview.util.MessageManager"], "jalview.appletgui.APopupMenu", ["awt2swing.Frame", "jalview.analysis.AAFrequency", "$.AlignmentAnnotationUtils", "$.AlignmentUtils", "$.Conservation", "jalview.appletgui.AppletJmol", "$.CutAndPasteTransfer", "$.EditNameDialog", "$.SliderPanel", "$.UserDefinedColours", "jalview.bin.JalviewLite", "jalview.commands.ChangeCaseCommand", "$.EditCommand", "jalview.datamodel.SequenceFeature", "jalview.io.AppletFormatAdapter", "$.SequenceAnnotationReport", "jalview.schemes.Blosum62ColourScheme", "$.BuriedColourScheme", "$.ClustalxColourScheme", "$.HelixColourScheme", "$.HydrophobicColourScheme", "$.NucleotideColourScheme", "$.PIDColourScheme", "$.ResidueProperties", "$.StrandColourScheme", "$.TaylorColourScheme", "$.TurnColourScheme", "$.ZappoColourScheme", "jalview.util.DBRefUtils", "$.UrlLink", "java.lang.StringBuffer", "$.StringBuilder", "java.util.Arrays", "$.Collections", "$.LinkedHashMap", "$.TreeMap"], function () {\r
+c$ = Clazz.decorateAsClass (function () {\r
+this.groupMenu = null;\r
+this.editGroupName = null;\r
+this.clustalColour = null;\r
+this.zappoColour = null;\r
+this.taylorColour = null;\r
+this.hydrophobicityColour = null;\r
+this.helixColour = null;\r
+this.strandColour = null;\r
+this.turnColour = null;\r
+this.buriedColour = null;\r
+this.abovePIDColour = null;\r
+this.userDefinedColour = null;\r
+this.PIDColour = null;\r
+this.BLOSUM62Colour = null;\r
+this.noColourmenuItem = null;\r
+this.conservationMenuItem = null;\r
+this.ap = null;\r
+this.unGroupMenuItem = null;\r
+this.createGroupMenuItem = null;\r
+this.nucleotideMenuItem = null;\r
+this.colourMenu = null;\r
+this.showBoxes = null;\r
+this.showText = null;\r
+this.showColourText = null;\r
+this.displayNonconserved = null;\r
+this.seqShowAnnotationsMenu = null;\r
+this.seqHideAnnotationsMenu = null;\r
+this.seqAddReferenceAnnotations = null;\r
+this.groupShowAnnotationsMenu = null;\r
+this.groupHideAnnotationsMenu = null;\r
+this.groupAddReferenceAnnotations = null;\r
+this.editMenu = null;\r
+this.copy = null;\r
+this.cut = null;\r
+this.toUpper = null;\r
+this.toLower = null;\r
+this.toggleCase = null;\r
+this.outputmenu = null;\r
+this.seqMenu = null;\r
+this.pdb = null;\r
+this.hideSeqs = null;\r
+this.repGroup = null;\r
+this.sequenceName = null;\r
+this.sequenceFeature = null;\r
+this.editSequence = null;\r
+this.sequenceDetails = null;\r
+this.selSeqDetails = null;\r
+this.makeReferenceSeq = null;\r
+this.seq = null;\r
+this.revealAll = null;\r
+this.revealSeq = null;\r
+this.revealSeq_index = -1;\r
+this.menu1 = null;\r
+Clazz.instantialize (this, arguments);\r
+}, jalview.appletgui, "APopupMenu", awt2swing.PopupMenu, [java.awt.event.ActionListener, java.awt.event.ItemListener]);\r
+Clazz.prepareFields (c$, function () {\r
+this.groupMenu =  new awt2swing.Menu ();\r
+this.editGroupName =  new awt2swing.MenuItem ();\r
+this.clustalColour =  new awt2swing.MenuItem ();\r
+this.zappoColour =  new awt2swing.MenuItem ();\r
+this.taylorColour =  new awt2swing.MenuItem ();\r
+this.hydrophobicityColour =  new awt2swing.MenuItem ();\r
+this.helixColour =  new awt2swing.MenuItem ();\r
+this.strandColour =  new awt2swing.MenuItem ();\r
+this.turnColour =  new awt2swing.MenuItem ();\r
+this.buriedColour =  new awt2swing.MenuItem ();\r
+this.abovePIDColour =  new awt2swing.CheckboxMenuItem ();\r
+this.userDefinedColour =  new awt2swing.MenuItem ();\r
+this.PIDColour =  new awt2swing.MenuItem ();\r
+this.BLOSUM62Colour =  new awt2swing.MenuItem ();\r
+this.noColourmenuItem =  new awt2swing.MenuItem ();\r
+this.conservationMenuItem =  new awt2swing.CheckboxMenuItem ();\r
+this.unGroupMenuItem =  new awt2swing.MenuItem ();\r
+this.createGroupMenuItem =  new awt2swing.MenuItem ();\r
+this.nucleotideMenuItem =  new awt2swing.MenuItem ();\r
+this.colourMenu =  new awt2swing.Menu ();\r
+this.showBoxes =  new awt2swing.CheckboxMenuItem ();\r
+this.showText =  new awt2swing.CheckboxMenuItem ();\r
+this.showColourText =  new awt2swing.CheckboxMenuItem ();\r
+this.displayNonconserved =  new awt2swing.CheckboxMenuItem ();\r
+this.seqShowAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.show_annotations"));\r
+this.seqHideAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.hide_annotations"));\r
+this.seqAddReferenceAnnotations =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.add_reference_annotations"));\r
+this.groupShowAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.show_annotations"));\r
+this.groupHideAnnotationsMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("label.hide_annotations"));\r
+this.groupAddReferenceAnnotations =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.add_reference_annotations"));\r
+this.editMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("action.edit"));\r
+this.copy =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("action.copy"));\r
+this.cut =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("action.cut"));\r
+this.toUpper =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.to_upper_case"));\r
+this.toLower =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.to_lower_case"));\r
+this.toggleCase =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.toggle_case"));\r
+this.outputmenu =  new awt2swing.Menu ();\r
+this.seqMenu =  new awt2swing.Menu ();\r
+this.pdb =  new awt2swing.MenuItem ();\r
+this.hideSeqs =  new awt2swing.MenuItem ();\r
+this.repGroup =  new awt2swing.MenuItem ();\r
+this.sequenceName =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.edit_name_description"));\r
+this.sequenceFeature =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.create_sequence_feature"));\r
+this.editSequence =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.edit_sequence"));\r
+this.sequenceDetails =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sequence_details") + "...");\r
+this.selSeqDetails =  new awt2swing.MenuItem (jalview.util.MessageManager.getString ("label.sequence_details") + "...");\r
+this.makeReferenceSeq =  new awt2swing.MenuItem ();\r
+this.revealAll =  new awt2swing.MenuItem ();\r
+this.revealSeq =  new awt2swing.MenuItem ();\r
+this.menu1 =  new awt2swing.Menu ();\r
+});\r
+Clazz.makeConstructor (c$, \r
+function (apanel, seq, links) {\r
+Clazz.superConstructor (this, jalview.appletgui.APopupMenu, []);\r
+this.ap = apanel;\r
+this.seq = seq;\r
+try {\r
+this.jbInit ();\r
+} catch (e) {\r
+if (Clazz.exceptionOf (e, Exception)) {\r
+e.printStackTrace ();\r
+} else {\r
+throw e;\r
+}\r
+}\r
+for (var i = 0; i < jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS.length; i++) {\r
+var item =  new awt2swing.MenuItem (jalview.io.AppletFormatAdapter.WRITEABLE_FORMATS[i]);\r
+item.addActionListener (this);\r
+this.outputmenu.add (item);\r
+}\r
+this.buildAnnotationSubmenus ();\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg != null && sg.getSize () > 0) {\r
+this.editGroupName.setLabel (jalview.util.MessageManager.formatMessage ("label.name_param",  Clazz.newArray (-1, [sg.getName ()])));\r
+this.showText.setState (sg.getDisplayText ());\r
+this.showColourText.setState (sg.getColourText ());\r
+this.showBoxes.setState (sg.getDisplayBoxes ());\r
+this.displayNonconserved.setState (sg.getShowNonconserved ());\r
+if (!this.ap.av.getAlignment ().getGroups ().contains (sg)) {\r
+this.menu1.setLabel (jalview.util.MessageManager.getString ("action.edit_new_group"));\r
+this.groupMenu.remove (this.unGroupMenuItem);\r
+} else {\r
+this.menu1.setLabel (jalview.util.MessageManager.getString ("action.edit_group"));\r
+this.groupMenu.remove (this.createGroupMenuItem);\r
+}} else {\r
+this.remove (this.hideSeqs);\r
+this.remove (this.groupMenu);\r
+}if (links != null && links.size () > 0) {\r
+var linkMenu =  new awt2swing.Menu (jalview.util.MessageManager.getString ("action.link"));\r
+for (var i = 0; i < links.size (); i++) {\r
+var link = links.elementAt (i);\r
+var urlLink =  new jalview.util.UrlLink (link);\r
+if (!urlLink.isValid ()) {\r
+System.err.println (urlLink.getInvalidMessage ());\r
+continue;\r
+}var target = urlLink.getTarget ();\r
+var label = urlLink.getLabel ();\r
+if (seq != null && urlLink.isDynamic ()) {\r
+var dbr = jalview.util.DBRefUtils.selectRefs (seq.getDBRef (),  Clazz.newArray (-1, [target]));\r
+var id = seq.getName ();\r
+var descr = seq.getDescription ();\r
+if (descr != null && descr.length < 1) {\r
+descr = null;\r
+}if (dbr != null) {\r
+for (var r = 0; r < dbr.length; r++) {\r
+if (id != null && dbr[r].getAccessionId ().equals (id)) {\r
+id = null;\r
+}var urls = urlLink.makeUrls (dbr[r].getAccessionId (), true);\r
+if (urls != null) {\r
+for (var u = 0; u < urls.length; u += 2) {\r
+this.addshowLink (linkMenu, label + "|" + urls[u], urls[u + 1]);\r
+}\r
+}}\r
+}if (id != null) {\r
+var urls = urlLink.makeUrls (id, true);\r
+if (urls != null) {\r
+for (var u = 0; u < urls.length; u += 2) {\r
+this.addshowLink (linkMenu, label, urls[u + 1]);\r
+}\r
+}}if (descr != null && urlLink.getRegexReplace () != null) {\r
+var urls = urlLink.makeUrls (descr, true);\r
+if (urls != null) {\r
+for (var u = 0; u < urls.length; u += 2) {\r
+this.addshowLink (linkMenu, label, urls[u + 1]);\r
+}\r
+}}} else {\r
+this.addshowLink (linkMenu, target, urlLink.getUrl_prefix ());\r
+}}\r
+if (linkMenu.getItemCount () > 0) {\r
+if (seq != null) {\r
+this.seqMenu.add (linkMenu);\r
+} else {\r
+this.add (linkMenu);\r
+}}}if (seq != null) {\r
+this.seqMenu.setLabel (seq.getName ());\r
+if (seq === this.ap.av.getAlignment ().getSeqrep ()) {\r
+this.makeReferenceSeq.setLabel (jalview.util.MessageManager.getString ("action.unmark_as_reference"));\r
+} else {\r
+this.makeReferenceSeq.setLabel (jalview.util.MessageManager.getString ("action.set_as_reference"));\r
+}this.repGroup.setLabel (jalview.util.MessageManager.formatMessage ("label.represent_group_with",  Clazz.newArray (-1, [seq.getName ()])));\r
+} else {\r
+this.remove (this.seqMenu);\r
+}if (!this.ap.av.hasHiddenRows ()) {\r
+this.remove (this.revealAll);\r
+this.remove (this.revealSeq);\r
+} else {\r
+var index = this.ap.av.getAlignment ().findIndex (seq);\r
+if (this.ap.av.adjustForHiddenSeqs (index) - this.ap.av.adjustForHiddenSeqs (index - 1) > 1) {\r
+this.revealSeq_index = index;\r
+} else {\r
+this.remove (this.revealSeq);\r
+}}}, "jalview.appletgui.AlignmentPanel,jalview.datamodel.SequenceI,java.util.Vector");\r
+Clazz.defineMethod (c$, "buildAnnotationSubmenus", \r
+($fz = function () {\r
+var selectedSequence = (this.seq == null ? java.util.Collections.emptyList () : java.util.Arrays.asList ([this.seq]));\r
+this.buildAnnotationTypesMenus (this.seqShowAnnotationsMenu, this.seqHideAnnotationsMenu, selectedSequence);\r
+this.configureReferenceAnnotationsMenu (this.seqAddReferenceAnnotations, selectedSequence);\r
+var selectedGroup = (this.ap.av.getSelectionGroup () == null ? java.util.Collections.emptyList () : this.ap.av.getSelectionGroup ().getSequences ());\r
+this.buildAnnotationTypesMenus (this.groupShowAnnotationsMenu, this.groupHideAnnotationsMenu, selectedGroup);\r
+this.configureReferenceAnnotationsMenu (this.groupAddReferenceAnnotations, selectedGroup);\r
+}, $fz.isPrivate = true, $fz));\r
+Clazz.defineMethod (c$, "configureReferenceAnnotationsMenu", \r
+($fz = function (menuItem, forSequences) {\r
+menuItem.setEnabled (false);\r
+var tipEntries =  new java.util.TreeMap ();\r
+var candidates =  new java.util.LinkedHashMap ();\r
+var al = this.ap.av.getAlignment ();\r
+jalview.analysis.AlignmentUtils.findAddableReferenceAnnotations (forSequences, tipEntries, candidates, al);\r
+if (!candidates.isEmpty ()) {\r
+var tooltip =  new StringBuilder (64);\r
+tooltip.append (jalview.util.MessageManager.getString ("label.add_annotations_for"));\r
+menuItem.setEnabled (true);\r
+menuItem.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$1") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$1$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$1, this, Clazz.cloneFinals ("candidates", candidates))));\r
+}}, $fz.isPrivate = true, $fz), "awt2swing.MenuItem,java.util.List");\r
+Clazz.defineMethod (c$, "addReferenceAnnotations_actionPerformed", \r
+function (candidates) {\r
+var selectionGroup = this.ap.av.getSelectionGroup ();\r
+var alignment = this.ap.getAlignment ();\r
+jalview.analysis.AlignmentUtils.addReferenceAnnotations (candidates, alignment, selectionGroup);\r
+this.refresh ();\r
+}, "java.util.Map");\r
+Clazz.defineMethod (c$, "addshowLink", \r
+($fz = function (linkMenu, target, url) {\r
+this.addshowLink (linkMenu, target, target, url);\r
+}, $fz.isPrivate = true, $fz), "awt2swing.Menu,~S,~S");\r
+Clazz.defineMethod (c$, "addshowLink", \r
+($fz = function (linkMenu, target, label, url) {\r
+var item =  new awt2swing.MenuItem (label);\r
+item.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$2") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$2$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$2, this, Clazz.cloneFinals ("url", url, "target", target))));\r
+linkMenu.add (item);\r
+}, $fz.isPrivate = true, $fz), "awt2swing.Menu,~S,~S,~S");\r
+Clazz.overrideMethod (c$, "itemStateChanged", \r
+function (evt) {\r
+if (evt.getSource () === this.abovePIDColour) {\r
+this.abovePIDColour_itemStateChanged ();\r
+} else if (evt.getSource () === this.showColourText) {\r
+this.showColourText_itemStateChanged ();\r
+} else if (evt.getSource () === this.showText) {\r
+this.showText_itemStateChanged ();\r
+} else if (evt.getSource () === this.showBoxes) {\r
+this.showBoxes_itemStateChanged ();\r
+} else if (evt.getSource () === this.displayNonconserved) {\r
+this.showNonconserved_itemStateChanged ();\r
+}}, "java.awt.event.ItemEvent");\r
+Clazz.overrideMethod (c$, "actionPerformed", \r
+function (evt) {\r
+var source = evt.getSource ();\r
+if (source === this.clustalColour) {\r
+this.clustalColour_actionPerformed ();\r
+} else if (source === this.zappoColour) {\r
+this.zappoColour_actionPerformed ();\r
+} else if (source === this.taylorColour) {\r
+this.taylorColour_actionPerformed ();\r
+} else if (source === this.hydrophobicityColour) {\r
+this.hydrophobicityColour_actionPerformed ();\r
+} else if (source === this.helixColour) {\r
+this.helixColour_actionPerformed ();\r
+} else if (source === this.strandColour) {\r
+this.strandColour_actionPerformed ();\r
+} else if (source === this.turnColour) {\r
+this.turnColour_actionPerformed ();\r
+} else if (source === this.buriedColour) {\r
+this.buriedColour_actionPerformed ();\r
+} else if (source === this.nucleotideMenuItem) {\r
+this.nucleotideMenuItem_actionPerformed ();\r
+} else if (source === this.userDefinedColour) {\r
+this.userDefinedColour_actionPerformed ();\r
+} else if (source === this.PIDColour) {\r
+this.PIDColour_actionPerformed ();\r
+} else if (source === this.BLOSUM62Colour) {\r
+this.BLOSUM62Colour_actionPerformed ();\r
+} else if (source === this.noColourmenuItem) {\r
+this.noColourmenuItem_actionPerformed ();\r
+} else if (source === this.conservationMenuItem) {\r
+this.conservationMenuItem_itemStateChanged ();\r
+} else if (source === this.unGroupMenuItem) {\r
+this.unGroupMenuItem_actionPerformed ();\r
+} else if (source === this.createGroupMenuItem) {\r
+this.createGroupMenuItem_actionPerformed ();\r
+} else if (source === this.sequenceName) {\r
+this.editName ();\r
+} else if (source === this.makeReferenceSeq) {\r
+this.makeReferenceSeq_actionPerformed ();\r
+} else if (source === this.sequenceDetails) {\r
+this.showSequenceDetails ();\r
+} else if (source === this.selSeqDetails) {\r
+this.showSequenceSelectionDetails ();\r
+} else if (source === this.pdb) {\r
+this.addPDB ();\r
+} else if (source === this.hideSeqs) {\r
+this.hideSequences (false);\r
+} else if (source === this.repGroup) {\r
+this.hideSequences (true);\r
+} else if (source === this.revealSeq) {\r
+this.ap.av.showSequence (this.revealSeq_index);\r
+} else if (source === this.revealAll) {\r
+this.ap.av.showAllHiddenSeqs ();\r
+} else if (source === this.editGroupName) {\r
+var dialog =  new jalview.appletgui.EditNameDialog (this.getGroup ().getName (), this.getGroup ().getDescription (), "       Group Name", "Group Description", this.ap.alignFrame, "Edit Group Name / Description", 500, 100, true);\r
+if (dialog.accept) {\r
+this.getGroup ().setName (dialog.getName ().$replace (' ', '_'));\r
+this.getGroup ().setDescription (dialog.getDescription ());\r
+}} else if (source === this.copy) {\r
+this.ap.alignFrame.copy_actionPerformed ();\r
+} else if (source === this.cut) {\r
+this.ap.alignFrame.cut_actionPerformed ();\r
+} else if (source === this.editSequence) {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg != null) {\r
+if (this.seq == null) {\r
+this.seq = sg.getSequenceAt (0);\r
+}var dialog =  new jalview.appletgui.EditNameDialog (this.seq.getSequenceAsString (sg.getStartRes (), sg.getEndRes () + 1), null, "Edit Sequence ", null, this.ap.alignFrame, "Edit Sequence", 500, 100, true);\r
+if (dialog.accept) {\r
+var editCommand =  new jalview.commands.EditCommand (jalview.util.MessageManager.getString ("label.edit_sequences"), jalview.commands.EditCommand.Action.REPLACE, dialog.getName ().$replace (' ', this.ap.av.getGapCharacter ()), sg.getSequencesAsArray (this.ap.av.getHiddenRepSequences ()), sg.getStartRes (), sg.getEndRes () + 1, this.ap.av.getAlignment ());\r
+this.ap.alignFrame.addHistoryItem (editCommand);\r
+this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ());\r
+}}} else if (source === this.toUpper || source === this.toLower || source === this.toggleCase) {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg != null) {\r
+var startEnd = this.ap.av.getVisibleRegionBoundaries (sg.getStartRes (), sg.getEndRes () + 1);\r
+var description;\r
+var caseChange;\r
+if (source === this.toggleCase) {\r
+description = "Toggle Case";\r
+caseChange = jalview.commands.ChangeCaseCommand.TOGGLE_CASE;\r
+} else if (source === this.toUpper) {\r
+description = "To Upper Case";\r
+caseChange = jalview.commands.ChangeCaseCommand.TO_UPPER;\r
+} else {\r
+description = "To Lower Case";\r
+caseChange = jalview.commands.ChangeCaseCommand.TO_LOWER;\r
+}var caseCommand =  new jalview.commands.ChangeCaseCommand (description, sg.getSequencesAsArray (this.ap.av.getHiddenRepSequences ()), startEnd, caseChange);\r
+this.ap.alignFrame.addHistoryItem (caseCommand);\r
+this.ap.av.firePropertyChange ("alignment", null, this.ap.av.getAlignment ().getSequences ());\r
+}} else if (source === this.sequenceFeature) {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg == null) {\r
+return;\r
+}var rsize = 0;\r
+var gSize = sg.getSize ();\r
+var rseqs;\r
+var seqs =  new Array (gSize);\r
+var tfeatures;\r
+var features =  new Array (gSize);\r
+for (var i = 0; i < gSize; i++) {\r
+var start = sg.getSequenceAt (i).findPosition (sg.getStartRes ());\r
+var end = sg.findEndRes (sg.getSequenceAt (i));\r
+if (start <= end) {\r
+seqs[rsize] = sg.getSequenceAt (i);\r
+features[rsize] =  new jalview.datamodel.SequenceFeature (null, null, null, start, end, "Jalview");\r
+rsize++;\r
+}}\r
+rseqs =  new Array (rsize);\r
+tfeatures =  new Array (rsize);\r
+System.arraycopy (seqs, 0, rseqs, 0, rsize);\r
+System.arraycopy (features, 0, tfeatures, 0, rsize);\r
+features = tfeatures;\r
+seqs = rseqs;\r
+if (this.ap.seqPanel.seqCanvas.getFeatureRenderer ().amendFeatures (seqs, features, true, this.ap)) {\r
+this.ap.alignFrame.sequenceFeatures.setState (true);\r
+this.ap.av.setShowSequenceFeatures (true);\r
+;this.ap.highlightSearchResults (null);\r
+}} else {\r
+this.outputText (evt);\r
+}}, "java.awt.event.ActionEvent");\r
+Clazz.defineMethod (c$, "outputText", \r
+function (e) {\r
+var cap =  new jalview.appletgui.CutAndPasteTransfer (true, this.ap.alignFrame);\r
+var frame =  new awt2swing.Frame ();\r
+frame.add (cap);\r
+jalview.bin.JalviewLite.addFrame (frame, jalview.util.MessageManager.formatMessage ("label.selection_output_command",  Clazz.newArray (-1, [e.getActionCommand ()])), 600, 500);\r
+cap.setText ( new jalview.io.AppletFormatAdapter ().formatSequences (e.getActionCommand (), this.ap.av.getShowJVSuffix (), this.ap, true));\r
+}, "java.awt.event.ActionEvent");\r
+Clazz.defineMethod (c$, "showSequenceSelectionDetails", \r
+function () {\r
+this.createSequenceDetailsReport (this.ap.av.getSequenceSelection ());\r
+});\r
+Clazz.defineMethod (c$, "showSequenceDetails", \r
+function () {\r
+this.createSequenceDetailsReport ( Clazz.newArray (-1, [this.seq]));\r
+});\r
+Clazz.defineMethod (c$, "createSequenceDetailsReport", \r
+function (sequences) {\r
+var cap =  new jalview.appletgui.CutAndPasteTransfer (false, this.ap.alignFrame);\r
+var contents =  new StringBuffer ();\r
+for (var seq, $seq = 0, $$seq = sequences; $seq < $$seq.length && ((seq = $$seq[$seq]) || true); $seq++) {\r
+contents.append (jalview.util.MessageManager.formatMessage ("label.annotation_for_displayid",  Clazz.newArray (-1, [seq.getDisplayId (true)])));\r
+ new jalview.io.SequenceAnnotationReport (null).createSequenceAnnotationReport (contents, seq, true, true, false, (this.ap.seqPanel.seqCanvas.fr != null) ? this.ap.seqPanel.seqCanvas.fr.getMinMax () : null);\r
+contents.append ("</p>");\r
+}\r
+var frame =  new awt2swing.Frame ();\r
+frame.add (cap);\r
+jalview.bin.JalviewLite.addFrame (frame, "Sequence Details for " + (sequences.length == 1 ? sequences[0].getDisplayId (true) : "Selection"), 600, 500);\r
+cap.setText (jalview.util.MessageManager.formatMessage ("label.html_content",  Clazz.newArray (-1, [contents.toString ()])));\r
+}, "~A");\r
+Clazz.defineMethod (c$, "editName", \r
+function () {\r
+var dialog =  new jalview.appletgui.EditNameDialog (this.seq.getName (), this.seq.getDescription (), "       Sequence Name", "Sequence Description", this.ap.alignFrame, "Edit Sequence Name / Description", 500, 100, true);\r
+if (dialog.accept) {\r
+this.seq.setName (dialog.getName ());\r
+this.seq.setDescription (dialog.getDescription ());\r
+this.ap.paintAlignment (false);\r
+}});\r
+Clazz.defineMethod (c$, "addPDB", \r
+function () {\r
+if (this.seq.getPDBId () != null) {\r
+var entry = this.seq.getPDBId ().firstElement ();\r
+if (this.ap.av.applet.jmolAvailable) {\r
+ new jalview.appletgui.AppletJmol (entry,  Clazz.newArray (-1, [this.seq]), null, this.ap, jalview.io.AppletFormatAdapter.URL);\r
+}} else {\r
+var cap =  new jalview.appletgui.CutAndPasteTransfer (true, this.ap.alignFrame);\r
+cap.setText (jalview.util.MessageManager.getString ("label.paste_pdb_file"));\r
+cap.setPDBImport (this.seq);\r
+var frame =  new awt2swing.Frame ();\r
+frame.add (cap);\r
+jalview.bin.JalviewLite.addFrame (frame, jalview.util.MessageManager.formatMessage ("label.paste_pdb_file_for_sequence",  Clazz.newArray (-1, [this.seq.getName ()])), 400, 300);\r
+}});\r
+Clazz.defineMethod (c$, "jbInit", \r
+($fz = function () {\r
+this.groupMenu.setLabel (jalview.util.MessageManager.getString ("label.selection"));\r
+this.sequenceFeature.addActionListener (this);\r
+this.editGroupName.addActionListener (this);\r
+this.unGroupMenuItem.setLabel (jalview.util.MessageManager.getString ("action.remove_group"));\r
+this.unGroupMenuItem.addActionListener (this);\r
+this.createGroupMenuItem.setLabel (jalview.util.MessageManager.getString ("action.create_group"));\r
+this.createGroupMenuItem.addActionListener (this);\r
+this.nucleotideMenuItem.setLabel (jalview.util.MessageManager.getString ("label.nucleotide"));\r
+this.nucleotideMenuItem.addActionListener (this);\r
+this.conservationMenuItem.addItemListener (this);\r
+this.abovePIDColour.addItemListener (this);\r
+this.colourMenu.setLabel (jalview.util.MessageManager.getString ("label.group_colour"));\r
+this.showBoxes.setLabel (jalview.util.MessageManager.getString ("action.boxes"));\r
+this.showBoxes.setState (true);\r
+this.showBoxes.addItemListener (this);\r
+this.sequenceName.addActionListener (this);\r
+this.sequenceDetails.addActionListener (this);\r
+this.selSeqDetails.addActionListener (this);\r
+this.displayNonconserved.setLabel (jalview.util.MessageManager.getString ("label.show_non_conversed"));\r
+this.displayNonconserved.setState (false);\r
+this.displayNonconserved.addItemListener (this);\r
+this.showText.setLabel (jalview.util.MessageManager.getString ("action.text"));\r
+this.showText.addItemListener (this);\r
+this.showColourText.setLabel (jalview.util.MessageManager.getString ("label.colour_text"));\r
+this.showColourText.addItemListener (this);\r
+this.outputmenu.setLabel (jalview.util.MessageManager.getString ("label.out_to_textbox"));\r
+this.seqMenu.setLabel (jalview.util.MessageManager.getString ("label.sequence"));\r
+this.pdb.setLabel (jalview.util.MessageManager.getString ("label.view_pdb_structure"));\r
+this.hideSeqs.setLabel (jalview.util.MessageManager.getString ("action.hide_sequences"));\r
+this.repGroup.setLabel (jalview.util.MessageManager.formatMessage ("label.represent_group_with",  Clazz.newArray (-1, [""])));\r
+this.revealAll.setLabel (jalview.util.MessageManager.getString ("action.reveal_all"));\r
+this.revealSeq.setLabel (jalview.util.MessageManager.getString ("action.reveal_sequences"));\r
+this.menu1.setLabel (jalview.util.MessageManager.getString ("label.group") + ":");\r
+this.add (this.groupMenu);\r
+this.add (this.seqMenu);\r
+this.add (this.hideSeqs);\r
+this.add (this.revealSeq);\r
+this.add (this.revealAll);\r
+this.groupMenu.add (this.groupShowAnnotationsMenu);\r
+this.groupMenu.add (this.groupHideAnnotationsMenu);\r
+this.groupMenu.add (this.groupAddReferenceAnnotations);\r
+this.groupMenu.add (this.editMenu);\r
+this.groupMenu.add (this.outputmenu);\r
+this.groupMenu.add (this.sequenceFeature);\r
+this.groupMenu.add (this.createGroupMenuItem);\r
+this.groupMenu.add (this.unGroupMenuItem);\r
+this.groupMenu.add (this.menu1);\r
+this.colourMenu.add (this.noColourmenuItem);\r
+this.colourMenu.add (this.clustalColour);\r
+this.colourMenu.add (this.BLOSUM62Colour);\r
+this.colourMenu.add (this.PIDColour);\r
+this.colourMenu.add (this.zappoColour);\r
+this.colourMenu.add (this.taylorColour);\r
+this.colourMenu.add (this.hydrophobicityColour);\r
+this.colourMenu.add (this.helixColour);\r
+this.colourMenu.add (this.strandColour);\r
+this.colourMenu.add (this.turnColour);\r
+this.colourMenu.add (this.buriedColour);\r
+this.colourMenu.add (this.nucleotideMenuItem);\r
+this.colourMenu.add (this.userDefinedColour);\r
+this.colourMenu.addSeparator ();\r
+this.colourMenu.add (this.abovePIDColour);\r
+this.colourMenu.add (this.conservationMenuItem);\r
+this.noColourmenuItem.setLabel (jalview.util.MessageManager.getString ("label.none"));\r
+this.noColourmenuItem.addActionListener (this);\r
+this.clustalColour.setLabel (jalview.util.MessageManager.getString ("label.clustalx_colours"));\r
+this.clustalColour.addActionListener (this);\r
+this.zappoColour.setLabel (jalview.util.MessageManager.getString ("label.zappo"));\r
+this.zappoColour.addActionListener (this);\r
+this.taylorColour.setLabel (jalview.util.MessageManager.getString ("label.taylor"));\r
+this.taylorColour.addActionListener (this);\r
+this.hydrophobicityColour.setLabel (jalview.util.MessageManager.getString ("label.hydrophobicity"));\r
+this.hydrophobicityColour.addActionListener (this);\r
+this.helixColour.setLabel (jalview.util.MessageManager.getString ("label.helix_propensity"));\r
+this.helixColour.addActionListener (this);\r
+this.strandColour.setLabel (jalview.util.MessageManager.getString ("label.strand_propensity"));\r
+this.strandColour.addActionListener (this);\r
+this.turnColour.setLabel (jalview.util.MessageManager.getString ("label.turn_propensity"));\r
+this.turnColour.addActionListener (this);\r
+this.buriedColour.setLabel (jalview.util.MessageManager.getString ("label.buried_index"));\r
+this.buriedColour.addActionListener (this);\r
+this.abovePIDColour.setLabel (jalview.util.MessageManager.getString ("label.above_identity_percentage"));\r
+this.userDefinedColour.setLabel (jalview.util.MessageManager.getString ("action.user_defined"));\r
+this.userDefinedColour.addActionListener (this);\r
+this.PIDColour.setLabel (jalview.util.MessageManager.getString ("action.percentage_identity"));\r
+this.PIDColour.addActionListener (this);\r
+this.BLOSUM62Colour.setLabel ("BLOSUM62");\r
+this.BLOSUM62Colour.addActionListener (this);\r
+this.conservationMenuItem.setLabel (jalview.util.MessageManager.getString ("label.conservation"));\r
+this.editMenu.add (this.copy);\r
+this.copy.addActionListener (this);\r
+this.editMenu.add (this.cut);\r
+this.cut.addActionListener (this);\r
+this.editMenu.add (this.editSequence);\r
+this.editSequence.addActionListener (this);\r
+this.editMenu.add (this.toUpper);\r
+this.toUpper.addActionListener (this);\r
+this.editMenu.add (this.toLower);\r
+this.toLower.addActionListener (this);\r
+this.editMenu.add (this.toggleCase);\r
+this.seqMenu.add (this.seqShowAnnotationsMenu);\r
+this.seqMenu.add (this.seqHideAnnotationsMenu);\r
+this.seqMenu.add (this.seqAddReferenceAnnotations);\r
+this.seqMenu.add (this.sequenceName);\r
+this.seqMenu.add (this.makeReferenceSeq);\r
+if (!this.ap.av.applet.useXtrnalSviewer) {\r
+this.seqMenu.add (this.pdb);\r
+}this.seqMenu.add (this.repGroup);\r
+this.menu1.add (this.editGroupName);\r
+this.menu1.add (this.colourMenu);\r
+this.menu1.add (this.showBoxes);\r
+this.menu1.add (this.showText);\r
+this.menu1.add (this.showColourText);\r
+this.menu1.add (this.displayNonconserved);\r
+this.toggleCase.addActionListener (this);\r
+this.pdb.addActionListener (this);\r
+this.hideSeqs.addActionListener (this);\r
+this.repGroup.addActionListener (this);\r
+this.revealAll.addActionListener (this);\r
+this.revealSeq.addActionListener (this);\r
+this.makeReferenceSeq.addActionListener (this);\r
+}, $fz.isPrivate = true, $fz));\r
+Clazz.defineMethod (c$, "refresh", \r
+function () {\r
+this.ap.paintAlignment (true);\r
+});\r
+Clazz.defineMethod (c$, "clustalColour_actionPerformed", \r
+function () {\r
+var sg = this.getGroup ();\r
+sg.cs =  new jalview.schemes.ClustalxColourScheme (sg, this.ap.av.getHiddenRepSequences ());\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "zappoColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.ZappoColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "taylorColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.TaylorColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "hydrophobicityColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.HydrophobicColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "helixColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.HelixColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "strandColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.StrandColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "turnColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.TurnColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "buriedColour_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.BuriedColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "nucleotideMenuItem_actionPerformed", \r
+function () {\r
+this.getGroup ().cs =  new jalview.schemes.NucleotideColourScheme ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "abovePIDColour_itemStateChanged", \r
+function () {\r
+var sg = this.getGroup ();\r
+if (sg.cs == null) {\r
+return;\r
+}if (this.abovePIDColour.getState ()) {\r
+sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));\r
+var threshold = jalview.appletgui.SliderPanel.setPIDSliderSource (this.ap, sg.cs, this.getGroup ().getName ());\r
+sg.cs.setThreshold (threshold, this.ap.av.isIgnoreGapsConsensus ());\r
+jalview.appletgui.SliderPanel.showPIDSlider ();\r
+} else {\r
+sg.cs.setThreshold (0, this.ap.av.isIgnoreGapsConsensus ());\r
+}this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "userDefinedColour_actionPerformed", \r
+function () {\r
+ new jalview.appletgui.UserDefinedColours (this.ap, this.getGroup ());\r
+});\r
+Clazz.defineMethod (c$, "PIDColour_actionPerformed", \r
+function () {\r
+var sg = this.getGroup ();\r
+sg.cs =  new jalview.schemes.PIDColourScheme ();\r
+sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "BLOSUM62Colour_actionPerformed", \r
+function () {\r
+var sg = this.getGroup ();\r
+sg.cs =  new jalview.schemes.Blosum62ColourScheme ();\r
+sg.cs.setConsensus (jalview.analysis.AAFrequency.calculate (sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth ()));\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "noColourmenuItem_actionPerformed", \r
+function () {\r
+this.getGroup ().cs = null;\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "conservationMenuItem_itemStateChanged", \r
+function () {\r
+var sg = this.getGroup ();\r
+if (sg.cs == null) {\r
+return;\r
+}if (this.conservationMenuItem.getState ()) {\r
+sg.cs.setConservation (jalview.analysis.Conservation.calculateConservation ("Group", jalview.schemes.ResidueProperties.propHash, 3, sg.getSequences (this.ap.av.getHiddenRepSequences ()), 0, this.ap.av.getAlignment ().getWidth (), false, this.ap.av.getConsPercGaps (), false));\r
+jalview.appletgui.SliderPanel.setConservationSlider (this.ap, sg.cs, sg.getName ());\r
+jalview.appletgui.SliderPanel.showConservationSlider ();\r
+} else {\r
+sg.cs.setConservation (null);\r
+}this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "getGroup", \r
+function () {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg != null) {\r
+this.ap.av.getAlignment ().addGroup (sg);\r
+}return sg;\r
+});\r
+Clazz.defineMethod (c$, "unGroupMenuItem_actionPerformed", \r
+function () {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+this.ap.av.getAlignment ().deleteGroup (sg);\r
+this.ap.av.setSelectionGroup (null);\r
+this.ap.paintAlignment (true);\r
+});\r
+Clazz.defineMethod (c$, "createGroupMenuItem_actionPerformed", \r
+function () {\r
+this.getGroup ();\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "showColourText_itemStateChanged", \r
+function () {\r
+this.getGroup ().setColourText (this.showColourText.getState ());\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "showText_itemStateChanged", \r
+function () {\r
+this.getGroup ().setDisplayText (this.showText.getState ());\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "makeReferenceSeq_actionPerformed", \r
+function () {\r
+if (!this.ap.av.getAlignment ().hasSeqrep ()) {\r
+this.ap.av.setDisplayReferenceSeq (true);\r
+this.ap.av.setColourByReferenceSeq (true);\r
+this.ap.av.getAlignment ().setSeqrep (this.seq);\r
+} else {\r
+if (this.ap.av.getAlignment ().getSeqrep () === this.seq) {\r
+this.ap.av.getAlignment ().setSeqrep (null);\r
+} else {\r
+this.ap.av.getAlignment ().setSeqrep (this.seq);\r
+}}this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "showNonconserved_itemStateChanged", \r
+function () {\r
+this.getGroup ().setShowNonconserved (this.displayNonconserved.getState ());\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "showBoxes_itemStateChanged", \r
+function () {\r
+this.getGroup ().setDisplayBoxes (this.showBoxes.getState ());\r
+this.refresh ();\r
+});\r
+Clazz.defineMethod (c$, "hideSequences", \r
+function (representGroup) {\r
+var sg = this.ap.av.getSelectionGroup ();\r
+if (sg == null || sg.getSize () < 1) {\r
+this.ap.av.hideSequence ( Clazz.newArray (-1, [this.seq]));\r
+return;\r
+}this.ap.av.setSelectionGroup (null);\r
+if (representGroup) {\r
+this.ap.av.hideRepSequences (this.seq, sg);\r
+return;\r
+}var gsize = sg.getSize ();\r
+var hseqs;\r
+hseqs =  new Array (gsize);\r
+var index = 0;\r
+for (var i = 0; i < gsize; i++) {\r
+hseqs[index++] = sg.getSequenceAt (i);\r
+}\r
+this.ap.av.hideSequence (hseqs);\r
+this.ap.av.sendSelection ();\r
+}, "~B");\r
+Clazz.defineMethod (c$, "buildAnnotationTypesMenus", \r
+function (showMenu, hideMenu, forSequences) {\r
+showMenu.removeAll ();\r
+hideMenu.removeAll ();\r
+var all = java.util.Arrays.asList (["All"]);\r
+this.addAnnotationTypeToShowHide (showMenu, forSequences, "", all, true, true);\r
+this.addAnnotationTypeToShowHide (hideMenu, forSequences, "", all, true, false);\r
+showMenu.addSeparator ();\r
+hideMenu.addSeparator ();\r
+var annotations = this.ap.getAlignment ().getAlignmentAnnotation ();\r
+var shownTypes =  new java.util.LinkedHashMap ();\r
+var hiddenTypes =  new java.util.LinkedHashMap ();\r
+jalview.analysis.AlignmentAnnotationUtils.getShownHiddenTypes (shownTypes, hiddenTypes, jalview.analysis.AlignmentAnnotationUtils.asList (annotations), forSequences);\r
+for (var calcId, $calcId = hiddenTypes.keySet ().iterator (); $calcId.hasNext () && ((calcId = $calcId.next ()) || true);) {\r
+for (var type, $type = hiddenTypes.get (calcId).iterator (); $type.hasNext () && ((type = $type.next ()) || true);) {\r
+this.addAnnotationTypeToShowHide (showMenu, forSequences, calcId, type, false, true);\r
+}\r
+}\r
+showMenu.setEnabled (!hiddenTypes.isEmpty ());\r
+for (var calcId, $calcId = shownTypes.keySet ().iterator (); $calcId.hasNext () && ((calcId = $calcId.next ()) || true);) {\r
+for (var type, $type = shownTypes.get (calcId).iterator (); $type.hasNext () && ((type = $type.next ()) || true);) {\r
+this.addAnnotationTypeToShowHide (hideMenu, forSequences, calcId, type, false, false);\r
+}\r
+}\r
+hideMenu.setEnabled (!shownTypes.isEmpty ());\r
+}, "awt2swing.Menu,awt2swing.Menu,java.util.List");\r
+Clazz.defineMethod (c$, "addAnnotationTypeToShowHide", \r
+function (showOrHideMenu, forSequences, calcId, types, allTypes, actionIsShow) {\r
+var label = types.toString ();\r
+label = label.substring (1, label.length - 1);\r
+var item =  new awt2swing.MenuItem (label);\r
+item.addActionListener (((Clazz.isClassDefined ("jalview.appletgui.APopupMenu$3") ? 0 : jalview.appletgui.APopupMenu.$APopupMenu$3$ ()), Clazz.innerTypeInstance (jalview.appletgui.APopupMenu$3, this, Clazz.cloneFinals ("types", types, "forSequences", forSequences, "allTypes", allTypes, "actionIsShow", actionIsShow))));\r
+showOrHideMenu.add (item);\r
+}, "awt2swing.Menu,java.util.List,~S,java.util.List,~B,~B");\r
+c$.$APopupMenu$1$ = function () {\r
+Clazz.pu$h ();\r
+c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$1", null, java.awt.event.ActionListener);\r
+Clazz.overrideMethod (c$, "actionPerformed", \r
+function (e) {\r
+this.b$["jalview.appletgui.APopupMenu"].addReferenceAnnotations_actionPerformed (this.f$.candidates);\r
+}, "java.awt.event.ActionEvent");\r
+c$ = Clazz.p0p ();\r
+};\r
+c$.$APopupMenu$2$ = function () {\r
+Clazz.pu$h ();\r
+c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$2", null, java.awt.event.ActionListener);\r
+Clazz.overrideMethod (c$, "actionPerformed", \r
+function (e) {\r
+this.b$["jalview.appletgui.APopupMenu"].ap.alignFrame.showURL (this.f$.url, this.f$.target);\r
+}, "java.awt.event.ActionEvent");\r
+c$ = Clazz.p0p ();\r
+};\r
+c$.$APopupMenu$3$ = function () {\r
+Clazz.pu$h ();\r
+c$ = Clazz.declareAnonymous (jalview.appletgui, "APopupMenu$3", null, java.awt.event.ActionListener);\r
+Clazz.overrideMethod (c$, "actionPerformed", \r
+function (e) {\r
+jalview.analysis.AlignmentUtils.showOrHideSequenceAnnotations (this.b$["jalview.appletgui.APopupMenu"].ap.getAlignment (), this.f$.types, this.f$.forSequences, this.f$.allTypes, this.f$.actionIsShow);\r
+this.b$["jalview.appletgui.APopupMenu"].refresh ();\r
+}, "java.awt.event.ActionEvent");\r
+c$ = Clazz.p0p ();\r
+};\r
+Clazz.defineStatics (c$,\r
+"ALL_ANNOTATIONS", "All");\r
+});\r