X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FAPopupMenu.java;h=8488dd8ba6e955589e17f9970880494476aff8c2;hb=17fb03228f2fee0369a03b82d9bec86e80e71bf5;hp=858770a35ec187ca5849712d7b189fa046e988c6;hpb=29f89f52f3fc99e904a55e426c53a830290408cc;p=jalview.git diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java index 858770a..8488dd8 100755 --- a/src/jalview/appletgui/APopupMenu.java +++ b/src/jalview/appletgui/APopupMenu.java @@ -46,7 +46,7 @@ public class APopupMenu MenuItem noColourmenuItem = new MenuItem(); protected CheckboxMenuItem conservationMenuItem = new CheckboxMenuItem(); - AlignmentPanel ap; + final AlignmentPanel ap; MenuItem unGroupMenuItem = new MenuItem(); MenuItem nucleotideMenuItem = new MenuItem(); Menu colourMenu = new Menu(); @@ -54,7 +54,7 @@ public class APopupMenu CheckboxMenuItem showText = new CheckboxMenuItem(); CheckboxMenuItem showColourText = new CheckboxMenuItem(); - public APopupMenu(AlignmentPanel ap, Sequence seq, Vector links) + public APopupMenu(AlignmentPanel apanel, final Sequence seq, Vector links) { /////////////////////////////////////////////////////////// // If this is activated from the sequence panel, the user may want to @@ -63,7 +63,7 @@ public class APopupMenu // If from the IDPanel, we must display the sequence menu ////////////////////////////////////////////////////////// - this.ap = ap; + this.ap = apanel; try { @@ -97,23 +97,50 @@ public class APopupMenu link = links.elementAt(i).toString(); final String target = link.substring(0, link.indexOf("|")); item = new MenuItem(target); + String id = seq.getName(); + if(id.indexOf("|")>-1) + id = id.substring(id.lastIndexOf("|")+1); + final String url = link.substring(link.indexOf("|")+1, link.indexOf("$SEQUENCE_ID$")) - + seq.getName() + + + id + link.substring(link.indexOf("$SEQUENCE_ID$") + 13); item.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { - jalview.bin.JalviewLite.showURL(url, target); + ap.alignFrame.showURL(url, target); } }); linkMenu.add(item); } add(linkMenu); + + item = new MenuItem("Show PDB Structure"); + item.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + addPDB(seq); + } + }); + + add(item); + + } } + void addPDB(Sequence seq) + { + CutAndPasteTransfer cap = new CutAndPasteTransfer(true, ap.alignFrame.applet); + cap.setText("Paste your PDB file here."); + cap.setPDBImport(seq, ap.seqPanel.seqCanvas); + Frame frame = new Frame(); + frame.add(cap); + jalview.bin.JalviewLite.addFrame(frame, "Paste PDB file ", 400, 300); + } + private void jbInit() throws Exception { @@ -319,6 +346,8 @@ public class APopupMenu } } ap.seqPanel.seqCanvas.repaint(); + if(ap.overviewPanel!=null) + ap.overviewPanel.updateOverviewImage(); } protected void clustalColour_actionPerformed(ActionEvent e) @@ -379,29 +408,24 @@ public class APopupMenu protected void abovePIDColour_itemStateChanged(ItemEvent ie) { SequenceGroup sg = getGroup(); + if(sg.cs==null) + return; + if (abovePIDColour.getState()) { sg.cs.setConsensus(AAFrequency.calculate(sg.sequences, 0, ap.av.alignment.getWidth())); int threshold = SliderPanel.setPIDSliderSource(ap, sg.cs, getGroup().getName()); - if (sg.cs instanceof ResidueColourScheme) - { - ( (ResidueColourScheme) sg.cs).setThreshold(threshold); - } - else if (sg.cs instanceof ScoreColourScheme) - { - ( (ScoreColourScheme) sg.cs).setThreshold(threshold); - } + + sg.cs.setThreshold(threshold, ap.av.getIgnoreGapsConsensus()); SliderPanel.showPIDSlider(); } else // remove PIDColouring { - ResidueColourScheme rcs = (ResidueColourScheme) sg.cs; - rcs.setThreshold(0); - sg.cs = rcs; + sg.cs.setThreshold(0, ap.av.getIgnoreGapsConsensus()); } refresh(); @@ -443,6 +467,8 @@ public class APopupMenu protected void conservationMenuItem_itemStateChanged(ItemEvent ie) { SequenceGroup sg = getGroup(); + if(sg.cs==null) + return; if (conservationMenuItem.getState()) { @@ -454,42 +480,20 @@ public class APopupMenu c.calculate(); c.verdict(false, ap.av.ConsPercGaps); - ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs); - sg.cs = ccs; + sg.cs.setConservation(c); - SliderPanel.setConservationSlider(ap, ccs, sg.getName()); + SliderPanel.setConservationSlider(ap, sg.cs, sg.getName()); SliderPanel.showConservationSlider(); } else // remove ConservationColouring { - ConservationColourScheme ccs = (ConservationColourScheme) sg.cs; - sg.cs = ccs.cs; + sg.cs.setConservation(null); } refresh(); } - protected void analyze_actionPerformed(ActionEvent e) - { - CutAndPasteTransfer cap = new CutAndPasteTransfer(false); - Frame frame = new Frame(); - frame.add(cap); - jalview.bin.JalviewLite.addFrame(frame, "Analyze this - ", 400, 300); - SequenceGroup sg = getGroup(); - StringBuffer sb = new StringBuffer(); - - for (int i = 0; i < sg.sequences.size(); i++) - { - Sequence tmp = (Sequence) sg.sequences.elementAt(i); - sb.append(tmp.getSequence(sg.getStartRes(), sg.getEndRes() + 1)); - sb.append("\n"); - } - - sb.append("Something amazing will happen soon"); - cap.setText(sb.toString()); - - } SequenceGroup getGroup() {