You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by ohfaces <ne...@yahoo.com> on 2007/06/01 18:38:47 UTC

How do I get the ValueBinding details for a given UIComponent?

I need to get the ValueBinding details for a given UIComponent on the fly - I
wanted to write a generic method which will allow me to get the ValueBinding
details once I get the UIComponent.

Now, there is a method on the UIComponent - getValueBinding(String expr) but
it expects me to pass the expression for each of these. I do have a pattern
e.g. ID_x where x is an integer. So, this is not generic enough - is there
any way to get the ValueBinding for a UIComponent without passing the
expression and then iterate through it to get to the required ValueBinding?

Thanks in advance!
-- 
View this message in context: http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10916368
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How do I get the ValueBinding details for a given UIComponent?

Posted by Andrew Robinson <an...@gmail.com>.
What comes to mind:

Map attributes = component.getAttributes();
for (Object key : attributes.keySet())
{
  ValueBinding vb = component.getValueBinding(key.toString());
  if (vb != null) ...
}

On 6/1/07, ohfaces <ne...@yahoo.com> wrote:
>
>
> I did that earlier - should have posted this one too. I couldn't figure out
> how to get the valuebinding details off it though ... Is there a particular
> key I should be looking for?
>
> Thanks in advance!
>
>
> Andrew Robinson-5 wrote:
> >
> > The valueBindingMap of UIComponentBase is not exposed through a method
> > that allows access to the keys or values, only one at a time. You can
> > however get access to all of the component's attributes through
> > "UIComponent.getAttributes() : Map".
> >
> > On 6/1/07, ohfaces <ne...@yahoo.com> wrote:
> >>
> >> I need to get the ValueBinding details for a given UIComponent on the fly
> >> - I
> >> wanted to write a generic method which will allow me to get the
> >> ValueBinding
> >> details once I get the UIComponent.
> >>
> >> Now, there is a method on the UIComponent - getValueBinding(String expr)
> >> but
> >> it expects me to pass the expression for each of these. I do have a
> >> pattern
> >> e.g. ID_x where x is an integer. So, this is not generic enough - is
> >> there
> >> any way to get the ValueBinding for a UIComponent without passing the
> >> expression and then iterate through it to get to the required
> >> ValueBinding?
> >>
> >> Thanks in advance!
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10916368
> >> Sent from the MyFaces - Users mailing list archive at Nabble.com.
> >>
> >>
> >
> >
>
> --
> View this message in context: http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10918359
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>

Re: How do I get the ValueBinding details for a given UIComponent?

Posted by ohfaces <ne...@yahoo.com>.

I did that earlier - should have posted this one too. I couldn't figure out
how to get the valuebinding details off it though ... Is there a particular
key I should be looking for?

Thanks in advance!


Andrew Robinson-5 wrote:
> 
> The valueBindingMap of UIComponentBase is not exposed through a method
> that allows access to the keys or values, only one at a time. You can
> however get access to all of the component's attributes through
> "UIComponent.getAttributes() : Map".
> 
> On 6/1/07, ohfaces <ne...@yahoo.com> wrote:
>>
>> I need to get the ValueBinding details for a given UIComponent on the fly
>> - I
>> wanted to write a generic method which will allow me to get the
>> ValueBinding
>> details once I get the UIComponent.
>>
>> Now, there is a method on the UIComponent - getValueBinding(String expr)
>> but
>> it expects me to pass the expression for each of these. I do have a
>> pattern
>> e.g. ID_x where x is an integer. So, this is not generic enough - is
>> there
>> any way to get the ValueBinding for a UIComponent without passing the
>> expression and then iterate through it to get to the required
>> ValueBinding?
>>
>> Thanks in advance!
>> --
>> View this message in context:
>> http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10916368
>> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10918359
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: How do I get the ValueBinding details for a given UIComponent?

Posted by Andrew Robinson <an...@gmail.com>.
The valueBindingMap of UIComponentBase is not exposed through a method
that allows access to the keys or values, only one at a time. You can
however get access to all of the component's attributes through
"UIComponent.getAttributes() : Map".

On 6/1/07, ohfaces <ne...@yahoo.com> wrote:
>
> I need to get the ValueBinding details for a given UIComponent on the fly - I
> wanted to write a generic method which will allow me to get the ValueBinding
> details once I get the UIComponent.
>
> Now, there is a method on the UIComponent - getValueBinding(String expr) but
> it expects me to pass the expression for each of these. I do have a pattern
> e.g. ID_x where x is an integer. So, this is not generic enough - is there
> any way to get the ValueBinding for a UIComponent without passing the
> expression and then iterate through it to get to the required ValueBinding?
>
> Thanks in advance!
> --
> View this message in context: http://www.nabble.com/How-do-I-get-the-ValueBinding-details-for-a-given-UIComponent--tf3853335.html#a10916368
> Sent from the MyFaces - Users mailing list archive at Nabble.com.
>
>