From: jprocter Date: Fri, 21 Aug 2009 11:18:01 +0000 (+0000) Subject: single-click highlights, double click selectes th associated group or sequence for... X-Git-Tag: Release_2_5~199 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=504cbed13f70f08286cce06bd77894253ec7c8eb;p=jalview.git single-click highlights, double click selectes th associated group or sequence for annotation row --- diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java index 0e766c4..a34f8f5 100755 --- a/src/jalview/gui/AnnotationLabels.java +++ b/src/jalview/gui/AnnotationLabels.java @@ -419,12 +419,47 @@ public class AnnotationLabels extends JPanel implements MouseListener, */ public void mouseClicked(MouseEvent evt) { + AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation(); + if (SwingUtilities.isLeftMouseButton(evt)) + { + if (selectedRow < aa.length) + { + if (aa[selectedRow].groupRef!=null) + { + ap.seqPanel.ap.idPanel.highlightSearchResults(aa[selectedRow].groupRef.getSequences(null)); + if (evt.getClickCount()>=2) + { + // todo: make the ap scroll to the selection + ap.av.setSelectionGroup(new SequenceGroup(aa[selectedRow].groupRef)); + ap.paintAlignment(false); + } + return; + } else + if (aa[selectedRow].sequenceRef!=null){ + Vector sr = new Vector(); + sr.addElement(aa[selectedRow].sequenceRef); + if (evt.getClickCount()==1) + { + ap.seqPanel.ap.idPanel.highlightSearchResults(sr); + } else + if (evt.getClickCount()>=2) + { + ap.seqPanel.ap.idPanel.highlightSearchResults(null); + SequenceGroup sg = new SequenceGroup(); + sg.addSequence(aa[selectedRow].sequenceRef,false); + ap.av.setSelectionGroup(sg); + ap.paintAlignment(false); + PaintRefresher.Refresh(ap, ap.av.getSequenceSetId()); + } + + } + } + } if (!SwingUtilities.isRightMouseButton(evt)) { return; } - AlignmentAnnotation[] aa = ap.av.alignment.getAlignmentAnnotation(); JPopupMenu pop = new JPopupMenu("Annotations"); JMenuItem item = new JMenuItem(ADDNEW); @@ -461,7 +496,7 @@ public class AnnotationLabels extends JPanel implements MouseListener, pop.addSeparator(); // av and sequencegroup need to implement same interface for final JCheckBoxMenuItem cbmi = new JCheckBoxMenuItem( - "Ignore Gaps In Consensus", ap.av.getIgnoreGapsConsensus()); + "Ignore Gaps In Consensus", (aa[selectedRow].groupRef!=null) ? aa[selectedRow].groupRef.getIgnoreGapsConsensus() : ap.av.getIgnoreGapsConsensus()); final AlignmentAnnotation aaa = aa[selectedRow]; cbmi.addActionListener(new ActionListener() { @@ -469,12 +504,28 @@ public class AnnotationLabels extends JPanel implements MouseListener, { if (aaa.groupRef!=null) { - aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState()); + aaa.groupRef.setIgnoreGapsConsensus(cbmi.getState()); // TODO: pass on reference to ap so the view can be updated. + ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } else { + ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap); } - ap.av.setIgnoreGapsConsensus(cbmi.getState(), ap); } }); pop.add(cbmi); + // av and sequencegroup need to implement same interface for + if (aaa.groupRef!=null) { + final JCheckBoxMenuItem cprof = new JCheckBoxMenuItem( + "Show Full Profile", aa[selectedRow].groupRef.isIncludeAllConsSymbols()); + cprof.addActionListener(new ActionListener() + { + public void actionPerformed(ActionEvent e) + { + aaa.groupRef.setIncludeAllConsSymbols(cprof.getState()); // TODO: pass on reference to ap so the view can be updated. + ap.annotationPanel.paint(ap.annotationPanel.getGraphics()); + } + }); + pop.add(cprof); + } final JMenuItem consclipbrd = new JMenuItem(COPYCONS_SEQ); consclipbrd.addActionListener(this); pop.add(consclipbrd);