The following is contrived, but works. Mainly, I would create a proper
dojo widget and have the event listener bind to that, but this works
because of expando properties...
In your body of a file called Test.html, I have
<div id ="test"></div>
<script type="text/javascript" >
dojo.require('dojo.lang.*');
dojo.require('dojo.event.*')
var tst =dojo.byId('test');
tst.update=function()
{
dojo.debug ('running')
dojo.lang.setTimeout( tst.update , 4000) ;
// im sure ther animation package had
//a proper way of scheduling something for repeating, but...
};
dojo.addOnLoad(function(){
dojo.byId('test').update() ; // get the ball rolling
});
</script>
<div jwcid="[EMAIL PROTECTED]">
<span jwcid="@Insert" value = "ognl: now">
the current time is
</span>
</div>
then in Test.java,
abstract public Date getNow() ;
abstract public void setNow(Date now) ;
@EventListener( elements ="test", async = true ,
events ="update")
public void update (IRequestCycle cycle )
{
setNow(new Date()) ;
cycle.getResponseBuilder().updateComponent("status");
}
and boom!
As you load hte page in javascript, test.update gets called which in
turn causes the server side event listener to run. The event listener
updates the clock (every 4 seconds because I was running this in devel
mode and, and I mean nothing, pisses tapestry off more than running in
devel mode) and the page reflects it without any refresh.
Hope this helps, sort of...
Josh
On 9/3/06, livelock <[EMAIL PROTECTED]> wrote:
Hi,
Dojo got a polling mode
(http://archive.dojotoolkit.org/nightly/tests/io/test_ScriptSrcIO.html#CommonArgs).
How do I use that properly with Tapestry 4.1? The EventListener seems not
have anything that ge
I want a component that reads a property from a server all 4 seconds. For
example for stock quotes or even a chat.
Regards,
André
--
View this message in context:
http://www.nabble.com/How-to-implement-polling-with-%40EventListener-tf2212501.html#a6127728
Sent from the Tapestry - User forum at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]