You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Bruno Dumon <br...@outerthought.org> on 2004/03/25 13:41:04 UTC

forms proposal: widget attributes

I found the possibility to add arbitrairy attributes to widgets, made
possible in the v2 forms flowscript integration, to be a quite nice
feature. However, that feature only exists in the javascript model. This
is a problem when one wants to pass back the form model to java code
that also needs access to the information stored in there.

Therefore I propose to extend the Widget interface with the following
methods:

Object getAttribute(String key);

void setAttribute(String key, Object value);

Implementation-wise, the map needed to store these attributes would only
be created when the first attribute gets set, to minize the memory and
performance impact.

Whether it is possible to automatically store the attributes set in
javascript in the underlying Java widget, I wouldn't know. Chris?

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: forms proposal: widget attributes

Posted by Bruno Dumon <br...@outerthought.org>.
On Thu, 2004-03-25 at 17:24, Sylvain Wallez wrote:
> Bruno Dumon wrote:
> 
> >I found the possibility to add arbitrairy attributes to widgets, made
> >possible in the v2 forms flowscript integration, to be a quite nice
> >feature. However, that feature only exists in the javascript model. This
> >is a problem when one wants to pass back the form model to java code
> >that also needs access to the information stored in there.
> >
> >Therefore I propose to extend the Widget interface with the following
> >methods:
> >
> >Object getAttribute(String key);
> >
> >void setAttribute(String key, Object value);
> >
> >Implementation-wise, the map needed to store these attributes would only
> >be created when the first attribute gets set, to minize the memory and
> >performance impact.
> >  
> >
> 
> +1. This is already done on Form, so it's just a matter or moving the 
> corresponding code to AbstractWidget.

Ah, cool. Done.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: forms proposal: widget attributes

Posted by Christopher Oliver <re...@verizon.net>.
Sylvain Wallez wrote:

> Bruno Dumon wrote:
>
>> I found the possibility to add arbitrairy attributes to widgets, made
>> possible in the v2 forms flowscript integration, to be a quite nice
>> feature. However, that feature only exists in the javascript model. This
>> is a problem when one wants to pass back the form model to java code
>> that also needs access to the information stored in there.
>>
>> Therefore I propose to extend the Widget interface with the following
>> methods:
>>
>> Object getAttribute(String key);
>>
>> void setAttribute(String key, Object value);
>>
>> Implementation-wise, the map needed to store these attributes would only
>> be created when the first attribute gets set, to minize the memory and
>> performance impact.
>>  
>>
>
> +1. This is already done on Form, so it's just a matter or moving the 
> corresponding code to AbstractWidget.
>
>> Whether it is possible to automatically store the attributes set in
>> javascript in the underlying Java widget, I wouldn't know. Chris?
>>  
>>
Yes, it's possible. But it may be problematic because in some cases 
you'll end up storing JavaScript objects as attributes in the Java 
widget object which would not be useful in Java code.

Chris

Re: forms proposal: widget attributes

Posted by Sylvain Wallez <sy...@apache.org>.
Bruno Dumon wrote:

>I found the possibility to add arbitrairy attributes to widgets, made
>possible in the v2 forms flowscript integration, to be a quite nice
>feature. However, that feature only exists in the javascript model. This
>is a problem when one wants to pass back the form model to java code
>that also needs access to the information stored in there.
>
>Therefore I propose to extend the Widget interface with the following
>methods:
>
>Object getAttribute(String key);
>
>void setAttribute(String key, Object value);
>
>Implementation-wise, the map needed to store these attributes would only
>be created when the first attribute gets set, to minize the memory and
>performance impact.
>  
>

+1. This is already done on Form, so it's just a matter or moving the 
corresponding code to AbstractWidget.

>Whether it is possible to automatically store the attributes set in
>javascript in the underlying Java widget, I wouldn't know. Chris?
>  
>

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }