users@woodstock.java.net

Re: Woodstock - TableRowGroup

From: Dan Labrecque <Dan.Labrecque_at_Sun.COM>
Date: Thu, 08 Nov 2007 11:14:52 -0500

When you provide an array of objects, we attempt to create an
ObjectArrayDataProvider for you. (Note that you can provide this
yourself via the same value expression. There are several types of
providers available, but they all deal with Object.) This Object must
contain a getter and setter for each value to be displayed. (The Object
typically contains multiple values for a given row.) You can create an
Object that get/sets String values, but you cannot provide individual
strings directly as the sourceData property.

Dan

Rasha wrote:
> Hello,
> Is there a way I can make the sourceData point to a list of Strings rather
> than a list of Objects.
> It is working fine with a list of Objects just the way you describe it, but
> when I use a list of String
> the [currentRow.value] object does not work, which kind of make sense since
> I am not using an object with fields but simple Strings.
>
> Does the woodstock table support using a list of Strings as sourceData ? If
> so, then any ideas on what I might be doing wrong?
>
> Thanks
> -Rasha
>
>
> Dan Labrecque wrote:
>
>> Your itemName property must reference a field key in the DataProvider.
>> Whether you provide an ObjectListDataProvider or List (ultimately
>> wrapped in ObjectListDataProvider), the objects within must have getter
>> methods to retrieve the data. Please see the table, tableRowGroup, and
>> tableColumn examples in the TLD docs.
>>
>> Dan
>>
>> Indu Kurup wrote:
>>
>>> I am afraid, it's still not working and I am getting this exception now.
>>>
>>> javax.faces.FacesException: javax.el.PropertyNotFoundException:
>>> /searchResults.xhtml @32,151 text="#{item.value.itemName}":
>>> java.lang.IllegalArgumentException: itemName
>>>
>>> ……..
>>>
>>> Caused by: java.lang.IllegalArgumentException: itemName
>>>
>>> at
>>> com.sun.data.provider.impl.ObjectListDataProvider.getFieldKey(ObjectListDataProvider.java:463)
>>>
>>>
>>>
>>>
>>>
>>> itemName is a property of my Item class.
>>>
>>> Do I have to wrap the list of objects into an ObjectListDataProvider
>>> explicitly?
>>>
>>> Thanks.
>>>
>>>
>>> On 9/19/07, *Dan Labrecque* <Dan.Labrecque_at_sun.com
>>> <mailto:Dan.Labrecque_at_sun.com>> wrote:
>>>
>>> Your value expression should be #{item.value.itemName}. The
>>> "value" keyword is a DataProvider convention, indicating that this
>>> is not a method binding to a backing bean.
>>>
>>> Dan
>>>
>>>
>>> Indu Kurup wrote:
>>>
>>>> This is what I was trying to implement where
>>>> *backingBean.itemsList* is just a list of item objects.
>>>>
>>>>
>>>> < webuijsf:tableRowGroup id= "rowGroup1" sourceData=
>>>> "#{backingBean.itemsList}" sourceVar= "item">
>>>>
>>>> < webuijsf:tableColumn id= "col2">
>>>>
>>>> < webuijsf:staticText text= "#{item.itemName}"/>
>>>>
>>>> </ webuijsf:tableColumn>
>>>>
>>>> </ webuijsf:tableRowGroup>
>>>>
>>>>
>>>>
>>>> And I am getting this exception
>>>>
>>>> |javax.faces.FacesException: javax.el.PropertyNotFoundException:
>>>> /searchResults.xhtml @32,125 text="#{item.itemName}": Property
>>>> 'itemName' not found on type
>>>> com.sun.data.provider.impl.TableRowDataProvider
>>>> |
>>>> | at
>>>> javax.faces.component.UICommand.getValue(UICommand.java:236)
>>>> |
>>>> Am I missing something here?
>>>>
>>>> Thanks !
>>>>
>>>> Date: Wed, 19 Sep 2007 10:28:47 -0400
>>>> From: Dan Labrecque <Dan.Labrecque_at_Sun.COM
>>>> <mailto:Dan.Labrecque_at_Sun.COM>>
>>>> Subject: Woodstock - TableRowGroup
>>>>
>>>>
>>>>
>>>> In addition to a DataProvider, you can also provide a array, List,
>>>> or
>>>> Object. The TableRowGroup will simply wrap that in either a
>>>> ObjectListDataProvider or ObjectArrayDataProvider. (TableRowGroup
>>>> always
>>>>
>>>>
>>>> uses a DataProvider to access data.) You can obtain the underlying
>>>> DataProvider by calling the getTableDataProvider() of TableRowGroup.
>>>>
>>>> Dan
>>>>
>>>> Indu Kurup wrote:
>>>> >
>>>> > I was trying to implement a simple table using Woodstock
>>>> components.
>>>>
>>>>
>>>> > Could anyone please tell me if it is always a requirement to have
>>>> a
>>>> > TableDataProvider instance as the sourceData, isn't there a way by
>>>> > which I can simply call a collection in the tableRowGroup? I
>>>>
>>>>
>>>> > appreciate any help.
>>>> >
>>>> > Thanks.
>>>>
>>>>
>>>
>>
>>
>
>