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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
> For additional commands, email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to