cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ivelin" <ive...@apache.org>
Subject Re: [XMLForm] Found my problem - Howto resolve this in general? (BUG)
Date Thu, 13 Feb 2003 14:06:49 GMT
I think that the easiest way to correct this is to keep AllLanguages as an
empty collection as shown in the examples.



-=Ivelin=-
----- Original Message -----
From: "Jakob Praher" <jpraher@yahoo.de>
To: <cocoon-dev@xml.apache.org>
Sent: Wednesday, February 12, 2003 2:37 PM
Subject: [XMLForm] Found my problem - Howto resolve this in general? (BUG)


> hi all,
>
> did some hard core research, and found the following bug in the
> XMLFormTransformer.java:
>
> the "unrolling" of the "recorded" tags like "itemset" and "repeat" is
> only done if:
>
> class XMLFormTransformer .... {
> ...
> Object _value ;
> ...
>
> ...
> void unrollItemSetTag( DocumentFragment aFragment ) {
> ...
> while ( ... )
> ..
> if ( _value != null ) {
> /* do the stream of the fragment */
> }
> }
> ...
> ...
>
> now it comes:
> _value is set by Form.getValue( xpath ), which is the @ref Attribute of
> according the xmlform element.
>
> I think the _value null-checking is done in order to test that a valid
> form control was found before, but _value gets also null if there is a
> correct field in the object but the bean property is not initialized for
> instance String or List, like that:
>
> class Bean {
>
> Map    allLangues = ...
> String language;
>
> public Set allLanguages( ) {
> return allLanguages.entrySet( );
> }
> public String getLanguage( ) { ... }
> public void setLanguage( String value ) { ... }
> }
>
>
> now given this example, if you to the following control:
>
> <xf:selectOne ref="language" >
>   <xf:itemset nodeset="/allLanguages">
>     <xf:caption ref="value" />
>     <xf:value ref="key" />
>   </xf:itemset>
> </xf:selectOne>
>
> this will never display an initialized listbox, as:
>
> inside XMLFormTransformer:
>
> _value = Form.getValue( "language" );
>
> will be null, when the form is in the start phase.
>
> so I propose changing the _value checking to a boolean state variable.
>
> like:
> boolean haveRefBoundElement = false;
>
> and after doing:
> in "startELementSimpleFIeld( ... ) "
> value_ = form.getValue( ref )
> haveRefBoundElement = true;
>
> and then change the streaming part of the
>
> void unrollItemSetTag( DocumentFragment docFragment )
> ....
> while ( ... ) {
> ..
> if ( haveRefBoundElement )
> {
>   // stream back the recorder repeat content
>   DOMStreamer streamer = new DOMStreamer( this, this);
>   streamer.stream( docFragment );
> }
> ..
> }
>
>
> -- Jakob
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message