X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FIdPanel.java;h=04c1efe535818a8401b53e58c7ced7a8c5708cd4;hb=291f2e12795d442d6b0bf9e4fb9570b258194925;hp=0322bdde097374f7579b9211c75a190f8442473c;hpb=af2fbc5499bfc4764ad69e1abaa35eee4dd04817;p=jalview.git diff --git a/src/jalview/gui/IdPanel.java b/src/jalview/gui/IdPanel.java index 0322bdd..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,23 +69,16 @@ 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(sequence.getDisplayId(true)); - if (av.alignment.getSequenceAt(seq).getDescription() != null) + if (sequence.getDescription() != null) { tip.append("
"); - tip.append(av.alignment.getSequenceAt(seq).getDescription()); + tip.append(sequence.getDescription()); //ADD NON POSITIONAL SEQUENCE INFO SequenceFeature [] features = sequence.getDatasetSequence().getSequenceFeatures(); @@ -100,44 +93,25 @@ public class IdPanel extends JPanel implements MouseListener, } } } - tip.append("
"); } - tip.append(""); - setToolTipText(tip.toString()); - } - if(av.hasHiddenRows) - { - if(av.adjustForHiddenSeqs(seq) - - av.adjustForHiddenSeqs(seq-1)>1) + DBRefEntry[] dbrefs = sequence.getDatasetSequence().getDBRef(); + if (dbrefs != null) { - JPopupMenu pop = new JPopupMenu(); - JMenuItem item = new JMenuItem("Reveal"); - item.addActionListener(new ActionListener() + tip.append(""); + for (int i = 0; i < dbrefs.length; i++) { - public void actionPerformed(ActionEvent e) - { - av.showSequence(seq); - alignPanel.repaint(); - if(alignPanel.overviewPanel!=null) - alignPanel.overviewPanel.updateOverviewImage(); - } - }); - pop.add(item); - pop.show(this, e.getX(), e.getY()); + tip.append("
"); + tip.append(dbrefs[i].getSource() + " " + + dbrefs[i].getAccessionId()); + } + tip.append("
"); } - } - } - - - int getWrappedY(int y) - { - int hgap = av.charHeight; - if (av.scaleAboveWrapped) - hgap += av.charHeight; - return y - hgap; + tip.append(""); + setToolTipText(tip.toString()); + } } @@ -150,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) { @@ -192,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) @@ -278,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)) @@ -331,7 +256,6 @@ public class IdPanel extends JPanel implements MouseListener, } - if (e.isShiftDown() && (lastid != -1)) { selectSeqs(lastid, seq); @@ -365,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) @@ -398,7 +327,7 @@ public class IdPanel extends JPanel implements MouseListener, } mouseDragging = false; - PaintRefresher.Refresh(av.alignment); + PaintRefresher.Refresh(this, av.getSequenceSetId()); } /**