cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] WoodyEventHandling Daniel Woody WoodyReference Fri Oct 31 15:00:06 2003
Date Fri, 31 Oct 2003 14:00:06 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyEventHandling , version: 1 on Fri Oct 31
13:34:25 2003 by BrunoDumon

New page created:
+ !!!Event Handling
+ 
+ Some types of widgets can emit events. For example, the action widget produces ActionEvents
and the field widget produces ValueChangedEvents. Next to these events, there are also processing
phase events, fired in between the various phases of the processing of a request.
+ 
+ Handling events can be done in two ways:
+ * by defining event listeners in the form definition (as child of wd:on-action for the action
widget, or wd:on-value-changed for the field widget, ...). These event listeners will be triggered
when the widget on which they're defined fires an event.
+ * by registering a org.apache.cocoon.woody.event.FormHandler on the Form object. This FormHandler
will receive all events from all widgets.
+ 
+ !!When are events processed?
+ 
+ To answer the question "When are events processed?", we have to look a bit deeper into how
a form request is handled. This is separated in a couple of phases, more specifically the
following ones:
+ 
+ * Any outstanding events are broadcasted to the event listeners
+  The reason this is done is because events might have been collected while the form was
loaded with values by the binding framework.
+ 
+ * ProcessingPhaseListeners are informed that the LOAD_MODEL phase has ended.
+ 
+ * All widgets in the widget tree read their value from the request. If a widget decides
it has to produce an event, it is added to a global (i.e. form-level) list (but not yet executed).
+ 
+ * Once all widgets had the opportunity to read their value from the request, the events
are broadcasted to the event listeners. This assures that event listeners have access to the
values of all widgets in the tree.
+ 
+ * ProcessingPhaseListeners are informed that the READ_FROM_REQUEST phase has ended.
+ 
+ * It is possible that processing ends now. This usually happens when an action widget has
caused an event.
+ 
+ * All widgets in the widget tree validate themselves.
+ 
+ * ProcessingPhaseListeners are informed that the VALIDATE phase has ended.
+ 
+ 
+ ....
+ 
+ 
+ 
+ (to be continued)
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=Daniel , version: 4 on Fri Oct 31 13:28:35 2003
by 81.226.132.26

- Explain why the links that used to be here are relevant to Cocoon and they won't get deleted.
+ /
+ [Spitsbergen|http://www.spitsbergen.se]
+ [Greenland|http://www.greenlandtravel.org]
+ [Dogsledding|http://www.dogsledding.org]


Page: http://wiki.cocoondev.org/Wiki.jsp?page=Woody , version: 7 on Fri Oct 31 13:10:40 2003
by BrunoDumon

+ * [Event handling|WoodyEventHandling]


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyReference , version: 13 on Fri Oct 31 13:05:01
2003 by BrunoDumon

+ 
+   <wd:hint>...</wd:hint>
+   <wd:help>...</wd:help>
+   <wd:on-value-changed>
+     ...
+   </wd:on-value-changed>
+ The __wd:on-value-changed__ element specifies event handlers to be executed in case the
value of this field changes. See also [WoodyEventHandling].
+ 
+   <wd:help>...</wd:help>
+   <wd:hint>...</wd:hint>
+   <wd:help>...</wd:help>
+   <wd:hint>...</wd:hint>
+   <wd:help>...</wd:help>
+   <wd:hint>...</wd:hint>
+ !wd:action
+ 
+ Used to trigger an action event on the server side. Usually presented as a button the user
can press (though this is not required).
+ 
+ {{{
+ <wd:action id="..." action-command="...">
+   <wd:label>...</wd:label>
+   <wd:help>...</wd:help>
+   <wd:hint>...</wd:hint>
+   <wd:on-action>
+     ...
+   </wd:on-action>
+ </wd:action>
+ }}}
+ 
+ The action-command attribute specifies a name that will be part of the event generated by
this widget. It can be used to distinguish events originated from this wd:action from another
one.
+ 
+ For more information on how event handlers are defined, see [WoodyEventHandling].
+ 
+ !wd:repeater-action
+ 
+ This is a specific type of action widget that handles the much needed case of adding or
removing rows from a repeater.
+ 
+ {{{
+ <wd:repeater-action id="..." action-command="delete-rows|add-row" repeater="..." select="...">
+   <wd:label>...</wd:label>
+   <wd:help>...</wd:help>
+   <wd:hint>...</wd:hint>
+   <wd:on-activate>
+     ...
+   </wd:on-activate>
+ </wd:repeater-action>
+ }}}
+ 
+ The action-command attribute should have either the value "delete-rows" or "add-row".
+ 
+ If add-row is specified, the attribute repeater is required. If delete-rows is specified,
both the repeater and select attributes are required.
+ 
+ The repeater attribute should contain the id of the repeater widget on which this repeater-action
should act.
+ 
+ The select attribute should contain the id of the booleanfield widget (or any type of widget
who's getValue() method returns a boolean) that is part of the repeater and used to mark the
rows to be deleted.
+ 
+ wd:on-activate allows additional event handlers to be defined, see also [WoodyEventHandling].
+ 
- * __wd:action__: triggers an action event on the server side. Usually presented as a button
the user can press.



Mime
View raw message