X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fappletgui%2FIdPanel.java;h=d159a4ceee454ab487d80add3080b7e04d3b7fc8;hb=e25f63a72efddff9e071abdeff0ae5599431e4f8;hp=33463d43f1274d48daf581d6d1f591da8bb46f6f;hpb=4ebc6d5b362bc093c39312aa1a69836e3dd6ae84;p=jalview.git diff --git a/src/jalview/appletgui/IdPanel.java b/src/jalview/appletgui/IdPanel.java index 33463d4..d159a4c 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,25 @@ public class IdPanel add(idCanvas, BorderLayout.CENTER); idCanvas.addMouseListener(this); idCanvas.addMouseMotionListener(this); + + String label, url; + if(parent.alignFrame.applet!=null) + { + 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 +103,39 @@ 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(); + if (id.indexOf("|") > -1) + id = id.substring(id.lastIndexOf("|") + 1); + + 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 + { + + alignPanel.alignFrame.showURL(url, target); + } + catch (Exception ex) + { + ex.printStackTrace(); + } } public void mouseEntered(MouseEvent e) @@ -137,7 +167,7 @@ public class IdPanel public void mousePressed(MouseEvent e) { - if (e.getClickCount() == 2) + if (e.getClickCount() >1 ) { return; } @@ -157,7 +187,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; @@ -238,7 +268,7 @@ public class IdPanel av.getSelectionGroup().recalcConservation(); mouseDragging = false; - PaintRefresher.Refresh(this); + PaintRefresher.Refresh(this, av.alignment); } public void highlightSearchResults(java.util.Vector found)