2 * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.1)
3 * Copyright (C) 2014 The Jalview Authors
5 * This file is part of Jalview.
7 * Jalview is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
11 * Jalview is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 * PURPOSE. See the GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along with Jalview. If not, see <http://www.gnu.org/licenses/>.
17 * The Jalview Authors are detailed in the 'AUTHORS' file.
19 package jalview.javascript;
21 import jalview.appletgui.AlignFrame;
22 import jalview.bin.JalviewLite;
23 import jalview.datamodel.SequenceI;
24 import jalview.structure.VamsasListener;
25 import jalview.structure.VamsasSource;
27 public class MouseOverListener extends JSFunctionExec implements
28 VamsasListener, JsCallBack
34 SequenceI last = null;
38 public void mouseOver(SequenceI seq, int index, VamsasSource source)
40 if (seq != last || i != index)
42 // this should really be a trace message.
43 // Cache.log.debug("Mouse over " + v.getId() + " bound to "
44 // + seq + " at " + index);
47 AlignFrame src = null;
52 if (source instanceof jalview.appletgui.AlignViewport
53 && ((jalview.appletgui.AlignViewport) source).applet.currentAlignFrame.viewport == source)
55 // should be valid if it just generated an event!
56 src = ((jalview.appletgui.AlignViewport) source).applet.currentAlignFrame;
59 // TODO: ensure that if '_af' is specified along with a handler
60 // function, then only events from that alignFrame are sent to that
63 executeJavascriptFunction(
66 { src, seq.getDisplayId(false), "" + (1 + i),
67 "" + seq.findPosition(i) });
68 } catch (Exception ex)
72 .println("JalviewLite javascript error: Couldn't send mouseOver with handler '"
74 if (ex instanceof netscape.javascript.JSException)
76 System.err.println("Javascript Exception: "
77 + ((netscape.javascript.JSException) ex).getMessage());
84 public MouseOverListener(JalviewLite applet, AlignFrame af,
93 public AlignFrame getAlignFrame()
99 public String getListenerFunction()