Thursday, March 31, 2011

PanelCollection set width 100 percent

Select Panel collection in properties set Style Class property to "AFStretchWidth"

Thursday, March 24, 2011

JNDI Connection in jdeveloper

In applicationmodule properties set the database connection to jdbc datasource and the value "jdbc/your_datasource_name"

Wednesday, March 9, 2011

Application Context

In viewcontroller project properties -> Java EE Application. give application name and context name here.

Thursday, March 3, 2011

ADF 11g: Deleting all rows from Viewobject programmatically.

On button event write below code:

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

ViewObject myVo= dc.findIteratorBinding("myVoIterator").getViewObject();
RowSetIterator rsI = myVo.createRowSetIterator(null);
while(rsI.hasNext()){
rsI.next().remove();
}
rsI.closeRowSetIterator();

Sunday, February 27, 2011

PageFlowScope variables

Drag and drop Set Property lister from operations pallette onto any component on your page. This gives flexibility to assign values to variables on the go whithout declaring them anywhere.

The value "test" will be assigned to variable demo, note the demo variable is not declated anywhere.

This can be used in many places e.g in menuitems create command menu items and you can drag and drop property listener on each of them. On clicking any of the items you assign different values to just one variable everywhere say #{pageFlowScope.menuClicked} and values as user defined.

Now in bounded taskflow say adfc-config.xml you can define controlflow for each of these values

You can also programmatically access pageFlowScope variables:
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("user_var","value" );
System.out.println("value"+AdfFacesContext.getCurrentInstance().getPageFlowScope().get("user_var")); //user defined variables as first argument.

This can be used in lot of places e.g. if you three tabs add, update, delete you can use single interface with all the buttons setting the buttons rendered property to values of this variable like this:

#{pageFlowScope.selectedTab == 'addTab'}

Monday, February 21, 2011

Oracle ADF View Criteria

We can have one view object to have multiple view criterias which can be used to execute at run time. Define the view criteria at desin time and use following code to execute any of the view criteria:
DCBindingContainer dc = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
ViewObject vo=dc.findIteratorBinding("SubmissionViewRptPrdVO1Iterator").getViewObject();
System.out.println("View name: "+vo.getName());
ViewCriteriaManager vcm = vo.getViewCriteriaManager();
ViewCriteria vc=vcm.getViewCriteria("RptPrdForUser");
VariableValueManager vm=vo.ensureVariableManager();
vm.setVariableValue("userId", "3");
vo.applyViewCriteria(vc);
vo.executeQuery();

Monday, February 14, 2011

Database(Tables Objects) with data export steps.

Select all tables you need to export -> right click -> upload
this will create the sql script file. Which you can execute on your local database.