You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Jakob Praher <jp...@yahoo.de> on 2003/02/13 15:12:11 UTC

Re: [XMLForm] Found my problem - Howto resolve this in general? (BUG)

Am Don, 2003-02-13 um 15.06 schrieb ivelin:
> I think that the easiest way to correct this is to keep AllLanguages as an
> empty collection as shown in the examples.

if you mean the concrete value, that is "ref" bound, should not be null,
in my case the *language* property, yes.

anyhow, I think this is a bug, since it is not needed, and I think many
people will stumble over this one. ( a guy from swisscom had the same
problem )

I have enough understanding to patch the XMLFormTransformer, but can't
submit a patch before the next week as I am on a tight schedule for a
project I do with XMLForms.

btw: I think it is great.

-- Jakob 

> 
> 
> 
> -=Ivelin=-
> ----- Original Message -----
> From: "Jakob Praher" <jp...@yahoo.de>
> To: <co...@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


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