Friday, March 8, 2013

ADF : Handle Tree and Table Programatically

ADF : Handle Tree and Table

// get the selected rows from a table component


RowKeySet selection = resultTable.getSelectedRowKeys();

Object[] keys = selection.toArray();

List receivers = new ArrayList(keys.length);

for ( Object key : keys ) {

User user = modelFriends.get((Integer)key);

}



get selected Rows of a table 2

for (Object facesRowKey : table.getSelectedRowKeys()) {

table.setRowKey(facesRowKey);

Object o = table.getRowData();

JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)o;

Row row = rowData.getRow();

Test testRow = (Test)((DCDataRow)row).getDataProvider() ;

}


How to Get the data from an ADF tree or table


DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();



FacesCtrlHierBinding treeData = (FacesCtrlHierBinding)bc.getControlBinding("tree");

Row[] rows = treeData.getAllRowsInRange();