int width;\r
int lastid = -1;\r
boolean mouseDragging = false;\r
+ java.util.Vector links = new java.util.Vector();\r
\r
public IdPanel(AlignViewport av, AlignmentPanel parent)\r
{\r
add(idCanvas, BorderLayout.CENTER);\r
idCanvas.addMouseListener(this);\r
idCanvas.addMouseMotionListener(this);\r
+\r
+ String label, url;\r
+ for(int i=1; i<10; i++)\r
+ {\r
+ label = parent.alignFrame.applet.getParameter("linkLabel_"+i);\r
+ url = parent.alignFrame.applet.getParameter("linkURL_"+i);\r
+\r
+ if(label!=null && url!=null)\r
+ links.addElement(label+"|"+url);\r
+\r
+ }\r
+ if (links.size() < 1)\r
+ {\r
+ links = new java.util.Vector();\r
+ links.addElement("SRS|http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[uniprot-all:$SEQUENCE_ID$]+-vn+2");\r
+ }\r
}\r
\r
public void mouseMoved(MouseEvent e)\r
\r
public void mouseClicked(MouseEvent e)\r
{\r
- if (e.getClickCount() == 2)\r
- {\r
- int y = e.getY();\r
- if (av.getWrapAlignment())\r
- {\r
- y -= 2 * av.charHeight;\r
- }\r
+ if (e.getClickCount() < 2)\r
+ return;\r
\r
- int seq = av.getIndex(y);\r
- String id = av.getAlignment().getSequenceAt(seq).getName();\r
+ int y = e.getY();\r
\r
- try\r
- {\r
- jalview.bin.JalviewLite.showURL(\r
- "http://srs.ebi.ac.uk/srs7bin/cgi-bin/wgetz?-e+[swall-id:" + id +\r
- "]+-vn+2");\r
- }\r
- catch (Exception ex)\r
- {\r
- ex.printStackTrace();\r
- }\r
+ if (av.getWrapAlignment())\r
+ {\r
+ y -= (2 * av.charHeight);\r
}\r
\r
+ //DEFAULT LINK IS FIRST IN THE LINK LIST\r
+ int seq = av.getIndex(y);\r
+ String id = av.getAlignment().getSequenceAt(seq).getName();\r
+\r
+ String target = links.elementAt(0).toString();\r
+ target = target.substring(0, target.indexOf("|"));\r
+ String url = links.elementAt(0).toString();\r
+ url = url.substring(url.indexOf("|")+1);\r
+\r
+ int index = url.indexOf("$SEQUENCE_ID$");\r
+ url = url.substring(0, index)+ id + url.substring(index+13);\r
+\r
+ try\r
+ {\r
+ jalview.bin.JalviewLite.showURL(url, target);\r
+ }\r
+ catch (Exception ex)\r
+ {\r
+ ex.printStackTrace();\r
+ }\r
}\r
\r
public void mouseEntered(MouseEvent e)\r
\r
public void mousePressed(MouseEvent e)\r
{\r
- if (e.getClickCount() == 2)\r
+ if (e.getClickCount() >1 )\r
{\r
return;\r
}\r
if ( (e.getModifiers() & InputEvent.BUTTON3_MASK) ==\r
InputEvent.BUTTON3_MASK)\r
{\r
- APopupMenu popup = new APopupMenu(alignPanel, null);\r
+ APopupMenu popup = new APopupMenu(alignPanel, (Sequence) av.getAlignment().getSequenceAt(seq), links);\r
this.add(popup);\r
popup.show(this, e.getX(), e.getY());\r
return;\r