X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdPanel.java;h=b973913802ed7d06bd0c9190d708155de885c4a6;hb=eb5197242ba17fcff4ce0e18419ca81a63418f7a;hp=44a03ecaef810a93012ca9cb9a69d5b560f9924d;hpb=5d01e85b903f9ce67b2b4a32e9e7a02f57d9f2e9;p=jalview.git diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 44a03ec..b973913 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -1,43 +1,50 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.4) + * Copyright (C) 2008 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 * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - package jalview.appletgui; import java.awt.*; import java.awt.event.*; +import java.util.Vector; import jalview.datamodel.*; import jalview.util.UrlLink; -public class IdPanel - extends Panel implements MouseListener, MouseMotionListener +public class IdPanel extends Panel implements MouseListener, + MouseMotionListener { protected IdCanvas idCanvas; + protected AlignViewport av; + protected AlignmentPanel alignPanel; + ScrollThread scrollThread = null; int offy; + int width; + int lastid = -1; + boolean mouseDragging = false; + java.util.Vector links = new java.util.Vector(); public IdPanel(AlignViewport av, AlignmentPanel parent) @@ -68,38 +75,66 @@ public class IdPanel if (links.size() < 1) { links = new java.util.Vector(); - links.addElement("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry"); + links + .addElement("SRS|http://srs.ebi.ac.uk/srsbin/cgi-bin/wgetz?-newId+(([uniprot-all:$SEQUENCE_ID$]))+-view+SwissEntry"); } } Tooltip tooltip; + public void mouseMoved(MouseEvent e) { int seq = alignPanel.seqPanel.findSeq(e); SequenceI sequence = av.getAlignment().getSequenceAt(seq); + + // look for non-pos features + StringBuffer tooltiptext = new StringBuffer(); + - if (sequence.getDescription() == null) + if (sequence.getDescription() != null) + { + tooltiptext.append(sequence.getDescription()); + tooltiptext.append("\n"); + } + + SequenceFeature sf[] = sequence.getSequenceFeatures(); + for (int sl=0;sf!=null && sl= getSize().height && - av.alignment.getHeight() > av.getEndSeq()) + if (mouseDragging && e.getY() >= getSize().height + && av.alignment.getHeight() > av.getEndSeq()) { scrollThread = new ScrollThread(false); } @@ -222,19 +256,40 @@ public class IdPanel int seq = alignPanel.seqPanel.findSeq(e); - if ( (e.getModifiers() & InputEvent.BUTTON3_MASK) == - InputEvent.BUTTON3_MASK) + if ((e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { - APopupMenu popup = new APopupMenu(alignPanel, - (Sequence) av.getAlignment(). - getSequenceAt(seq), links); + Sequence sq = (Sequence) av + .getAlignment().getSequenceAt(seq); + // build a new links menu based on the current links + any non-positional features + Vector nlinks = new Vector(); + for (int l=0,lSize=links.size();l0) + { + for (int l=0, lSize=sf[sl].links.size(); l index || av.getEndSeq() < index) @@ -320,11 +376,12 @@ public class IdPanel } // this class allows scrolling off the bottom of the visible alignment - class ScrollThread - extends Thread + class ScrollThread extends Thread { boolean running = false; + boolean up = true; + public ScrollThread(boolean up) { this.up = up; @@ -370,9 +427,9 @@ public class IdPanel try { Thread.sleep(100); + } catch (Exception ex) + { } - catch (Exception ex) - {} } } }