Oracle ADF After execute table Active row as Last row
package model.service;
import model.service.common.AppModuleAM;
import oracle.jbo.ViewObject;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
public class AppModuleAMImpl extends ApplicationModuleImpl implements AppModuleAM {
/**
* This is the default constructor (do not remove).
*/
public AppModuleAMImpl() {
}
public void tableEmp() {
ViewObject vo=getEmployees1();
System.out.println("** VO String ="+vo.getQuery());
vo.executeQuery();
}
public void tableLastRow() {
ViewObjectImpl vo = this.getEmployees1();
int pagesCount = vo.getEstimatedRangePageCount();
vo.scrollToRangePage(pagesCount);
Row lastRow = vo.getRowAtRangeIndex(vo.getRowCountInRange()-1);
System.out.println(lastRow.getAttribute(0));
}
/**
* Container's getter for Employees1.
* @return Employees1
*/
public ViewObjectImpl getEmployees1() {
return (ViewObjectImpl) findViewObject("Employees1");
}
}
********************************************************************
package view;
import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.jbo.NavigatableRowIterator;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.uicli.binding.JUCtrlHierBinding;
import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class EmployeesBean {
private RichTable empTable;
public EmployeesBean() {
}
public void setEmpTable(RichTable empTable) {
this.empTable = empTable;
}
public RichTable getEmpTable() {
return empTable;
}
public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
public String Commit_Button() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String empExecute() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("tableEmp");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String AMLastRow() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("tableLastRow");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String vo1() {
System.out.println("Click on VO1");
CollectionModel tableModel = (CollectionModel)getEmpTable().getValue();
JUCtrlHierBinding adfModel = (JUCtrlHierBinding)tableModel.getWrappedData();
DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
NavigatableRowIterator nav=dciter.getNavigatableRowIterator();
//Row newRow = nav.createRow();
//newRow.setNewRowState(Row.STATUS_INITIALIZED);
Row lastRow = nav.last();
int lastRowIndex = nav.getRangeIndexOf(lastRow);
//nav.insertRowAtRangeIndex(lastRowIndex+1, newRow);
dciter.setCurrentRowWithKey(lastRow.getKey().toStringFormat(true));
return null;
}
public String vo2() {
System.out.println("Click on VO2 Step 1");
CollectionModel tableModel = (CollectionModel)getEmpTable().getValue();
JUCtrlHierBinding adfModel = (JUCtrlHierBinding)tableModel.getWrappedData();
DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
NavigatableRowIterator nav=dciter.getNavigatableRowIterator();
Row lastRow = nav.last();
System.out.println("Click on VO2 Step lastRow="+lastRow);
int lastRowIndex = nav.getRangeIndexOf(lastRow);
System.out.println("Click on VO2 Step lastRowIndex="+lastRowIndex);
this.empTable.setRowIndex(lastRowIndex);
//this.tableBinding.setRowIndex(rowIndex);
RowKeySet ps = this.empTable.getSelectedRowKeys();
ps.clear();
ps.add(this.empTable.getRowKey());
AdfFacesContext.getCurrentInstance().addPartialTarget(this.empTable);
System.out.println("Click on VO2 Step lastRowIndex ll="+lastRowIndex);
return null;
}
}
package model.service;
import model.service.common.AppModuleAM;
import oracle.jbo.ViewObject;
import oracle.jbo.server.ApplicationModuleImpl;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
public class AppModuleAMImpl extends ApplicationModuleImpl implements AppModuleAM {
/**
* This is the default constructor (do not remove).
*/
public AppModuleAMImpl() {
}
public void tableEmp() {
ViewObject vo=getEmployees1();
System.out.println("** VO String ="+vo.getQuery());
vo.executeQuery();
}
public void tableLastRow() {
ViewObjectImpl vo = this.getEmployees1();
int pagesCount = vo.getEstimatedRangePageCount();
vo.scrollToRangePage(pagesCount);
Row lastRow = vo.getRowAtRangeIndex(vo.getRowCountInRange()-1);
System.out.println(lastRow.getAttribute(0));
}
/**
* Container's getter for Employees1.
* @return Employees1
*/
public ViewObjectImpl getEmployees1() {
return (ViewObjectImpl) findViewObject("Employees1");
}
}
********************************************************************
package view;
import oracle.adf.model.BindingContext;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.binding.BindingContainer;
import oracle.binding.OperationBinding;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.adf.view.rich.component.rich.data.RichTable;
import oracle.adf.view.rich.context.AdfFacesContext;
import oracle.jbo.NavigatableRowIterator;
import oracle.jbo.Row;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.uicli.binding.JUCtrlHierBinding;
import org.apache.myfaces.trinidad.model.CollectionModel;
import org.apache.myfaces.trinidad.model.RowKeySet;
public class EmployeesBean {
private RichTable empTable;
public EmployeesBean() {
}
public void setEmpTable(RichTable empTable) {
this.empTable = empTable;
}
public RichTable getEmpTable() {
return empTable;
}
public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}
public String Commit_Button() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Commit");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String empExecute() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("tableEmp");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String AMLastRow() {
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("tableLastRow");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty()) {
return null;
}
return null;
}
public String vo1() {
System.out.println("Click on VO1");
CollectionModel tableModel = (CollectionModel)getEmpTable().getValue();
JUCtrlHierBinding adfModel = (JUCtrlHierBinding)tableModel.getWrappedData();
DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
NavigatableRowIterator nav=dciter.getNavigatableRowIterator();
//Row newRow = nav.createRow();
//newRow.setNewRowState(Row.STATUS_INITIALIZED);
Row lastRow = nav.last();
int lastRowIndex = nav.getRangeIndexOf(lastRow);
//nav.insertRowAtRangeIndex(lastRowIndex+1, newRow);
dciter.setCurrentRowWithKey(lastRow.getKey().toStringFormat(true));
return null;
}
public String vo2() {
System.out.println("Click on VO2 Step 1");
CollectionModel tableModel = (CollectionModel)getEmpTable().getValue();
JUCtrlHierBinding adfModel = (JUCtrlHierBinding)tableModel.getWrappedData();
DCIteratorBinding dciter = adfModel.getDCIteratorBinding();
NavigatableRowIterator nav=dciter.getNavigatableRowIterator();
Row lastRow = nav.last();
System.out.println("Click on VO2 Step lastRow="+lastRow);
int lastRowIndex = nav.getRangeIndexOf(lastRow);
System.out.println("Click on VO2 Step lastRowIndex="+lastRowIndex);
this.empTable.setRowIndex(lastRowIndex);
//this.tableBinding.setRowIndex(rowIndex);
RowKeySet ps = this.empTable.getSelectedRowKeys();
ps.clear();
ps.add(this.empTable.getRowKey());
AdfFacesContext.getCurrentInstance().addPartialTarget(this.empTable);
System.out.println("Click on VO2 Step lastRowIndex ll="+lastRowIndex);
return null;
}
}
No comments:
Post a Comment