Hi Carsten,
yep, you are absolutely right, no parameters are enought to trigger the events. I was thinking about future actions we could implement inside this methods, and thought that passing the Binding implementation and a generic Object model (it could be a Bean or an XML document) should not be harmful.

Also, these methods could be called from binding implementations OR from FOM implementations (_javascript_ Form object and the javaflow Form object). I don't know which one is the best : binding implementations are contained in the forms block and packages, so that would preserve code integrity, but the code would be rather ugly since the loadFormFromModel and saveFormToModel can be called by the FOM object or from other bindings :

in every implementation of loadFormFromModel(Widget frmModel, Object objModel) :
if (frmModel instanceof Form) {
      ((Form)frmModel).loading(...);
}
same in saveFormToModel.

While placing it in FOM implementations produces less (just 2 classes ATM) and simpler code, but the FOM object code, which could be in another block/package (like javaflow), must call both binding method and form triggering methods, which is possibly more error prone.

You decide :)

Simone


Carsten Ziegeler wrote:
Simone Gianni wrote:
  
Hi Carsten,
yes, you are right, those events are there but are never sent. I wrote
about it here
http://issues.apache.org/jira/browse/COCOON-1685#action_12367041 .

Unfortunately, I don't know which is the best place to broadcast these
events. The BindingManager returns a Binding instance (which could be
anything) and on that instance the save and load methods are called
directly form the _javascript_/javaflow FOM implementations. Maybe we
could add a loading(Binding binding, Object model) and saving(..)
methods to the form, and have them called either by the various base
binding classes or the _javascript_/javaflow FOM implementations, to
notify the form that its being loaded/saved. From there we could then
broadcast the events, and also do something else in the future.
    
I'm not sure I can follow you completly here :) - I'm not an expert in
CForms;
I think we should add some "inform" method for loading/saving to the
Form object (like you say above) and invoke this from the various
Binding implementations.
Now, I'm not sure about the signature of these methods. I think we
neither need to pass the Binding nor the Objectmodel into the form
object; just an invokation should be sufficient. This reduces the
dependencies.

WDYT?

Carsten
  
--
Simone Gianni

Reply via email to