X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAPopupMenu.java;h=1d2feb24114fbc0d64f7003a2ce9ae57c4311289;hb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;hp=30f2e7f195ddee7e40f414454f385185cc15062b;hpb=619cc880371f3228e6a1fb33c6bfb6e7a7e2622c;p=jalview.git diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 30f2e7f..1d2feb2 100644 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -181,7 +181,7 @@ public class APopupMenu extends java.awt.PopupMenu implements MessageManager.getString("label.sequence_details")); MenuItem makeReferenceSeq = new MenuItem(); - + SequenceI seq; MenuItem revealAll = new MenuItem(); @@ -231,8 +231,7 @@ public class APopupMenu extends java.awt.PopupMenu implements if (sg != null && sg.getSize() > 0) { editGroupName.setLabel(MessageManager.formatMessage( - "label.name_param", new Object[] - { sg.getName() })); + "label.name_param", new Object[] { sg.getName() })); showText.setState(sg.getDisplayText()); showColourText.setState(sg.getColourText()); showBoxes.setState(sg.getDisplayBoxes()); @@ -275,8 +274,7 @@ public class APopupMenu extends java.awt.PopupMenu implements // collect matching db-refs DBRefEntry[] dbr = jalview.util.DBRefUtils.selectRefs( - seq.getDBRef(), new String[] - { target }); + seq.getDBRef(), new String[] { target }); // collect id string too String id = seq.getName(); String descr = seq.getDescription(); @@ -390,8 +388,7 @@ public class APopupMenu extends java.awt.PopupMenu implements .getString("action.set_as_reference")); // ); } repGroup.setLabel(MessageManager.formatMessage( - "label.represent_group_with", new Object[] - { seq.getName() })); + "label.represent_group_with", new Object[] { seq.getName() })); } else { @@ -720,7 +717,8 @@ public class APopupMenu extends java.awt.PopupMenu implements if (dialog.accept) { - EditCommand editCommand = new EditCommand(MessageManager.getString("label.edit_sequences"), + EditCommand editCommand = new EditCommand( + MessageManager.getString("label.edit_sequences"), Action.REPLACE, dialog.getName().replace(' ', ap.av.getGapCharacter()), sg.getSequencesAsArray(ap.av.getHiddenRepSequences()), @@ -807,7 +805,8 @@ public class APopupMenu extends java.awt.PopupMenu implements features, true, ap)) { ap.alignFrame.sequenceFeatures.setState(true); - ap.av.setShowSequenceFeatures(true);; + ap.av.setShowSequenceFeatures(true); + ; ap.highlightSearchResults(null); } } @@ -825,8 +824,8 @@ public class APopupMenu extends java.awt.PopupMenu implements Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.selection_output_command", new Object[] - { e.getActionCommand() }), 600, 500); + "label.selection_output_command", + new Object[] { e.getActionCommand() }), 600, 500); // JBPNote: getSelectionAsNewSequence behaviour has changed - this method // now returns a full copy of sequence data // TODO consider using getSequenceSelection instead here @@ -843,8 +842,7 @@ public class APopupMenu extends java.awt.PopupMenu implements protected void showSequenceDetails() { - createSequenceDetailsReport(new SequenceI[] - { seq }); + createSequenceDetailsReport(new SequenceI[] { seq }); } public void createSequenceDetailsReport(SequenceI[] sequences) @@ -856,17 +854,16 @@ public class APopupMenu extends java.awt.PopupMenu implements for (SequenceI seq : sequences) { contents.append(MessageManager.formatMessage( - "label.annotation_for_displayid", new Object[] - { seq.getDisplayId(true) })); - new SequenceAnnotationReport(null) - .createSequenceAnnotationReport( - contents, - seq, - true, - true, - false, - (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.getMinMax() - : null); + "label.annotation_for_displayid", + new Object[] { seq.getDisplayId(true) })); + new SequenceAnnotationReport(null).createSequenceAnnotationReport( + contents, + seq, + true, + true, + false, + (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr + .getMinMax() : null); contents.append("

"); } Frame frame = new Frame(); @@ -875,8 +872,7 @@ public class APopupMenu extends java.awt.PopupMenu implements + (sequences.length == 1 ? sequences[0].getDisplayId(true) : "Selection"), 600, 500); cap.setText(MessageManager.formatMessage("label.html_content", - new Object[] - { contents.toString() })); + new Object[] { contents.toString() })); } void editName() @@ -902,13 +898,13 @@ public class APopupMenu extends java.awt.PopupMenu implements if (ap.av.applet.jmolAvailable) { - new jalview.appletgui.AppletJmol(entry, new SequenceI[] - { seq }, null, ap, AppletFormatAdapter.URL); + new jalview.appletgui.AppletJmol(entry, new SequenceI[] { seq }, + null, ap, AppletFormatAdapter.URL); } else { - new MCview.AppletPDBViewer(entry, new SequenceI[] - { seq }, null, ap, AppletFormatAdapter.URL); + new MCview.AppletPDBViewer(entry, new SequenceI[] { seq }, null, + ap, AppletFormatAdapter.URL); } } @@ -920,8 +916,8 @@ public class APopupMenu extends java.awt.PopupMenu implements Frame frame = new Frame(); frame.add(cap); jalview.bin.JalviewLite.addFrame(frame, MessageManager.formatMessage( - "label.paste_pdb_file_for_sequence", new Object[] - { seq.getName() }), 400, 300); + "label.paste_pdb_file_for_sequence", + new Object[] { seq.getName() }), 400, 300); } } @@ -964,8 +960,7 @@ public class APopupMenu extends java.awt.PopupMenu implements pdb.setLabel(MessageManager.getString("label.view_pdb_structure")); hideSeqs.setLabel(MessageManager.getString("action.hide_sequences")); repGroup.setLabel(MessageManager.formatMessage( - "label.represent_group_with", new Object[] - { "" })); + "label.represent_group_with", new Object[] { "" })); revealAll.setLabel(MessageManager.getString("action.reveal_all")); revealSeq.setLabel(MessageManager.getString("action.reveal_sequences")); menu1.setLabel(MessageManager.getString("label.group") + ":"); @@ -1005,32 +1000,39 @@ public class APopupMenu extends java.awt.PopupMenu implements noColourmenuItem.setLabel(MessageManager.getString("label.none")); noColourmenuItem.addActionListener(this); - clustalColour.setLabel(MessageManager.getString("label.clustalx_colours")); + clustalColour.setLabel(MessageManager + .getString("label.clustalx_colours")); clustalColour.addActionListener(this); zappoColour.setLabel(MessageManager.getString("label.zappo")); zappoColour.addActionListener(this); taylorColour.setLabel(MessageManager.getString("label.taylor")); taylorColour.addActionListener(this); - hydrophobicityColour.setLabel(MessageManager.getString("label.hydrophobicity")); + hydrophobicityColour.setLabel(MessageManager + .getString("label.hydrophobicity")); hydrophobicityColour.addActionListener(this); - helixColour.setLabel(MessageManager.getString("label.helix_propensity")); + helixColour + .setLabel(MessageManager.getString("label.helix_propensity")); helixColour.addActionListener(this); - strandColour.setLabel(MessageManager.getString("label.strand_propensity")); + strandColour.setLabel(MessageManager + .getString("label.strand_propensity")); strandColour.addActionListener(this); turnColour.setLabel(MessageManager.getString("label.turn_propensity")); turnColour.addActionListener(this); buriedColour.setLabel(MessageManager.getString("label.buried_index")); buriedColour.addActionListener(this); - abovePIDColour.setLabel(MessageManager.getString("label.above_identity_percentage")); + abovePIDColour.setLabel(MessageManager + .getString("label.above_identity_percentage")); - userDefinedColour.setLabel(MessageManager.getString("action.user_defined")); + userDefinedColour.setLabel(MessageManager + .getString("action.user_defined")); userDefinedColour.addActionListener(this); PIDColour.setLabel(MessageManager .getString("label.percentage_identity")); PIDColour.addActionListener(this); BLOSUM62Colour.setLabel("BLOSUM62"); BLOSUM62Colour.addActionListener(this); - conservationMenuItem.setLabel(MessageManager.getString("label.conservation")); + conservationMenuItem.setLabel(MessageManager + .getString("label.conservation")); editMenu.add(copy); copy.addActionListener(this); @@ -1259,6 +1261,7 @@ public class APopupMenu extends java.awt.PopupMenu implements getGroup().setDisplayText(showText.getState()); refresh(); } + public void makeReferenceSeq_actionPerformed() { if (!ap.av.getAlignment().hasSeqrep()) @@ -1299,8 +1302,7 @@ public class APopupMenu extends java.awt.PopupMenu implements SequenceGroup sg = ap.av.getSelectionGroup(); if (sg == null || sg.getSize() < 1) { - ap.av.hideSequence(new SequenceI[] - { seq }); + ap.av.hideSequence(new SequenceI[] { seq }); return; } @@ -1348,17 +1350,17 @@ public class APopupMenu extends java.awt.PopupMenu implements { showMenu.removeAll(); hideMenu.removeAll(); - + final List all = Arrays.asList(ALL_ANNOTATIONS); addAnnotationTypeToShowHide(showMenu, forSequences, "", all, true, true); addAnnotationTypeToShowHide(hideMenu, forSequences, "", all, true, false); showMenu.addSeparator(); hideMenu.addSeparator(); - + final AlignmentAnnotation[] annotations = ap.getAlignment() .getAlignmentAnnotation(); - + /* * Find shown/hidden annotations types, distinguished by source (calcId), * and grouped by graphGroup. Using LinkedHashMap means we will retrieve in @@ -1367,28 +1369,26 @@ public class APopupMenu extends java.awt.PopupMenu implements */ Map>> shownTypes = new LinkedHashMap>>(); Map>> hiddenTypes = new LinkedHashMap>>(); - AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, - hiddenTypes, - AlignmentAnnotationUtils.asList(annotations), - forSequences); - + AlignmentAnnotationUtils.getShownHiddenTypes(shownTypes, hiddenTypes, + AlignmentAnnotationUtils.asList(annotations), forSequences); + for (String calcId : hiddenTypes.keySet()) { for (List type : hiddenTypes.get(calcId)) { - addAnnotationTypeToShowHide(showMenu, forSequences, - calcId, type, false, true); + addAnnotationTypeToShowHide(showMenu, forSequences, calcId, type, + false, true); } } // grey out 'show annotations' if none are hidden showMenu.setEnabled(!hiddenTypes.isEmpty()); - + for (String calcId : shownTypes.keySet()) { for (List type : shownTypes.get(calcId)) { - addAnnotationTypeToShowHide(hideMenu, forSequences, - calcId, type, false, false); + addAnnotationTypeToShowHide(hideMenu, forSequences, calcId, type, + false, false); } } // grey out 'hide annotations' if none are shown @@ -1425,8 +1425,8 @@ public class APopupMenu extends java.awt.PopupMenu implements @Override public void actionPerformed(ActionEvent e) { - AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(), types, - forSequences, allTypes, actionIsShow); + AlignmentUtils.showOrHideSequenceAnnotations(ap.getAlignment(), + types, forSequences, allTypes, actionIsShow); refresh(); } });