[seam-commits] Seam SVN: r9181 - trunk/examples/remoting/chatroom/view.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Oct 2 23:37:46 EDT 2008


Author: shane.bryzak at jboss.com
Date: 2008-10-02 23:37:45 -0400 (Thu, 02 Oct 2008)
New Revision: 9181

Modified:
   trunk/examples/remoting/chatroom/view/chatroom.js
Log:
JBSEAM-2953

Modified: trunk/examples/remoting/chatroom/view/chatroom.js
===================================================================
--- trunk/examples/remoting/chatroom/view/chatroom.js	2008-10-03 03:24:23 UTC (rev 9180)
+++ trunk/examples/remoting/chatroom/view/chatroom.js	2008-10-03 03:37:45 UTC (rev 9181)
@@ -11,6 +11,7 @@
 }
 
 var username = null;
+var connectedFlag = false;
 var chatroom = Seam.Component.getInstance("chatroomAction");
 
 function connect() {
@@ -18,6 +19,7 @@
   username = nameCtl.value;
 
   var connectCallback = function(connected, context) {
+    connectedFlag = true;
     setInterfaceState(connected);
     getObject("username").value = username;
     Seam.Remoting.getContext().setConversationId(context.getConversationId());
@@ -36,6 +38,7 @@
 }
 
 function disconnect() {
+  connectedFlag = false;
   Seam.Remoting.unsubscribe("chatroomTopic");
   setInterfaceState(false);
   chatroom.disconnect();
@@ -95,6 +98,11 @@
 }
 
 function sendMessage() {
+  if (!connectedFlag) {
+    alert("Not connected");
+    return;
+  }
+
   var ctl = getObject("messageText");
   chatroom.sendMessage(ctl.value);
   ctl.value = "";




More information about the seam-commits mailing list