Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 23478 invoked from network); 27 Apr 2004 21:39:43 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 27 Apr 2004 21:39:43 -0000 Received: (qmail 2415 invoked by uid 500); 27 Apr 2004 21:39:26 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 2354 invoked by uid 500); 27 Apr 2004 21:39:25 -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 2335 invoked from network); 27 Apr 2004 21:39:25 -0000 Received: from unknown (HELO mailfe05.swip.net) (212.247.154.129) by daedalus.apache.org with SMTP; 27 Apr 2004 21:39:25 -0000 Received: from [80.170.187.79] (HELO apache.org) by mailfe05.swip.net (CommuniGate Pro SMTP 4.2b2) with ESMTP id 24272569 for dev@cocoon.apache.org; Tue, 27 Apr 2004 23:39:30 +0200 Message-ID: <408ED30F.9090001@apache.org> Date: Tue, 27 Apr 2004 23:39:27 +0200 From: Sylvain Wallez Organization: Anyware Technologies User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: fr, en, en-us 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 In-Reply-To: <1083057893.28238.122.camel@23.13 yum.ot yum Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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: >I've just added the instance based event listeners. You can both add and >remove them. > >Following table summarizes the current event situation, see below for >more info. > > valuechanged action >field Y N/A >multivaluefield (*) N/A >booleanfield Y N/A >repeater N/A N/A >output N/A N/A >submit N/A Y >action N/A Y >repeater-action N/A Y >row-action N/A Y >aggregatefield (**) N/A >upload N/A N/A >messages N/A N/A > >N/A means not applicable > >For those events where Y (yes) is mentioned, they are supported both in >the definition and the instance. > > I'd like to add "action" on every widget where a @submit-on-change makes sense (field, booleanfield, multivaluefield, upload). This would allow to have some specific event-handling related to the fact that the widget was activated, regardless if its value changed or not. >And then the special cases: > >(*) multivaluefield: the builder happily builds the listeners, but >multivaluefield seems to nowhere create events. So I haven't added >instance-based event listeners on that widget either. -> solution I see >is to add full support for value changed events to this widget. > >(**) aggregatefield: the definition and definition builder don't support >value changed events, and events are hence also nowhere created, but >since the instance class extends from Field it automatically has the >possibility to add instance-level event listeners (but they won't ever >be called) -> solution: unsure. Is it possible/meaningful to support >value changed listeners on this widget? Volunteers? > > - o - > >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. Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }