Added getter methods to the MouseOverMessage class.
authorimilne <imilne@issues.jalview.org>
Fri, 15 Dec 2006 13:49:52 +0000 (13:49 +0000)
committerimilne <imilne@issues.jalview.org>
Fri, 15 Dec 2006 13:49:52 +0000 (13:49 +0000)
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

src/uk/ac/vamsas/client/picking/MouseOverMessage.java
src/uk/ac/vamsas/client/picking/TestApp.java

index d14dc22..b02a3c4 100644 (file)
@@ -34,5 +34,26 @@ public class MouseOverMessage extends Message
        {\r
                String[] elements = str.split("_");\r
                \r
+               for (int i = 0; i < elements.length; i++)\r
+               {\r
+                       if (elements[i].startsWith("vorbaID="))\r
+                               vorbaID = elements[i].substring(8);\r
+                       else if (elements[i].startsWith("position="))\r
+                               position = Integer.parseInt(elements[i].substring(9));\r
+               }\r
        }\r
+       \r
+       /**\r
+        * Returns the VAMSAS object ID associated with this message.\r
+        * @return the VAMSAS object ID associated with this message\r
+        */\r
+       public String getVorbaID()\r
+               { return vorbaID; }\r
+       \r
+       /**\r
+        * Returns the position value associated with this message.\r
+        * @return the position value associated with this message\r
+        */\r
+       public int getPosition()\r
+               { return position; }\r
 }
\ No newline at end of file
index 95b23dc..50b338a 100644 (file)
@@ -26,7 +26,10 @@ public class TestApp implements IMessageHandler
                        int rnd = (int) (Math.random()*100);\r
                        CustomMessage msg = new CustomMessage("" + rnd);\r
                        \r
-                       manager.sendMessage(msg);\r
+//                     manager.sendMessage(msg);\r
+\r
+                       MouseOverMessage mom = new MouseOverMessage("wibble", 10);\r
+                       manager.sendMessage(mom);\r
                }\r
        }\r
        \r