X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdPanel.java;h=04c1efe535818a8401b53e58c7ced7a8c5708cd4;hb=7a102b1d0f6fde3df2d8c79d6e51edd9529bfd29;hp=9e0ed33213bf747020bd322ba1ebfe55d5adc915;hpb=c5aa740f1fff4c8caee4ccf0c0e0de517ca4dcb8;p=jalview.git diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 9e0ed33..04c1efe 100755 --- a/src/jalview/gui/IdPanel.java +++ b/src/jalview/gui/IdPanel.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -69,59 +69,49 @@ public class IdPanel extends JPanel implements MouseListener, */ public void mouseMoved(MouseEvent e) { - int y = e.getY(); - - if (av.getWrapAlignment()) - { - y = getWrappedY(y); - } - - final int seq = av.getIndex(y); - if(seq!=-1) + int seq = Math.max(0, alignPanel.seqPanel.findSeq(e)); + if(seq>-1 && seq"); - tip.append(av.alignment.getSequenceAt(seq).getDisplayId(true)); - if (av.alignment.getSequenceAt(seq).getDescription() != null) + tip.append(sequence.getDisplayId(true)); + if (sequence.getDescription() != null) { tip.append("
"); - tip.append(av.alignment.getSequenceAt(seq).getDescription()); - tip.append("
"); - } - tip.append(""); - setToolTipText(tip.toString()); - } + tip.append(sequence.getDescription()); - if(av.hasHiddenRows) - { - if(av.adjustForHiddenSeqs(seq) - - av.adjustForHiddenSeqs(seq-1)>1) - { - JPopupMenu pop = new JPopupMenu(); - JMenuItem item = new JMenuItem("Reveal"); - item.addActionListener(new ActionListener() + //ADD NON POSITIONAL SEQUENCE INFO + SequenceFeature [] features = sequence.getDatasetSequence().getSequenceFeatures(); + if(features!=null) { - public void actionPerformed(ActionEvent e) + for(int i=0; i"+features[i].featureGroup + +" "+ features[i].getType()+" "+features[i].description); + } } - }); - pop.add(item); - pop.show(this, e.getX(), e.getY()); + } + tip.append(""); } - } - } - - int getWrappedY(int y) - { - int hgap = av.charHeight; - if (av.scaleAboveWrapped) - hgap += av.charHeight; + DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef(); + if (dbrefs != null) + { + tip.append(""); + for (int i = 0; i < dbrefs.length; i++) + { + tip.append("
"); + tip.append(dbrefs[i].getSource() + " " + + dbrefs[i].getAccessionId()); + } + tip.append("
"); + } - return y - hgap; + tip.append(""); + setToolTipText(tip.toString()); + } } @@ -134,19 +124,7 @@ public class IdPanel extends JPanel implements MouseListener, { mouseDragging = true; - int y = e.getY(); - - if (av.getWrapAlignment()) - { - y = getWrappedY(y); - } - - int seq = av.getIndex(y); - - if (seq < 0) - { - return; - } + int seq = Math.max(0, alignPanel.seqPanel.findSeq(e)); if (seq < lastid) { @@ -176,17 +154,9 @@ public class IdPanel extends JPanel implements MouseListener, if (links == null || links.size() < 1) return; - int y = e.getY(); - - if (av.getWrapAlignment()) - { - y = getWrappedY(y); - } + int seq = alignPanel.seqPanel.findSeq(e); //DEFAULT LINK IS FIRST IN THE LINK LIST - int seq = av.getIndex(y); - if(seq==-1) - return; String id = av.getAlignment().getSequenceAt(seq).getName(); if (id.indexOf("|") > -1) @@ -262,49 +232,20 @@ public class IdPanel extends JPanel implements MouseListener, return; } - int y = e.getY(); - - if (av.getWrapAlignment()) - { - y = getWrappedY(y); - } + int seq = alignPanel.seqPanel.findSeq(e); - int seq = av.getIndex(y); - - if (seq == -1) - { - return; - } if (javax.swing.SwingUtilities.isRightMouseButton(e)) { jalview.gui.PopupMenu pop = new jalview.gui.PopupMenu(alignPanel, (Sequence) av.getAlignment().getSequenceAt(seq), Preferences.sequenceURLLinks); - pop.show(this, e.getX(), y); + pop.show(this, e.getX(), e.getY()); return; } - /* if (!e.isControlDown() && !e.isShiftDown() && - (av.alignment.findGroup(av.alignment.getSequenceAt(seq)) != null)) - { - System.out.println("no modifiers"); - SequenceGroup selection = new SequenceGroup(); - SequenceGroup sg = av.alignment.findGroup(av.alignment.getSequenceAt( - seq)); - selection.setStartRes(0); - selection.setEndRes(av.alignment.getWidth() - 1); - - for (int i = 0; i < sg.getSize(); i++) - { - selection.addSequence(sg.getSequenceAt(i), true); - } - - av.setSelectionGroup(selection); - return; - }*/ if ((av.getSelectionGroup() == null) || ((!e.isControlDown() && !e.isShiftDown()) && av.getSelectionGroup() != null)) @@ -315,7 +256,6 @@ public class IdPanel extends JPanel implements MouseListener, } - if (e.isShiftDown() && (lastid != -1)) { selectSeqs(lastid, seq); @@ -349,9 +289,14 @@ public class IdPanel extends JPanel implements MouseListener, */ void selectSeqs(int start, int end) { - if(av.getSelectionGroup()==null) + if(av.getSelectionGroup()==null) return; + if (end >= av.getAlignment().getHeight()) + { + end = av.getAlignment().getHeight() - 1; + } + lastid = start; if (end < start) @@ -382,7 +327,7 @@ public class IdPanel extends JPanel implements MouseListener, } mouseDragging = false; - PaintRefresher.Refresh(av.alignment); + PaintRefresher.Refresh(this, av.getSequenceSetId()); } /**