Derek Hohls wrote:
Bruno

Thanks for the brief replies - yes, some things are cleared
up but not all.

1. What is the role/purpose of the "woody2.js" file that you say
is located in the woody/forms jar?   What fucntions does it
contain?  Do I always need to load it??


what it provides is easily understood when you read the script: http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/woody2.js?rev=1.13&view=auto

main job is thus defining the Form object
and also providing the convenience flowscript function 'woody' (at the end of the file)


you (only) need to load it if you want to use those features in your scripts

alternatively you can copy paste some ideas from there into your own custom approach

2. What does the "Form" object look like?


see script
this is a Form js-object-prototype, not to be confused with the class o.a.c.woody.formmodel.Form


3. What does the getModel() function do?


see script


Form.prototype.getModel = function() {
    return this.formWidget;
}


where (stolen from the constructor:)


this.form = formMgr.createForm(src);

which means that this.form points to the actual Java object instance
as returned by the form-manager, while

this.formWidget = new Widget(this.form)

formWidget seems to wrap that into the js api of ScriptableWidget


point is that the Woody stuff is all written in Java, and that the Rhino JS we use gives you seamless access to those Java objects directly.


however, since js != java, and the coding habbits somewhat differ we provide some kind of matching-object implementations known as the ScriptableXXX classes that allow more js-like programming features, for the beloved woody-widget that class is called the o.a.c.woody.flow.javascript.ScriptableWidget

e.g.
        widget.parent = whatever;
in stead of
        widget.setParent(whatever);

might be nice to look at the scriptable thing as well to help your understanding:

http://cvs.apache.org/viewcvs.cgi/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/flow/javascript/ScriptableWidget.java?rev=1.9&view=auto

HTH,
-marc=

Thanks
Derek


[EMAIL PROTECTED] 2004/05/10 06:28:22 PM >>>

On Mon, 2004-05-10 at 09:02, Derek Hohls wrote:


There are some simple things I am failing to understand in
the creation of forms (Woody) and their interaction with control flow.


I have tried to reproduce a stripped down version of the 'registration' sample shown in the WoodySample wiki page (and also shipped as a sample in Cocoon 2.1.3). Although it works, there are some areas that unclear, even after perusal of the wiki notes and re-reading the code.

2. I do not understand how the following operates:


cocoon.load("resource://org/apache/cocoon/woody/flow/javascript/woody2.js");


where is this "js" located - a separate file? what is its purpose? The "cocoon.load" function is supposed to load
a script specified by the URI - but how is the above URI
interpreted?


it loads a resource from the classloader. The js file is part of the
woody/forms jar


3.  Where is the object "Form" that appears in:
var form = new Form("forms/registration.xml");
defined?  [This object, I assume, also contains the getModel()
function, whose role is also unclear...?]


in the above mentioned js file


4. I see there is a def2binding.xsl file in the /resources
directory - is this used in the sample and, if so, how?


no, it isn't used.

short answers, hope it's clear.


and for what reason?


I am sure all of this is meant to be obvious, but right now I am floundering and would appreciate any insights!

Thanks
Derek

-- Marc Portier http://outerthought.org/ Outerthought - Open Source, Java & XML Competence Support Center Read my weblog at http://blogs.cocoondev.org/mpo/ [EMAIL PROTECTED] [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to