cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject cforms: events on widget instances
Date Tue, 27 Apr 2004 09:24:53 GMT
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.

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?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Mime
View raw message