Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Create Rich Table Programmatically? (diff than threadID=2183983)

927151Mar 28 2012 — edited Mar 29 2012
Dear all,

I need to create rich table programmatically.
I have read other posting (2185983 but I think this is not what I want.

Here is my condition:
I have a function which return a list of array, let say something like this {{1,2,3,4}, {5,6,7,8}, {9,10,11,12}}.
I have some lines of code to create a rich table, like this (this is working, but not exactly what I mean):

*** source code start ***

ArrayList arrLst = okam.fnGetDataByKodeAgen1(strKodeAgen); <== this function return a list of array
RichTable myTable = new RichTable();
myTable.setId("myTab");
myTable.setRowBandingInterval(0);
myTable.setValue(arrLst);

String[] strValue = (String[]) arrLst.get(0);
int intValue = strValue.length;
for (int c=0; c<=intValue-2; c++) {
RichColumn myColumn = new RichColumn();
myColumn.setId("c_"+c);
myColumn.setValueExpression("headerText", gen.getValueExpression("myColumn_" + c));

RichInputText myCell = new RichInputText();
myCell.setId("ot_" + c);
myCell.setValueExpression("value", gen.getValueExpression(strValue[c]));

myColumn.getChildren().add(myCell);
myTable.getChildren().add(myColumn);
}

RichPanelCollection myRPC = new RichPanelCollection();
myRPC.setValueExpression("inlineStyle", gen.getValueExpression("height:150px;"));
myRPC.getChildren().add(myTable);
getPfl2().getChildren().add(myRPC);

*** source code finish ***

that code will produce a table with three rows, but each row have the same value, or something like this:

1 2 3 4
1 2 3 4
1 2 3 4

I know, this is because i am using the same row to fill the table, as seen below:

String[] strValue = (String[]) arrLst.get(0);
...
...
myCell.setValueExpression("value", gen.getValueExpression(strValue[c]));

The problem is, how i should fill the right value to the right cell, so the table will looks like:

1 2 3 4
5 6 7 8
9 10 11 12

I have tried to use other loops, but still didn't give me the right table.

Any help will be appreciated.
Thank you.


Regards,
Novan Ananda

Edited by: 924148 on Mar 28, 2012 8:26 PM

Edited by: 924148 on Mar 28, 2012 8:28 PM

Edited by: 924148 on Mar 28, 2012 11:28 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2012
Added on Mar 28 2012
0 comments
374 views