X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fuk%2Fac%2Fvamsas%2Fclient%2Fpicking%2FMouseOverMessage.java;h=7c04eb9779e69bea9cd3773118008186ac0c10df;hb=844ccad5a3fcbedec17b2af66d460f31abc7cff1;hp=2cb85316b329de0d9530d6bbfade93ab0842642e;hpb=3a937e130eaf9c3a57c5759b9094ff5abbd4e12d;p=vamsas.git diff --git a/src/uk/ac/vamsas/client/picking/MouseOverMessage.java b/src/uk/ac/vamsas/client/picking/MouseOverMessage.java index 2cb8531..7c04eb9 100644 --- a/src/uk/ac/vamsas/client/picking/MouseOverMessage.java +++ b/src/uk/ac/vamsas/client/picking/MouseOverMessage.java @@ -1,61 +1,88 @@ +/* + * This file is part of the Vamsas Client version 0.1. + * Copyright 2009 by Jim Procter, Iain Milne, Pierre Marguerite, + * Andrew Waterhouse and Dominik Lindner. + * + * Earlier versions have also been incorporated into Jalview version 2.4 + * since 2008, and TOPALi version 2 since 2007. + * + * The Vamsas Client is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The Vamsas Client is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with the Vamsas Client. If not, see . + */ package uk.ac.vamsas.client.picking; /** * Message class that can be used to send mouse over events. */ -public class MouseOverMessage extends Message -{ - private String vorbaID; - private int position; - - /** - * Constructs a new mouse over message. - * @param vorbaID the VAMSAS object ID of the event's source (usually an - * alignment or alignment sequence) - * @param position a position on the source in its coordinate system (ie a - * column or nucleotide/residue position) - */ - public MouseOverMessage(String vorbaID, int position) - { - this.vorbaID = vorbaID; - this.position = position; - - message = "MOUSEOVER\t" - + "vorbaID=" + vorbaID + "\t" + "position=" + position; - } - - /** - * Constructs a new mouse over message from its underlying string format. - * @param str the string representation of an instance of this object - * @throws java.lang.Exception if the message cannot be reconstructed - */ - MouseOverMessage(String str) - throws Exception - { - message = str; - - String[] elements = str.split("\t"); - - for (int i = 0; i < elements.length; i++) - { - if (elements[i].startsWith("vorbaID=")) - vorbaID = elements[i].substring(8); - else if (elements[i].startsWith("position=")) - position = Integer.parseInt(elements[i].substring(9)); - } - } - - /** - * Returns the VAMSAS object ID associated with this message. - * @return the VAMSAS object ID associated with this message - */ - public String getVorbaID() - { return vorbaID; } - - /** - * Returns the position value associated with this message. - * @return the position value associated with this message - */ - public int getPosition() - { return position; } -} \ No newline at end of file +public class MouseOverMessage extends Message { + private String vorbaID; + + private int position; + + /** + * Constructs a new mouse over message. + * + * @param vorbaID + * the VAMSAS object ID of the event's source (usually an alignment + * or alignment sequence) + * @param position + * a position on the source in its coordinate system (ie a column or + * nucleotide/residue position) + */ + public MouseOverMessage(String vorbaID, int position) { + this.vorbaID = vorbaID; + this.position = position; + + message = "MOUSEOVER\t" + "vorbaID=" + vorbaID + "\t" + "position=" + + position; + } + + /** + * Constructs a new mouse over message from its underlying string format. + * + * @param str + * the string representation of an instance of this object + * @throws java.lang.Exception + * if the message cannot be reconstructed + */ + MouseOverMessage(String str) throws Exception { + message = str; + + String[] elements = str.split("\t"); + + for (int i = 0; i < elements.length; i++) { + if (elements[i].startsWith("vorbaID=")) + vorbaID = elements[i].substring(8); + else if (elements[i].startsWith("position=")) + position = Integer.parseInt(elements[i].substring(9)); + } + } + + /** + * Returns the VAMSAS object ID associated with this message. + * + * @return the VAMSAS object ID associated with this message + */ + public String getVorbaID() { + return vorbaID; + } + + /** + * Returns the position value associated with this message. + * + * @return the position value associated with this message + */ + public int getPosition() { + return position; + } +}