2 * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
3 * Copyright (C) $$Year-Rel$$ 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
10 * of the License, or (at your option) any later version.
12 * Jalview is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty
14 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
19 * The Jalview Authors are detailed in the 'AUTHORS' file.
21 package jalview.javascript;
23 import jalview.appletgui.AlignFrame;
24 import jalview.appletgui.AlignViewport;
25 import jalview.bin.JalviewLite;
26 import jalview.datamodel.SequenceI;
27 import jalview.structure.VamsasListener;
28 import jalview.structure.VamsasSource;
30 public class MouseOverListener extends JSFunctionExec implements
31 VamsasListener, JsCallBack
37 SequenceI last = null;
42 public void mouseOverSequence(SequenceI seq, int index,
45 if (seq != last || i != index)
47 // this should really be a trace message.
48 // Cache.log.debug("Mouse over " + v.getId() + " bound to "
49 // + seq + " at " + index);
52 AlignFrame src = null;
57 if (source instanceof AlignViewport
58 && ((AlignViewport) source).applet.currentAlignFrame.viewport == source)
60 // should be valid if it just generated an event!
61 src = ((AlignViewport) source).applet.currentAlignFrame;
64 // TODO: ensure that if '_af' is specified along with a handler
65 // function, then only events from that alignFrame are sent to that
68 executeJavascriptFunction(
71 { src, seq.getDisplayId(false), "" + (1 + i),
72 "" + seq.findPosition(i) });
73 } catch (Exception ex)
77 .println("JalviewLite javascript error: Couldn't send mouseOver with handler '"
79 if (ex instanceof netscape.javascript.JSException)
81 System.err.println("Javascript Exception: "
82 + ((netscape.javascript.JSException) ex).getMessage());
89 public MouseOverListener(JalviewLite applet, AlignFrame af,
98 public AlignFrame getAlignFrame()
104 public String getListenerFunction()