Ken,
I would like to go with option # 3 :)
Can you explain it a little (mostly inputs & outputs) ?
thanks
Karam
Ken Paulsen wrote:
>
> In a JSFTemplating page:
>
> <sun:table ... binding="bean.table" />
>
> In your Bean.getTable() method:
>
> public Table getTable() {
> Table table = ...;
> ...
> // Create the DynamicColumnRowGroup(s)
> ComponentType type =
> LayoutDefinitionManager.getGlobalComponentType("sun:dynamicColumnRowGroup");
>
> for (Object yourData : listOfYourData) {
> LayoutComponent desc = new LayoutComponent(null,
> yourData.getId(), type);
> for (.... : listOfProperties) {
> // Add each property that would normally appear in the .jsf
> file, i.e:
> // <sun:dynamicColumnRowGroup ... property1="value1"
> property2="value2"...
> desc.addOption(key, value);
> }
>
> // Create and add child component (dynamicColumnRowGroup)
> UIComponent rowGroup = ComponentUtil.createChildComponent(
> facesContext, desc, table);
> }
>
> // Return the populated table
> return table;
> }
>
> However, now that I went through the motions of giving you the above
> pseudo-code, I realize why I don't like "binding". :) The above will
> work, however, you can't parameterize a binding. If you want to pass
> in a reference to "yourData" it's not possible. So instead, if you
> want, you can create a custom JSFT Factory (just like
> DynamicColumnTableRowGroupFactory). This could do essentially the
> exact same code, you can just take advantage of the properties passed
> in, and also context.getLayoutElement() which is what should have been
> passed into the "null" argument in new LayoutComponent() (but it's not
> available via a binding... not very important, though).
>
> A 3rd option, would be to write this code in a handler and invoke it
> on the afterCreate event.
>
> So many choices. :) I hope this helps!
>
> Ken
>
>
> Karam Singh wrote:
>> Any pointer to some example code? Are you suggesting that I use it in
>> a jsp page using beans (like shown in woodstock preview examples)?
>>
>> -Karam
>>
>> Ken Paulsen wrote:
>>>
>>> Hi Karam,
>>>
>>> You can do:
>>>
>>> <sun:table binding="#{some.method}" />
>>>
>>> Then you could create create the components you need via java code.
>>> However, you'd have have to create a LayoutComponent object to pass
>>> to the factory that contained all the data that is normally found in
>>> the .jsf file.
>>>
>>> That's probably the simplest solution.
>>>
>>> Ken
>>>
>>> Karam Singh wrote:
>>>> Hi Ken,
>>>> Remember that dynamic table code that we have in jsftemplating, how
>>>> will it work if I have multiple tableRowGroup entries? Currently
>>>> (what I have been using so far) I have to define dynamicRowGroup in
>>>> the jsf page itself. Using this approach, I would have to define
>>>> several dynamicRowGroup on the jsf page. But I don't know how many
>>>> I need before hand. So how would I take care of that scenario?
>>>> Please let me know.
>>>>
>>>> thanks
>>>> Karam