You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ralph Goers <Ra...@dslextreme.com> on 2005/12/15 18:13:24 UTC

Add form widgets

I have been asked to look into how custom form widgets can be added.  
With the block structure in 2.2 this would imply that the widgets would 
need to be added to our own block.  How can we "append" to the widget 
definitions in cocoon-forms.xconf without touching that file since it 
will be internal to the forms block?

Ralph

Re: Add form widgets

Posted by Sylvain Wallez <sy...@apache.org>.
Ralph Goers wrote:
> Sylvain Wallez wrote:
>
>> Ralph Goers wrote:
>>
>>> I have been asked to look into how custom form widgets can be 
>>> added.  With the block structure in 2.2 this would imply that the 
>>> widgets would need to be added to our own block.  How can we 
>>> "append" to the widget definitions in cocoon-forms.xconf without 
>>> touching that file since it will be internal to the forms block?
>>
>> The structure of component management currently doesn't allow this, 
>> as the FormManager creates its own ServiceSelector, and therefore 
>> can't use the xconf includes. This is something that must be changed 
>> though.
>>
> Any ideas as to how?  This doesn't seem like it would apply to only 
> forms and that includes would really solve the problem.   Rather, it 
> would seem that a block should be able to "tell" the container to add 
> configuration data to some other block's configuration.

While adding the xconf include feature, I also heavily changed the way 
component selectors are managed (although this is totally transparent). 
The DefaultServiceSelector actually registers the component it manages 
in the CoreServiceManager, and does a lookup in that service manager 
when its select() method is called.

Simply put:
  selector.addComponent(hint, config)
      --> manager.addComponent(selectorRole + "/" + hint, config)

  selector.select(hint)
      --> return manager.lookup(selectorRole + "/" + hint)

The benefit of this approach is that a selector for a given role (e.g. 
datasources, source-factories) can be declared several times, as the 
selector basically delegates everything to the surrounding service 
manager, which manages all included files. The component space is 
effectively flattened.

As a side note, this also makes selector useseless, as you can directly 
call "manager.lookup(role + "/" + hint)".

This approach requires selectors to be direct children of the service 
manager in the container hierarchy. CForms currently defines additional 
levels: the DefaultFormManager creates a SimpleServiceSelector that 
holds all widget builders. This approach prevents flattening the 
component space in CForms, and therefore the use of includes to define 
additional custom widgets. Obviously we'll have to change this.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://bluxte.net                     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: Add form widgets

Posted by Ralph Goers <Ra...@dslextreme.com>.

Sylvain Wallez wrote:

> Ralph Goers wrote:
>
>> I have been asked to look into how custom form widgets can be added.  
>> With the block structure in 2.2 this would imply that the widgets 
>> would need to be added to our own block.  How can we "append" to the 
>> widget definitions in cocoon-forms.xconf without touching that file 
>> since it will be internal to the forms block?
>
>
> The structure of component management currently doesn't allow this, as 
> the FormManager creates its own ServiceSelector, and therefore can't 
> use the xconf includes. This is something that must be changed though.
>
>
Any ideas as to how?  This doesn't seem like it would apply to only 
forms and that includes would really solve the problem.   Rather, it 
would seem that a block should be able to "tell" the container to add 
configuration data to some other block's configuration.

Re: Add form widgets

Posted by Sylvain Wallez <sy...@apache.org>.
Ralph Goers wrote:
> I have been asked to look into how custom form widgets can be added.  
> With the block structure in 2.2 this would imply that the widgets 
> would need to be added to our own block.  How can we "append" to the 
> widget definitions in cocoon-forms.xconf without touching that file 
> since it will be internal to the forms block?

The structure of component management currently doesn't allow this, as 
the FormManager creates its own ServiceSelector, and therefore can't use 
the xconf includes. This is something that must be changed though.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://bluxte.net                     http://www.anyware-tech.com
Apache Software Foundation Member     Research & Technology Director


Re: Add form widgets

Posted by Reinhard Poetz <re...@apache.org>.
Ralph Goers wrote:
> I have been asked to look into how custom form widgets can be added.  
> With the block structure in 2.2 this would imply that the widgets would 
> need to be added to our own block.  How can we "append" to the widget 
> definitions in cocoon-forms.xconf without touching that file since it 
> will be internal to the forms block?

I think this is one of the fields where we have to learn more about the 
possibilities that blocks will give us. So no, I don't thing that there is *the* 
answer how this can be done. Same is true for the portal. (We had some very long 
threads about this about 10 months ago, but without having something working to 
experiment with it started to become very academic.)

-- 
Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}

                                        web(log): http://www.poetz.cc
--------------------------------------------------------------------