2 * This file is part of the Vamsas Client version 0.2.
\r
3 * Copyright 2010 by Jim Procter, Iain Milne, Pierre Marguerite,
\r
4 * Andrew Waterhouse and Dominik Lindner.
\r
6 * Earlier versions have also been incorporated into Jalview version 2.4
\r
7 * since 2008, and TOPALi version 2 since 2007.
\r
9 * The Vamsas Client is free software: you can redistribute it and/or modify
\r
10 * it under the terms of the GNU Lesser General Public License as published by
\r
11 * the Free Software Foundation, either version 3 of the License, or
\r
12 * (at your option) any later version.
\r
14 * The Vamsas Client is distributed in the hope that it will be useful,
\r
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
17 * GNU Lesser General Public License for more details.
\r
19 * You should have received a copy of the GNU Lesser General Public License
\r
20 * along with the Vamsas Client. If not, see <http://www.gnu.org/licenses/>.
\r
22 package uk.ac.vamsas.client.picking;
\r
25 * Message class that can be used to send mouse over events.
\r
27 public class MouseOverMessage extends Message {
\r
28 private String vorbaID;
\r
30 private int position;
\r
33 * Constructs a new mouse over message.
\r
36 * the VAMSAS object ID of the event's source (usually an alignment
\r
37 * or alignment sequence)
\r
39 * a position on the source in its coordinate system (ie a column or
\r
40 * nucleotide/residue position)
\r
42 public MouseOverMessage(String vorbaID, int position) {
\r
43 this.vorbaID = vorbaID;
\r
44 this.position = position;
\r
46 message = "MOUSEOVER\t" + "vorbaID=" + vorbaID + "\t" + "position="
\r
51 * Constructs a new mouse over message from its underlying string format.
\r
54 * the string representation of an instance of this object
\r
55 * @throws java.lang.Exception
\r
56 * if the message cannot be reconstructed
\r
58 MouseOverMessage(String str) throws Exception {
\r
61 String[] elements = str.split("\t");
\r
63 for (int i = 0; i < elements.length; i++) {
\r
64 if (elements[i].startsWith("vorbaID="))
\r
65 vorbaID = elements[i].substring(8);
\r
66 else if (elements[i].startsWith("position="))
\r
67 position = Integer.parseInt(elements[i].substring(9));
\r
72 * Returns the VAMSAS object ID associated with this message.
\r
74 * @return the VAMSAS object ID associated with this message
\r
76 public String getVorbaID() {
\r
81 * Returns the position value associated with this message.
\r
83 * @return the position value associated with this message
\r
85 public int getPosition() {
\r