Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 59012 invoked from network); 30 Apr 2004 14:11:00 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 30 Apr 2004 14:11:00 -0000 Received: (qmail 95898 invoked by uid 500); 30 Apr 2004 14:10:51 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 95868 invoked by uid 500); 30 Apr 2004 14:10:51 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 95853 invoked from network); 30 Apr 2004 14:10:51 -0000 Received: from unknown (HELO mout.perfora.net) (217.160.230.41) by daedalus.apache.org with SMTP; 30 Apr 2004 14:10:51 -0000 Received: from [217.160.230.50] (helo=smtp.perfora.net) by mout.perfora.net with esmtp (Exim 3.35 #1) id 1BJYj7-0000Wj-00 for dev@cocoon.apache.org; Fri, 30 Apr 2004 10:10:53 -0400 Received: from [208.185.179.12] (helo=reverycodes.com) by smtp.perfora.net with asmtp (TLSv1:RC4-MD5:128) (Exim 3.35 #1) id 1BJYj7-0005Zn-00 for dev@cocoon.apache.org; Fri, 30 Apr 2004 10:10:53 -0400 Message-ID: <40925E6A.1070505@reverycodes.com> Date: Fri, 30 Apr 2004 10:10:50 -0400 From: Vadim Gritsenko User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040421 X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: cforms: events on widget instances References: <1083057893.28238.122.camel@23.13 yum.ot yum <408ED30F.9090001@apache.org> <409246D6.3090709@reverycodes.com> <1083333661.5429.13.camel@23.13 yum.ot yum In-Reply-To: <1083333661.5429.13.camel@23.13 yum.ot yum Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: perfora.net abuse@perfora.net auth:e2e4156964dfbcc4c642ec658fa7f9b9 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Bruno Dumon wrote: >On Fri, 2004-04-30 at 14:30, Vadim Gritsenko wrote: > > >>Sylvain Wallez wrote: >> >> >> >>>Bruno Dumon wrote: >>> >>> >>... >> >> >> >>>>And now the practical side: example usage in flowscript: >>>> >>>>form.getWidget("test").addActionListener(newActionListener(function(event) >>>>{ >>>> print("hi there"); >>>>})); >>>> >>>>where the newActionListener function is as follows: >>>> >>>>function newActionListener(listenerFunction) { >>>> var listener = {actionPerformed: listenerFunction }; >>>> var adapter = new >>>>JavaAdapter(Packages.org.apache.cocoon.forms.event.ActionListener, >>>>listener); >>>> return adapter; >>>>} >>>> >>>>Question: do we add these newActionListener and newValueChangedListener >>>>functions to the (javascript) form object, or as separate functions next >>>>to it? >>>> >>>> >>>> >>>It could also be an additional method of ScriptableWidget, which would >>>take care of the adaptation. >>> >>> >>Agreed. And syntax should become then simply: >> >>form.getWidget("test").addActionListener(function(event) { >> print("hi there"); >>}); >> >> > >Saw my message about the v3 api? > > Saw but have not read yet - just got cable internet setup yesterday ;-) >there I've implemented it as: > >form.model.test.onActivate = function() { print("hi there"); } > >which is still more readable and (I think) flexible enough. > Does it support more than one listener? Not that I need it right away, but addActionListener implies more than one listener, where "onActivate =" implies just one (setter semantic). Vadim