cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stev...@outerthought.org
Subject [WIKI-UPDATE] OJBBlock WoodyActionSample OJBWithJDO WoodySample WoodyWidgetReference Woody Sun Nov 9 20:00:08 2003
Date Sun, 09 Nov 2003 19:00:08 GMT
Page: http://wiki.cocoondev.org/Wiki.jsp?page=OJBBlock , version: 9 on Sun Nov  9 18:30:04
2003 by TonyCollen

- !!OJB Block: A O/R mapping tool.
+ !!OJB Block: An O/R mapping tool.
?               +

+ 
+ __See Also__: [OJBWithJDO]


Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyActionSample , version: 1 on Sun Nov  9
18:35:03 2003 by BrunoDumon

New page created:
+ !!!Woody sample using actions (map:act)
+ 
+ Below we show how the sample from [WoodySample] can be done using actions. The sourcecode
of these actions is included with the Cocoon source code: 
+ [MakeFormAction|http://cvs.apache.org/viewcvs.cgi/*checkout*/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/acting/MakeFormAction.java?rev=HEAD]
and [HandleFormSubmitAction|http://cvs.apache.org/viewcvs.cgi/*checkout*/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/acting/HandleFormSubmitAction.java?rev=HEAD].
+ 
+ {{{
+ <map:match pattern="registration">
+   <map:select type="request-method">
+     <map:when test="GET">
+       <map:act type="woody-make-form">
+         <map:parameter name="form-definition" value="forms/registration.xml"/>
+         <map:parameter name="attribute-name" value="registrationform"/>
+       </map:act>
+     </map:when>
+     <map:otherwise>
+       <map:act type="woody-handle-form-submit">
+         <map:parameter name="form-definition" value="forms/registration.xml"/>
+         <map:parameter name="attribute-name" value="registrationform"/>
+ 
+         <map:generate type="serverpages" src="forms/registration_success.xsp"/>
+         <map:serialize/>
+       </map:act>
+     </map:otherwise>
+   </map:select>
+ 
+   <map:generate src="forms/registration_template.xml"/>
+   <map:transform type="woody">
+     <map:parameter name="attribute-name" value="registrationform"/>
+   </map:transform>
+   <map:transform type="i18n">
+     <map:parameter name="locale" value="en-US"/>
+   </map:transform>
+   <map:transform src="resources/woody-samples-styling.xsl"/>
+   <map:transform type="i18n">
+     <map:parameter name="locale" value="en-US"/>
+   </map:transform>
+   <map:serialize/>
+ </map:match>
+ }}}
+ 
+ !How this sitemap works
+ 
+ * based on the request method (GET or POST), we decide whether this is a first-time request
of the form (GET) or whether this is a form submit (POST).
+ * in case of a __first-time request__, the ''woody-make-form'' action will simply create
a form instance and put it in a request attribute (this is a storage area that lasts for the
duration of the request)
+ * in case of a __form submit__, the ''woody-handle-form-submit'' action will create a form
instance, and let it process the request and validate it. If validation was successful, it
returns non-null (so that the contents of the __<map:act>__ element will be executed),
otherwise it returns null (so that the pipeline below the map:act will be executed).
+ * in case of successful validation, we simply execute an XSP page (see example below). In
"real-life" situations, this may also call an action, do a redirect, or whathever.
+ * in case validation failed, or in case the form is displayed for the first time, the pipeline
below the selector is executed.
+ 
+ !!registration_success.xsp
+ 
+ Here's an example of what the XSP could look like.
+ 
+ {{{
+ <?xml version="1.0"?>
+ <xsp:page language="java"
+   xmlns:xsp="http://apache.org/xsp">
+ 
+   <xsp:structure>
+     <xsp:include>org.apache.cocoon.woody.formmodel.*</xsp:include>
+   </xsp:structure>
+ 
+   <page>
+     <title>Registration result</title>
+     <content>
+       <xsp:logic>
+         // get reference to form and some of the widgets on it
+         Form form = (Form)request.getAttribute("registrationform");
+         Field name = (Field)form.getWidget("name");
+       </xsp:logic>
+ 
+       Registration was successful for <xsp:expr>name.getValue()</xsp:expr>
+     </content>
+   </page>
+ </xsp:page>
+ }}}
+ 


Page: http://wiki.cocoondev.org/Wiki.jsp?page=OJBWithJDO , version: 6 on Sun Nov  9 18:35:43
2003 by TonyCollen

- * This is a first attemp to integrate OJB-JDO with Cocoon. I am also a OJB newbie. But after
a week studing about OJB and JDO I think OJB with JDO is a good way to fill the current "model"
gap in the MVC design.
+ * This is a first attempt to integrate OJB-JDO with Cocoon. I am also a OJB newbie. But
after a week studing about OJB and JDO I think OJB with JDO is a good way to fill the current
"model" gap in the MVC design.
?                         +

- * Currently I am trying to create a component that will create a __PersistentManagerFactory__
just once for all the application.  __Done__ see [OJBBlock]\\
?                                                                                        
                                                   ^

+ * Currently I am trying to create a component that will create a __PersistentManagerFactory__
just once for all the application.  __Done__: See [OJBBlock]\\
?                                                                                        
                                                  + ^



Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodySample , version: 22 on Sun Nov  9 18:43:27
2003 by BrunoDumon

-     sendPage("registration-success-pipeline", bizdata);
+     cocoon.sendPage("registration-success-pipeline", bizdata);
?     +++++++



Page: http://wiki.cocoondev.org/Wiki.jsp?page=WoodyWidgetReference , version: 7 on Sun Nov
 9 18:25:32 2003 by BrunoDumon

+ [1] field widget\\
+ [2] multivaluefield widget\\
+ [3] booleanfield widget\\
+ [4] repeater widget\\
+ [5] output widget\\
+ [6] action widget\\
+ [7] submit widget\\
+ [8] repeater-action widget\\
+ [9] row-action widget\\
+ [10] aggregatefield widget\\
+ 
- !!field widget
+ !![#1] field widget
?   +++++

+ 
+ [[pasted the following text here from the sample, still needs some editing to fit in]
+ 
+ A field widget can be associated with a datatype. The function of the datatype is to convert
the string value entered by the user to a more specific type like a number or a date (and
vice versa, convert them back to strings) (this part is actually delegated to a seperate object:
a Convertor). The datatype also performs the validation. (This split-up between "widget" and
"datatype" is specific for the field widget -- it is perfectly possible to make widgets that
have nothing to do with datatypes). In this way, a field widget contains strongly-typed data.
For example, if you associated a __long__ datatype with a field widget, then you can be sure
that when you retrieve the widget's value, you will get a Long object after the form was validated
successfully.
+ 
+ The reasoning behind the __base__ attribute on the __wd:datatype__ element is that you are
actually defining a new datatype, based on the built-in "string" or "long" datatype, and customise
it with validation rules (and possibly other parameters).
+ 
+ !Defining a selection list for a field
+ A field widget can furthermore be associated with a selection list. This makes that the
field widget could be rendered either as a textbox or a list, depending on whether its datatype
has a selection list. For an example of selection lists, see the "Form1" example provided
with Woody. The selection-list is related with the datatype: the values in the selection-list
should be of the same type as the datatype.
+ 
+ [http://outerthought.net/~bruno/images/field_datatype_relation.png]
+ 
+ If we wouldn't make these datatype and selection list associations, we would need to create
specific widgets for each possible combination: StringField, LongField, DateField, StringSelectionList,
LongSelectionList, ...
- !!multivaluefield widget
+ !![#2] multivaluefield widget
?   +++++

- !!booleanfield widget
+ !![#3] booleanfield widget
?   +++++

- !!repeater widget
+ !![#4] repeater widget
?   +++++

- !!output widget
+ !![#5] output widget
?   +++++

- !!action widget
+ !![#6] action widget
?   +++++

- !!submit widget
+ !![#7] submit widget
?   +++++

- !!repeater-action widget
+ !![#8] repeater-action widget
?   +++++

- !!row-action widget
+ !![#9] row-action widget
?   +++++

- !!other widgets:
+ !![#10] aggregatefield widget
- Widgets yet to be documented:
+ used to edit the value of multiple fields through one textbox
- * __wd:aggregatefield__: used to edit the value of multiple fields through one textbox
+ documentation to be done


Page: http://wiki.cocoondev.org/Wiki.jsp?page=Woody , version: 19 on Sun Nov  9 18:52:42 2003
by BrunoDumon

+ Elsewhere:
+ * [WoodyHibernateAndFlow]
+ * [OJBBlock] contains a Woody sample
+ 
+ 
+ [[Nov 9, 2003]
+ * Put CSS styles in separate woody.css file (Bruno)
+ * Added enum datatype based on type-safe enumeration pattern (Ugo)
+ * Avoiding NPE's in field widget when doing setValue(null) (Vadim)
+ * cleaned up woody_flow_example.js to not put the form in a request attribute anymore (Bruno)
+ * Read access to MultiValueField through flow script (Daniel F.)
+ * Fixed problem in repeater binding when new row id's didn't have null as value (Bruno)
+ * Updated registration form example to use flowscript (Bruno)
+ * Documentation updates (Bruno)



Mime
View raw message