tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Norbert Sándor <develo...@erinors.com>
Subject invoking listeners
Date Tue, 21 Feb 2006 15:10:45 GMT
Hi,

I saw the following code snippet in a framework component:

        cycle.setListenerParameters(...);

        ....

        if (action != null) {
         Runnable notify = new Runnable()
         {
             public void run()
             {
                 listenerInvoker.invokeListener(action, AbstractSubmit.this, cycle);
             }
         };
 
            form.addDeferredRunnable(notify);
        }

My question is: is it correct that the run() method contains only code to invoke the listener
but cycle.setListenerParameters() is set outside of it? Does this work correctly if more than
one component adds deferred runnables with different listener arguments?

If I'm right then the following is more correct:

        if (action != null) {
         Runnable notify = new Runnable()
         {
             public void run()
             {

                 cycle.setListenerParameters(...);
                 listenerInvoker.invokeListener(action, AbstractSubmit.this, cycle);
             }
         };
 
            form.addDeferredRunnable(notify);
        }

Regards,
Norbi
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message