Author: manaRH
Date: 2008-10-24 04:20:22 -0400 (Fri, 24 Oct 2008)
New Revision: 9411
Modified:
branches/enterprise/JBPAPP_4_3_FP01/examples/remoting/chatroom/view/chatroom.js
Log:
JBSEAM-2953
Modified: branches/enterprise/JBPAPP_4_3_FP01/examples/remoting/chatroom/view/chatroom.js
===================================================================
---
branches/enterprise/JBPAPP_4_3_FP01/examples/remoting/chatroom/view/chatroom.js 2008-10-24
08:08:36 UTC (rev 9410)
+++
branches/enterprise/JBPAPP_4_3_FP01/examples/remoting/chatroom/view/chatroom.js 2008-10-24
08:20:22 UTC (rev 9411)
@@ -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,10 @@
}
function sendMessage() {
+ if (!connectedFlag) {
+ alert("Not connected");
+ return;
+ }
var ctl = getObject("messageText");
chatroom.sendMessage(ctl.value);
ctl.value = "";