Author: remy.maucherat(a)jboss.com
Date: 2009-06-22 10:13:03 -0400 (Mon, 22 Jun 2009)
New Revision: 1122
Modified:
trunk/test/webapps/cometd/examples/simplechat/ticker.html
Log:
- Sync: fix to the test (which was working for me).
Modified: trunk/test/webapps/cometd/examples/simplechat/ticker.html
===================================================================
--- trunk/test/webapps/cometd/examples/simplechat/ticker.html 2009-06-22 14:08:51 UTC (rev
1121)
+++ trunk/test/webapps/cometd/examples/simplechat/ticker.html 2009-06-22 14:13:03 UTC (rev
1122)
@@ -1,4 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+
http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-1" >
@@ -10,16 +26,6 @@
dojo.require("dojox.cometd");
-dojo.addOnUnload(function() {
- dojox.cometd.init("/cometd/cometd");
- dojox.cometd.startBatch();
- dojox.cometd.unsubscribe("/stock/GOOG", this,"");
- dojox.cometd.unsubscribe("/stock/YHOO", this,"");
- dojox.cometd.unsubscribe("/stock/SPRG", this,"");
- dojox.cometd.endBatch();
- });
-
-
dojo.addOnLoad(function() {
dojox.cometd.init("/cometd/cometd");
dojox.cometd.startBatch();
@@ -30,16 +36,27 @@
});
+dojo.addOnUnload(function() {
+ dojox.cometd.startBatch();
+ dojox.cometd.unsubscribe("/stock/GOOG", this,"");
+ dojox.cometd.unsubscribe("/stock/YHOO", this,"");
+ dojox.cometd.unsubscribe("/stock/SPRG", this,"");
+ dojox.cometd.endBatch();
+ });
+
+
+
+
function subscribe(box, symbol) {
- if (box.checked) {
- dojox.cometd.subscribe("/stock/"+symbol, onMsgEvent);
- var rowCurrent = dojo.byId("row."+symbol);
- rowCurrent.bgColor="white";
- } else {
- dojox.cometd.unsubscribe("/stock/"+symbol, onMsgEvent);
- var rowCurrent = dojo.byId("row."+symbol);
- rowCurrent.bgColor="gray";
- }
+ if (box.checked) {
+ dojox.cometd.subscribe("/stock/"+symbol, onMsgEvent);
+ var rowCurrent = dojo.byId("row."+symbol);
+ rowCurrent.bgColor="white";
+ } else {
+ dojox.cometd.unsubscribe("/stock/"+symbol, onMsgEvent);
+ var rowCurrent = dojo.byId("row."+symbol);
+ rowCurrent.bgColor="gray";
+ }
}
function removeChildrenFromNode(node)
@@ -51,10 +68,10 @@
var len = node.childNodes.length;
- while (node.hasChildNodes())
- {
- node.removeChild(node.firstChild);
- }
+ while (node.hasChildNodes())
+ {
+ node.removeChild(node.firstChild);
+ }
}
function onMsgEvent(event) {
@@ -78,16 +95,16 @@
var table = dojo.byId("stocktable");
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
- if (rows[i].bgColor != "gray") {
- rows[i].bgColor = "white";
- }
+ if (rows[i].bgColor != "gray") {
+ rows[i].bgColor = "white";
+ }
}
//manipulate rows
var rowCurrent = dojo.byId("row."+symbol);
if (pricechange<=0) {
rowCurrent.bgColor = "red";
} else {
- rowCurrent.bgColor = "cyan";
+ rowCurrent.bgColor = "cyan";
}
}