Friday, March 8, 2013

ADF 11G : Iterator, pageDef Handling Programatically


How to refresh an Iterator programatically ?

bindings.refreshControl();

iterBind.executeQuery();

iterBind.refresh(DCIteratorBinding.RANGESIZE_UNLIMITED);

How to Get all the rows of a iterator


Row[] rows = iterBind.getAllRowsInRange();

TestData dataRow = null;

for (Row row : rows) {

dataRow = (TestData)((DCDataRow)row).getDataProvider();

}


How to Get the current row of a iterator , another approach

FacesContext ctx = FacesContext.getCurrentInstance();

ExpressionFactory ef = ctx.getApplication().getExpressionFactory();

ValueExpression ve = ef.createValueExpression(ctx.getELContext(), "#{bindings.testIter.currentRow.dataProvider}", TestHead.class);

TestHead test = (TestHead)ve.getValue(ctx.getELContext());

How to Get a attribute value of the current row of iterator


DCIteratorBinding iterBind= (DCIteratorBinding)dcBindings.get("testIterator");

String attribute = (String)iterBind.getCurrentRow().getAttribute("field1");

How to get the binding container


BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();



How to get an ADF attributevalue from the ADF page definitions

AttributeBinding attr = (AttributeBinding)bindings.getControlBinding("test");

attr.setInputValue("test");



How to get an Action or MethodAction

OperationBinding method = bindings.getOperationBinding("methodAction");

method.execute();

List errors = method.getErrors();



method = bindings.getOperationBinding("methodAction");

Map paramsMap = method.getParamsMap();

paramsMap.put("param","value") ;

method.execute();