You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Richard Wallace <rw...@thewallacepack.net> on 2006/04/19 00:35:10 UTC

updateActionListener questions (re: Shale Clay mostly)

I'm trying to make use of the Tomahawk updateActionListener action 
listener in a Shale Clay based app and was having problems getting it to 
work properly.  After doing some debugging I realized that the problem 
was that I was trying to map to the property "property" on the 
UpdateActionListener class thinking that the tag "property" attribute 
just passed the value through. 

On closer inspection I realized this isn't the case and that the 
UpdateActionListenerTag itself takes the value set for the "property" 
attribute and creates a value binding which is passed to the 
UpdateActionListener with the setPropertyBinding() method.  Similarly, 
the UpdateActionListenerTag also figures out if the "value" attribute is 
supposed to be an actual value object or a value binding.

I searched this list and this was also a problem when trying to 
integrate with Facelets.  So my question is why is all this work done in 
the UpdateActionListenerTag class instead of in the UpdateActionListener 
class itself?  Then the tag class would just pass the values through 
like all the other tags in JSF.

Rich

Re: updateActionListener questions (re: Shale Clay mostly)

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi Rich,

can you please go ahead and open a jira ticket on it?
If you upload the patch file, don't forget to press "patch available"

Thanks,
Matthias

On 4/19/06, Richard Wallace <rw...@thewallacepack.net> wrote:
> Richard Wallace wrote:
> > Martin Marinschek wrote:
> >> I was already wondering myself. It would fit better in the component,
> >> if there is one.
> >>
> >> Manfred?
> >>
> >> @Rich: Can you do a patch - would be great.
> >>
> >>
> > On closer inspection I think I see why it is in the tag class rather
> > than the component itself.  It uses the
> > UIComponentTag.isValueReference() to determine if the value attribute
> > is a value binding or not.  I think that should be fine where it is,
> > so just adding a setProperty(String) method and creating a value
> > binding from that will work.  I tested it in my own app by subclassing
> > UpdateActionListener and adding the method.  Works as it should.
> > Attached is a patch of UpdateActionListener and
> > UpdateActionListenerTag to add the setProperty(String) method and
> > create the value binding and in the tag class to just pass along the
> > string value to the component rather than create the value binding
> > there.  I'm open to comments/criticisms.
> >
> > Rich
> Ok, I was wrong.  You do need to also change the setValue() method.  I'm
> not sure about the best way to do this, so I just assumed it would be a
> value binding and everything works as it should:
>
>     public void setValue (Object value) {
>         setValueBinding (FacesContext.getCurrentInstance
> ().getApplication ().createValueBinding (value.toString ()));
>     }
>
> >> regards,
> >>
> >> Martin
> >>
> >> On 4/19/06, Richard Wallace <rw...@thewallacepack.net> wrote:
> >>
> >>> I'm trying to make use of the Tomahawk updateActionListener action
> >>> listener in a Shale Clay based app and was having problems getting
> >>> it to
> >>> work properly.  After doing some debugging I realized that the problem
> >>> was that I was trying to map to the property "property" on the
> >>> UpdateActionListener class thinking that the tag "property" attribute
> >>> just passed the value through.
> >>>
> >>> On closer inspection I realized this isn't the case and that the
> >>> UpdateActionListenerTag itself takes the value set for the "property"
> >>> attribute and creates a value binding which is passed to the
> >>> UpdateActionListener with the setPropertyBinding() method.  Similarly,
> >>> the UpdateActionListenerTag also figures out if the "value"
> >>> attribute is
> >>> supposed to be an actual value object or a value binding.
> >>>
> >>> I searched this list and this was also a problem when trying to
> >>> integrate with Facelets.  So my question is why is all this work
> >>> done in
> >>> the UpdateActionListenerTag class instead of in the
> >>> UpdateActionListener
> >>> class itself?  Then the tag class would just pass the values through
> >>> like all the other tags in JSF.
> >>>
> >>> Rich
> >>>
> >>>
> >>
> >>
> >> --
> >>
> >> http://www.irian.at
> >>
> >> Your JSF powerhouse -
> >> JSF Consulting, Development and
> >> Courses in English and German
> >>
> >> Professional Support for Apache MyFaces
> >>
> >
> > ------------------------------------------------------------------------
> >
> > Index: src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java
> > ===================================================================
> > --- src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java (revision 395279)
> > +++ src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java (working copy)
> > @@ -79,7 +79,7 @@
> >                  FacesContext facesContext = FacesContext.getCurrentInstance();
> >                  Application application = facesContext.getApplication();
> >                  UpdateActionListener al = new UpdateActionListener();
> > -                al.setPropertyBinding(application.createValueBinding(_property));
> > +                al.setProperty(_property);
> >                  if (UIComponentTag.isValueReference(_value))
> >                  {
> >                      al.setValueBinding(application.createValueBinding(_value));
> > Index: src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java
> > ===================================================================
> > --- src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java    (revision 395279)
> > +++ src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java    (working copy)
> > @@ -68,6 +68,11 @@
> >      private ValueBinding _valueBinding;
> >      private Converter _converter;
> >
> > +    public void setProperty (String property) {
> > +        setPropertyBinding (FacesContext.getCurrentInstance ().getApplication ().createValueBinding (property));
> > +    }
> > +
> > +
> >      public void setPropertyBinding(ValueBinding propertyBinding)
> >      {
> >          _propertyBinding = propertyBinding;
> >
>
>


--
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
http://jroller.com/page/mwessendorf
mwessendorf-at-gmail-dot-com

Re: updateActionListener questions (re: Shale Clay mostly)

Posted by Richard Wallace <rw...@thewallacepack.net>.
Richard Wallace wrote:
> Martin Marinschek wrote:
>> I was already wondering myself. It would fit better in the component,
>> if there is one.
>>
>> Manfred?
>>
>> @Rich: Can you do a patch - would be great.
>>
>>   
> On closer inspection I think I see why it is in the tag class rather 
> than the component itself.  It uses the 
> UIComponentTag.isValueReference() to determine if the value attribute 
> is a value binding or not.  I think that should be fine where it is, 
> so just adding a setProperty(String) method and creating a value 
> binding from that will work.  I tested it in my own app by subclassing 
> UpdateActionListener and adding the method.  Works as it should.  
> Attached is a patch of UpdateActionListener and 
> UpdateActionListenerTag to add the setProperty(String) method and 
> create the value binding and in the tag class to just pass along the 
> string value to the component rather than create the value binding 
> there.  I'm open to comments/criticisms.
>
> Rich
Ok, I was wrong.  You do need to also change the setValue() method.  I'm 
not sure about the best way to do this, so I just assumed it would be a 
value binding and everything works as it should:

    public void setValue (Object value) {
        setValueBinding (FacesContext.getCurrentInstance 
().getApplication ().createValueBinding (value.toString ()));
    }

>> regards,
>>
>> Martin
>>
>> On 4/19/06, Richard Wallace <rw...@thewallacepack.net> wrote:
>>  
>>> I'm trying to make use of the Tomahawk updateActionListener action
>>> listener in a Shale Clay based app and was having problems getting 
>>> it to
>>> work properly.  After doing some debugging I realized that the problem
>>> was that I was trying to map to the property "property" on the
>>> UpdateActionListener class thinking that the tag "property" attribute
>>> just passed the value through.
>>>
>>> On closer inspection I realized this isn't the case and that the
>>> UpdateActionListenerTag itself takes the value set for the "property"
>>> attribute and creates a value binding which is passed to the
>>> UpdateActionListener with the setPropertyBinding() method.  Similarly,
>>> the UpdateActionListenerTag also figures out if the "value" 
>>> attribute is
>>> supposed to be an actual value object or a value binding.
>>>
>>> I searched this list and this was also a problem when trying to
>>> integrate with Facelets.  So my question is why is all this work 
>>> done in
>>> the UpdateActionListenerTag class instead of in the 
>>> UpdateActionListener
>>> class itself?  Then the tag class would just pass the values through
>>> like all the other tags in JSF.
>>>
>>> Rich
>>>
>>>     
>>
>>
>> -- 
>>
>> http://www.irian.at
>>
>> Your JSF powerhouse -
>> JSF Consulting, Development and
>> Courses in English and German
>>
>> Professional Support for Apache MyFaces
>>   
>
> ------------------------------------------------------------------------
>
> Index: src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java
> ===================================================================
> --- src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java	(revision 395279)
> +++ src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListenerTag.java	(working copy)
> @@ -79,7 +79,7 @@
>                  FacesContext facesContext = FacesContext.getCurrentInstance();
>                  Application application = facesContext.getApplication();
>                  UpdateActionListener al = new UpdateActionListener();
> -                al.setPropertyBinding(application.createValueBinding(_property));
> +                al.setProperty(_property);
>                  if (UIComponentTag.isValueReference(_value))
>                  {
>                      al.setValueBinding(application.createValueBinding(_value));
> Index: src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java
> ===================================================================
> --- src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java	(revision 395279)
> +++ src/main/java/org/apache/myfaces/custom/updateactionlistener/UpdateActionListener.java	(working copy)
> @@ -68,6 +68,11 @@
>      private ValueBinding _valueBinding;
>      private Converter _converter;
>  
> +    public void setProperty (String property) {
> +        setPropertyBinding (FacesContext.getCurrentInstance ().getApplication ().createValueBinding (property));
> +    }    
> +
> +
>      public void setPropertyBinding(ValueBinding propertyBinding)
>      {
>          _propertyBinding = propertyBinding;
>   


Re: updateActionListener questions (re: Shale Clay mostly)

Posted by Richard Wallace <rw...@thewallacepack.net>.
Martin Marinschek wrote:
> I was already wondering myself. It would fit better in the component,
> if there is one.
>
> Manfred?
>
> @Rich: Can you do a patch - would be great.
>
>   
On closer inspection I think I see why it is in the tag class rather 
than the component itself.  It uses the 
UIComponentTag.isValueReference() to determine if the value attribute is 
a value binding or not.  I think that should be fine where it is, so 
just adding a setProperty(String) method and creating a value binding 
from that will work.  I tested it in my own app by subclassing 
UpdateActionListener and adding the method.  Works as it should.  
Attached is a patch of UpdateActionListener and UpdateActionListenerTag 
to add the setProperty(String) method and create the value binding and 
in the tag class to just pass along the string value to the component 
rather than create the value binding there.  I'm open to 
comments/criticisms.

Rich
> regards,
>
> Martin
>
> On 4/19/06, Richard Wallace <rw...@thewallacepack.net> wrote:
>   
>> I'm trying to make use of the Tomahawk updateActionListener action
>> listener in a Shale Clay based app and was having problems getting it to
>> work properly.  After doing some debugging I realized that the problem
>> was that I was trying to map to the property "property" on the
>> UpdateActionListener class thinking that the tag "property" attribute
>> just passed the value through.
>>
>> On closer inspection I realized this isn't the case and that the
>> UpdateActionListenerTag itself takes the value set for the "property"
>> attribute and creates a value binding which is passed to the
>> UpdateActionListener with the setPropertyBinding() method.  Similarly,
>> the UpdateActionListenerTag also figures out if the "value" attribute is
>> supposed to be an actual value object or a value binding.
>>
>> I searched this list and this was also a problem when trying to
>> integrate with Facelets.  So my question is why is all this work done in
>> the UpdateActionListenerTag class instead of in the UpdateActionListener
>> class itself?  Then the tag class would just pass the values through
>> like all the other tags in JSF.
>>
>> Rich
>>
>>     
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>   


Re: updateActionListener questions (re: Shale Clay mostly)

Posted by Martin Marinschek <ma...@gmail.com>.
I was already wondering myself. It would fit better in the component,
if there is one.

Manfred?

@Rich: Can you do a patch - would be great.

regards,

Martin

On 4/19/06, Richard Wallace <rw...@thewallacepack.net> wrote:
> I'm trying to make use of the Tomahawk updateActionListener action
> listener in a Shale Clay based app and was having problems getting it to
> work properly.  After doing some debugging I realized that the problem
> was that I was trying to map to the property "property" on the
> UpdateActionListener class thinking that the tag "property" attribute
> just passed the value through.
>
> On closer inspection I realized this isn't the case and that the
> UpdateActionListenerTag itself takes the value set for the "property"
> attribute and creates a value binding which is passed to the
> UpdateActionListener with the setPropertyBinding() method.  Similarly,
> the UpdateActionListenerTag also figures out if the "value" attribute is
> supposed to be an actual value object or a value binding.
>
> I searched this list and this was also a problem when trying to
> integrate with Facelets.  So my question is why is all this work done in
> the UpdateActionListenerTag class instead of in the UpdateActionListener
> class itself?  Then the tag class would just pass the values through
> like all the other tags in JSF.
>
> Rich
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces