cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jonas Ekstedt <ekst...@ibg.uu.se>
Subject Re: A widget framework (long)
Date Thu, 28 Oct 2004 12:43:46 GMT
On Thu, 2004-10-28 at 12:50, Reinhard Poetz wrote:
> After reading it once, one question: Do you see any way to integrate your ideas 
> into Cocoon Forms?

One part that I believe could be incorporated into CForms would be how
the view model is populated. 

Today each widget populates itself from the Request. This means that the
widget has to be aware of whether it should populate itself or not.

If instead we build a map at render time of the parameter name of each
widget field that has been rendered and expects to be populated from the
request (ie. form fields), then this map can be used to collect values
from the request and afterwards used to populate the widgets. This means
that if a widget wasn't rendered as an input widget then it won't be
affected during population.

This is what the RequestProcessor does. Tags that render form fields
will add parameter names to the RequestProcessor. After 
sendPageAndWait() returns you call RequestProcessor.process() which will
use this map to only retrieve the parameters that has been registered.

The registration of parameters would be done in the widget code that
actually renders the widget.

Another part of the framework that stands alone from the rest is the
event handling. One place I think it would make sense to add it is in
FOM_Cocoon so that you could do:

-----------------------------------------------
function public_myWizard() {

  cocoon.setEventHandler(new WizardHandler());
  cocoon.sendPageAndWait(...);
  cocoon.sendPage("finished.html");
}

function WizardHandler() {}

WizardHandler.prototype.action_previous = function(...) {...}
WizardHandler.prototype.action_next = function(...) {...}
-----------------------------------------------

The sendPageAndWait function would check if an event handler has been
set. If so it will further check if the request parameter "cocoon-event"
is set and then fire off the corresponding function.

// Jonas


--
> Reinhard
-- 
---------------------------------------------------------------
Address  :   Rackarbergsg 74, 752 32 UPPSALA
Phone    :   018-50 69 28, 0768-767 747



Mime
View raw message