From ccc8b1e64236f30f5442a1622184ac85bc7de088 Mon Sep 17 00:00:00 2001 From: imilne Date: Fri, 15 Dec 2006 13:49:52 +0000 Subject: [PATCH] Added getter methods to the MouseOverMessage class. Added code to MouseOverMessage.java so it can reconstruct the message object from the raw data stream. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@316 be28352e-c001-0410-b1a7-c7978e42abec --- .../ac/vamsas/client/picking/MouseOverMessage.java | 21 ++++++++++++++++++++ src/uk/ac/vamsas/client/picking/TestApp.java | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/uk/ac/vamsas/client/picking/MouseOverMessage.java b/src/uk/ac/vamsas/client/picking/MouseOverMessage.java index d14dc22..b02a3c4 100644 --- a/src/uk/ac/vamsas/client/picking/MouseOverMessage.java +++ b/src/uk/ac/vamsas/client/picking/MouseOverMessage.java @@ -34,5 +34,26 @@ public class MouseOverMessage extends Message { String[] elements = str.split("_"); + 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 diff --git a/src/uk/ac/vamsas/client/picking/TestApp.java b/src/uk/ac/vamsas/client/picking/TestApp.java index 95b23dc..50b338a 100644 --- a/src/uk/ac/vamsas/client/picking/TestApp.java +++ b/src/uk/ac/vamsas/client/picking/TestApp.java @@ -26,7 +26,10 @@ public class TestApp implements IMessageHandler int rnd = (int) (Math.random()*100); CustomMessage msg = new CustomMessage("" + rnd); - manager.sendMessage(msg); +// manager.sendMessage(msg); + + MouseOverMessage mom = new MouseOverMessage("wibble", 10); + manager.sendMessage(mom); } } -- 1.7.10.2