X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fappletgui%2FAPopupMenu.js;h=81840b10f8dab6157969ff5bc581f80032ee5a6e;hp=6f1dc7455f9f4b8e132fc035306d5663e49fefef;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=8ffd05b3abe52c0b6b79b011c0966361f82d5fe6 diff --git a/site/j2s/jalview/appletgui/APopupMenu.js b/site/j2s/jalview/appletgui/APopupMenu.js index 6f1dc74..81840b1 100644 --- a/site/j2s/jalview/appletgui/APopupMenu.js +++ b/site/j2s/jalview/appletgui/APopupMenu.js @@ -1,797 +1,797 @@ -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", - 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); -}); -Clazz.defineMethod (c$, "configureReferenceAnnotationsMenu", - 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)))); -}}, "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", - function (linkMenu, target, url) { -this.addshowLink (linkMenu, target, target, url); -}, "awt2swing.Menu,~S,~S"); -Clazz.defineMethod (c$, "addshowLink", - 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); -}, "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 ("

"); -} -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", - 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); -}); -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(self.c$); -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(self.c$); -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(self.c$); -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"); +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", + 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); +}); +Clazz.defineMethod (c$, "configureReferenceAnnotationsMenu", + 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)))); +}}, "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", + function (linkMenu, target, url) { +this.addshowLink (linkMenu, target, target, url); +}, "awt2swing.Menu,~S,~S"); +Clazz.defineMethod (c$, "addshowLink", + 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); +}, "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 ("

"); +} +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", + 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); +}); +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(self.c$); +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(self.c$); +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(self.c$); +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"); +});