X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdPanel.java;h=f3db9be7a1b8d9215b6d2d815f5d6583226fac4f;hb=d72c37ab022b3a8ff6f6cda1d3f09de5c5d004ab;hp=39fab0a6aee7ad564431a4274de95c50401e69de;hpb=588042b69abf8e60bcc950b24c283933c7dd422f;p=jalview.git diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 39fab0a..f3db9be 100755 --- a/src/jalview/appletgui/IdPanel.java +++ b/src/jalview/appletgui/IdPanel.java @@ -37,6 +37,7 @@ public class IdPanel int width; int lastid = -1; boolean mouseDragging = false; + java.util.Vector links = new java.util.Vector(); public IdPanel(AlignViewport av, AlignmentPanel parent) { @@ -47,6 +48,22 @@ public class IdPanel add(idCanvas, BorderLayout.CENTER); idCanvas.addMouseListener(this); idCanvas.addMouseMotionListener(this); + + String label, url; + for(int i=1; i<10; i++) + { + label = parent.alignFrame.applet.getParameter("linkLabel_"+i); + url = parent.alignFrame.applet.getParameter("linkURL_"+i); + + if(label!=null && url!=null) + links.addElement(label+"|"+url); + + } + if (links.size() < 1) + { + links = new java.util.Vector(); + links.addElement("SRS|http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2"); + } } public void mouseMoved(MouseEvent e) @@ -83,29 +100,36 @@ public class IdPanel public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2) - { - int y = e.getY(); - if (av.getWrapAlignment()) - { - y -= 2 * av.charHeight; - } + if (e.getClickCount() < 2) + return; - int seq = av.getIndex(y); - String id = av.getAlignment().getSequenceAt(seq).getName(); + int y = e.getY(); - try - { - jalview.bin.JalviewLite.showURL( - "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" + id + - "]+-vn+2"); - } - catch (Exception ex) - { - ex.printStackTrace(); - } + if (av.getWrapAlignment()) + { + y -= (2 * av.charHeight); } + //DEFAULT LINK IS FIRST IN THE LINK LIST + int seq = av.getIndex(y); + String id = av.getAlignment().getSequenceAt(seq).getName(); + + String target = links.elementAt(0).toString(); + target = target.substring(0, target.indexOf("|")); + String url = links.elementAt(0).toString(); + url = url.substring(url.indexOf("|")+1); + + int index = url.indexOf("$SEQUENCE_ID$"); + url = url.substring(0, index)+ id + url.substring(index+13); + + try + { + jalview.bin.JalviewLite.showURL(url, target); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } public void mouseEntered(MouseEvent e) @@ -137,7 +161,7 @@ public class IdPanel public void mousePressed(MouseEvent e) { - if (e.getClickCount() == 2) + if (e.getClickCount() >1 ) { return; } @@ -157,7 +181,7 @@ public class IdPanel if ( (e.getModifiers() & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) { - APopupMenu popup = new APopupMenu(alignPanel, null); + APopupMenu popup = new APopupMenu(alignPanel, (Sequence) av.getAlignment().getSequenceAt(seq), links); this.add(popup); popup.show(this, e.getX(), e.getY()); return; @@ -173,7 +197,7 @@ public class IdPanel selection.setEndRes(av.alignment.getWidth() - 1); for (int i = 0; i < sg.getSize(); i++) { - selection.addSequence(sg.getSequenceAt(i)); + selection.addSequence(sg.getSequenceAt(i), true); } av.setSelectionGroup(selection); @@ -205,7 +229,7 @@ public class IdPanel { lastid = seq; SequenceI pickedSeq = av.getAlignment().getSequenceAt(seq); - av.getSelectionGroup().addOrRemove(pickedSeq); + av.getSelectionGroup().addOrRemove(pickedSeq, false); } void selectSeqs(int start, int end) @@ -222,7 +246,7 @@ public class IdPanel for (int i = start; i <= end; i++) { - av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i)); + av.getSelectionGroup().addSequence(av.getAlignment().getSequenceAt(i), false); } } @@ -234,8 +258,11 @@ public class IdPanel scrollThread.running = false; } + if(av.getSelectionGroup()!=null) + av.getSelectionGroup().recalcConservation(); + mouseDragging = false; - PaintRefresher.Refresh(this); + PaintRefresher.Refresh(this, av.alignment); } public void highlightSearchResults(java.util.Vector found)