From d9ad2fe9891df2dcba7713f888f57bc3c79ee1c0 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 1 Feb 2005 19:03:04 +0000 Subject: [PATCH] Conservation and PID colouring methods updated, also remove group added --- src/jalview/gui/PopupMenu.java | 71 ++++++++++++++++++++++++---------------- 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/src/jalview/gui/PopupMenu.java b/src/jalview/gui/PopupMenu.java index 722bad1..4ad7090 100755 --- a/src/jalview/gui/PopupMenu.java +++ b/src/jalview/gui/PopupMenu.java @@ -40,6 +40,7 @@ public class PopupMenu extends JPopupMenu JMenuItem annotateResidue = new JMenuItem(); SequenceI sequence; + JMenuItem unGroupMenuItem = new JMenuItem(); public PopupMenu(AlignmentPanel ap, SequenceI seq) { @@ -104,9 +105,9 @@ public class PopupMenu extends JPopupMenu if (sg.cs instanceof ConservationColourScheme) conservationMenuItem.setSelected(true); - } + if(seq!=null) { residueMenu.setVisible(false); @@ -180,10 +181,19 @@ public class PopupMenu extends JPopupMenu residueMenu.setText("Residue"); annotateResidue.setText("annotate residue???"); PIDColour.setFocusPainted(false); + unGroupMenuItem.setText("Remove Group"); + unGroupMenuItem.addActionListener(new java.awt.event.ActionListener() + { + public void actionPerformed(ActionEvent e) + { + unGroupMenuItem_actionPerformed(e); + } + }); add(groupMenu); this.add(sequenceMenu); this.add(residueMenu); groupMenu.add(defineMenu); + groupMenu.add(unGroupMenuItem); groupMenu.addSeparator(); groupMenu.add(copyGroup); groupMenu.add(moveGroup); @@ -343,7 +353,8 @@ public class PopupMenu extends JPopupMenu protected void clustalColour_actionPerformed(ActionEvent e) { - getGroup().cs = new ClustalxColourScheme(); + SequenceGroup sg = getGroup(); + sg.cs = new ClustalxColourScheme(sg.sequences, ap.av.alignment.getWidth()); refresh(); } @@ -391,26 +402,9 @@ public class PopupMenu extends JPopupMenu } -/* -public void conservationColourIncMenuItem_actionPerformed(ActionEvent e) -{ -ConservationIncrementPanel cip = new ConservationIncrementPanel(viewport, alignPanel); -JInternalFrame frame = new JInternalFrame(); -frame.setContentPane(cip); -Desktop.addInternalFrame(frame, "Conservation Colour Increment", 400,90); -frame.setMaximizable(false); - - }*/ - - protected void abovePIDColour_actionPerformed(ActionEvent e) { - SliderPanel sp = new SliderPanel(ap, 70, false, getGroup().cs ); - JInternalFrame frame = new JInternalFrame(); - frame.setContentPane(sp); - Desktop.addInternalFrame(frame, "Percentage Identity Threshold ("+getGroup().getName()+")" , 400,90); - frame.setMaximizable(false); - + Desktop.setPIDSliderSource(ap, getGroup().cs, getGroup().getName()); } @@ -448,15 +442,28 @@ frame.setMaximizable(false); { SequenceGroup sg = getGroup(); - Conservation c = new Conservation("Group", - ResidueProperties.propHash, 3, sg.sequences, sg.getStartRes(), - sg.getEndRes() ); + if(conservationMenuItem.isSelected()) + { + + Conservation c = new Conservation("Group", + ResidueProperties.propHash, 3, + sg.sequences, 0, + ap.av.alignment.getWidth()); - c.calculate(); - c.verdict(false, 100); - ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs); + c.calculate(); + c.verdict(false, 100); + ConservationColourScheme ccs = new ConservationColourScheme(c, sg.cs); - sg.cs = ccs; + + sg.cs = ccs; + + Desktop.setConservationSliderSource(ap, ccs, sg.getName()); + } + else // remove ConservationColouring + { + ConservationColourScheme ccs = (ConservationColourScheme)sg.cs; + sg.cs = ccs.cs; + } refresh(); } @@ -528,7 +535,7 @@ frame.setMaximizable(false); ap.av.alignment.deleteGroup(sg); ap.av.resetSeqLimits(ap.seqPanel.seqCanvas.getHeight()); - ap.seqPanel.parent.RefreshPanels(); + ap.RefreshPanels(); } @@ -582,4 +589,12 @@ frame.setMaximizable(false); } } + + void unGroupMenuItem_actionPerformed(ActionEvent e) + { + SequenceGroup sg = ap.av.getRubberbandGroup(); + ap.av.alignment.deleteGroup(sg); + ap.av.setRubberbandGroup(null); + ap.RefreshPanels(); + } } -- 1.7.10.2