Create ADF popup for value change event(For select one choice component).

Add popup and add dialog to inside of the popup,then select popup and add value for binding attribute in mine
#{pageFlowScope.popupBean.myPop}.
private RichPopup myPop = new RichPopup();
public void selectOneChoiceEvent(ValueChangeEvent valueChangeEvent) {
RichPopup.PopupHints ph = new RichPopup.PopupHints();
myPop.show(ph);
}
public void setMyPop(RichPopup myPop) {
this.myPop = myPop;
}
public RichPopup getMyPop() {
return myPop;
}

Oracle ADF - Add new custom attribute for view object using Expression

Oracle ADF Client-side Validators

Oracle ADF Association sample for Department and Employee

Wednesday, April 20, 2011

Oracle ADF - How to instantiate application module

Here are two sample ways to instantiate application module using Bindingcontex Class and Configuration Class.

(1)Using Bindingcontex class: (Have to give DataControler name and AppModuleImpl class )

oracle.adf.model.BindingContext bc = oracle.adf.model.BindingContext.getCurrent();

JUApplication japp = (JUApplication)bc.getCurrentBindingsEntry().get("AppModuleDataControl");

AppModuleImpl am = (AppModuleImpl)japp.getApplicationModule();

(2)Using Configuration class (Have to give path for AppModule and name "AppModuleLocal")

AppModuleImpl am = (AppModuleImpl)oracle.jbo.client.Configuration.createRootApplicationModule("model.am.AppModule",

"AppModuleLocal");

Wednesday, April 6, 2011

Oracle - ADF How to add methodCall in taskFlow

We can add method for taskflow (methodCall component),say add methodCall in between Page A and Page B.Then you have to add following tag in your taskflow's source

<outcome id="__30">
<fixed-outcome>OutComeFromMethodToPageB</fixed-outcome>
</outcome>

Do methodCall implementation in your bean class and add that class to managedBeans.
see image
sample code stuff
<method-call id="methodCall1">
<method>#{pageFlowScope.TestMethodCall.alterStringVal}</method>
<outcome id="__30">
<fixed-outcome>continue2</fixed-outcome>
</outcome>
</method-call>


Monday, April 4, 2011

Oracle ADF - How to access viewScope , pageFlowScope and SessionScope parameters by bean class

(1)PageFlowScope

AdfFacesContext context = AdfFacesContext.getCurrentInstance();

Map pfScope = context.getPageFlowScope();

pfScope.get("paramName");


(2)ViewScope

AdfFacesContext context = AdfFacesContext.getCurrentInstance();

Map vScope = context.getViewScope();

vScope.get("paramName");


(3)SessionScope

FacesContext fctx = FacesContext.getCurrentInstance();

ExternalContext ectx = fctx.getExternalContext();

Map sessionScope = ectx.getSessionMap();

sessionScope.get("paramName");//paramName can be a bean class

Tuesday, March 29, 2011

Get view object row values using iterator by backing bean class

(1)Assume iterator include with page(drag VO from DataControl to design area as table) or added to pagedef.xml

(2)Add manage bean to your taskflow or faces-config
<managed-bean-name>ManagedTest</managed-bean-name>
<managed-bean-class>view.managed.TestBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>bindingContainer</property-name>
<property-class>oracle.adf.model.binding.DCBindingContainer</property-class>
<value>#{bindings}</value>

(3)Now you can access bindings from bean class.

Iterator has to be added in PageDef.xml . This is example code for managed bean:

import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCIteratorBinding;
import oracle.jbo.Row;

public class TestBean {

private DCBindingContainer bindingContainer;

public String getIterValues(){
DCBindingContainer bc = getBindingContainer();
DCIteratorBinding iterator = bc.findIteratorBinding("DeparmentVOIterator");
Row r = iterator.getCurrentRow();
String deptnme = (String)r.getAttribute("DepartmentName");
System.out.println(deptnme );
return null;
}

public void setBindingContainer(DCBindingContainer bindingContainer) {
this.bindingContainer = bindingContainer;
}

public DCBindingContainer getBindingContainer() {
return bindingContainer;
}
}

Thursday, March 10, 2011

Deleting Multiple Rows on an Iterator(From Oracle samples)

public void deleteOnTable(RichTable myTable) {
RowKeySet rowKeySet = (RowKeySet) myTable.getSelectedRowKeys();
CollectionModel cm = (CollectionModel) myTable.getValue();
for (Object facesTreeRowKey : rowKeySet) {
cm.setRowKey(facesTreeRowKey);
JUCtrlHierNodeBinding rowData = (JUCtrlHierNodeBinding)
cm.getRowData();
rowData.getRow().remove();
}
}

ADF client side validations with inbuilt validation tags…

Validate maximum length;

<af:inputText id="id0" value="12A" label="Maximum length validator">

<af:validateLength maximum="5"/>

</af:inputText>

Validate minimum length;

<af:inputText id="id00" value="12A" label="Minimum length validator">

<af:validateLength minimum="3"/>

</af:inputText>

Validate length range;

<af:inputText id="id01" value="12A" label="Length Range Validator">

<af:validateLength minimum="1" maximum="5"/>

</af:inputText>

Validate long range;

<af:inputText id="id2" value="10" label="Long Range Validator">

<af:validateLongRange minimum="5" maximum="50"/>

</af:inputText>

Validate double range;

<af:inputText id="id3" value="8.6" label="Double Range Validator">

<af:validateDoubleRange minimum="4.1" maximum="8.9"/>

</af:inputText>

Validate regular expression;

<af:inputText id="id4" value="9999" label="Regular Expression validation">

<af:validateRegExp pattern="[9]*"/ >

</af:inputText>

Date validation with filter condition;

<af:inputDate id="id5" value="2011-05-21"

label="Select a date, but not a Friday">

<af:convertDateTime pattern="yyyy-MM-dd"/>

<af:validateDateRestriction invalidDaysOfWeek="Fri"/>

</af:inputDate>

Validate date range;

<af:inputDate id="mdf3ee" value="2011-11-25" label="Submission period">

<af:convertDateTime pattern="yyyy-MM-dd"/>

<!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->

<af:validateDateTimeRange minimum="2011-11-16" maximum="2011-12-16"/>

</af:inputDate>

Friday, March 4, 2011

ADF java scripts sample(How to clear validation using ADF)

Use following JS code stuff is used to rid of error messages from JSF page.

function clearMsgForComponent(evt){
AdfPage.PAGE.clearAllMessages();
evt.cancel();
}

JSF code stuff