From 28c784ca383b0a81c4d0a8a31ee1456b40d4b152 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 31 Aug 2012 11:53:21 +0100 Subject: [PATCH] JAL-1015 equivalent menu items for applet - not visible at moment (need solution to JAL-1158 for exporting html from JalviewLite) --- src/jalview/appletgui/APopupMenu.java | 54 +++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index acdae46..fe1700b 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -28,6 +28,7 @@ import jalview.datamodel.*; import jalview.schemes.*; import jalview.util.UrlLink; import jalview.io.AppletFormatAdapter; +import jalview.io.SequenceAnnotationReport; public class APopupMenu extends java.awt.PopupMenu implements ActionListener, ItemListener @@ -107,7 +108,11 @@ public class APopupMenu extends java.awt.PopupMenu implements MenuItem sequenceFeature = new MenuItem("Create Sequence Feature"); MenuItem editSequence = new MenuItem("Edit Sequence"); + + MenuItem sequenceDetails = new MenuItem("Sequence Details ..."); + MenuItem selSeqDetails = new MenuItem("Sequence Details ..."); + Sequence seq; MenuItem revealAll = new MenuItem(); @@ -450,6 +455,14 @@ public class APopupMenu extends java.awt.PopupMenu implements { editName(); } + else if (source == sequenceDetails) + { + showSequenceDetails(); + } + else if (source == selSeqDetails) + { + showSequenceSelectionDetails(); + } else if (source == pdb) { addPDB(); @@ -608,6 +621,7 @@ public class APopupMenu extends java.awt.PopupMenu implements } + void outputText(ActionEvent e) { CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame); @@ -625,6 +639,41 @@ public class APopupMenu extends java.awt.PopupMenu implements ap.av.showJVSuffix)); } + protected void showSequenceSelectionDetails() + { + createSequenceDetailsReport(ap.av.getSequenceSelection()); + } + + protected void showSequenceDetails() + { + createSequenceDetailsReport(new SequenceI[]{seq}); + } + public void createSequenceDetailsReport(SequenceI[] sequences) + { + + CutAndPasteTransfer cap = new CutAndPasteTransfer(false, ap.alignFrame); + + StringBuffer contents = new StringBuffer(); + for (SequenceI seq:sequences) + { + contents.append("

Annotation for "+seq.getDisplayId(true)+"

"); + new SequenceAnnotationReport(null) + .createSequenceAnnotationReport( + contents, + seq, + true, + true,false, + (ap.seqPanel.seqCanvas.fr != null) ? ap.seqPanel.seqCanvas.fr.minmax + : null); + contents.append("

"); + } + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, + "Sequence Details for " + (sequences.length==1 ? sequences[0].getDisplayId(true) : "Selection") + , 600, 500); + cap.setText("" + contents.toString() + ""); + } void editName() { @@ -685,6 +734,8 @@ public class APopupMenu extends java.awt.PopupMenu implements showBoxes.setState(true); showBoxes.addItemListener(this); sequenceName.addActionListener(this); + sequenceDetails.addActionListener(this); + selSeqDetails.addActionListener(this); displayNonconserved.setLabel("Show Nonconserved"); displayNonconserved.setState(false); displayNonconserved.addItemListener(this); @@ -705,6 +756,7 @@ public class APopupMenu extends java.awt.PopupMenu implements this.add(hideSeqs); this.add(revealSeq); this.add(revealAll); + // groupMenu.add(selSeqDetails); groupMenu.add(editGroupName); groupMenu.add(editMenu); groupMenu.add(outputmenu); @@ -771,6 +823,8 @@ public class APopupMenu extends java.awt.PopupMenu implements toLower.addActionListener(this); editMenu.add(toggleCase); seqMenu.add(sequenceName); + // seqMenu.add(sequenceDetails); + if (!ap.av.applet.useXtrnalSviewer) { seqMenu.add(pdb); -- 1.7.10.2