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

Thursday, February 16, 2012

ADF - Show faces message for relevant copmonents

Using following method can show error messages for relevant component,

final int MSG_FATAL = 1;
final int MSG_ERROR = 2;
final int MSG_WARN = 3;
final int MSG_INFO = 4;
public void showMsgForRelevantComponentAll(int iSeverity, String sMsg, UIComponent uIComponent) {
FacesMessage msg = null;
switch (iSeverity) {
case MSG_FATAL:
msg = new FacesMessage(FacesMessage.SEVERITY_FATAL, null, sMsg);
break;
case MSG_ERROR:
msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, sMsg);
break;
case MSG_WARN:
msg = new FacesMessage(FacesMessage.SEVERITY_WARN, null, sMsg);
break;
case MSG_INFO:
default:
msg = new FacesMessage(FacesMessage.SEVERITY_INFO, null, sMsg);
}
FacesContext facesContext = FacesContext.getCurrentInstance();
facesContext.addMessage(uIComponent.getClientId(facesContext), msg);
}

Thursday, December 15, 2011

Oracle Adf - Set values to current row attribute through bindings.

Say need to set values for YourField in bean,then can try as follows

setEL("#{bindings.YourField.inputValue}","p");

//setEL implementation
public void setEL(String el, Object val) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el, Object.class);
exp.setValue(elContext, val);
}
//
In pagedef you should have bindings for above attribute
<attributeValues IterBinding="YourVOIterator" id="YourField">
<AttrNames>
<Item Value="YourField"/>
</AttrNames>
</attributeValues>

Wednesday, September 21, 2011

Oracle ADf – How to set background color of Table column using inlineStyle

Following example shows how to change background color of column using column’s attribute value.In this sample VO name is CustomVO and attribute is cusAttribute(Here If cusAttribute value greater than 100 background color red otherwise green)

<af:table value="#{bindings.CustomVO.collectionModel}" var="row">

<af:column custom data...

inlineStyle="#{row.cusAttribute > 100 ?'background-color:Red;':'background-color:green;'}">

<af:outputText value="#{row.cusAttribute}" id="ot5">

</af:outputText>

</af:column>

Wednesday, September 14, 2011

Oracle ADF - Working with oracle.jbo.domain.Date

Use case is get oracle.jbo.domain.Date for specific calender

public oracle.jbo.domain.Date toOracleDate(java.util.Calendar calendar) {

oracle.jbo.domain.Date jboDate = new oracle.jbo.domain.Date();

Timestamp t = jboDate.timestampValue();

t.setTime(calendar.getTime().getTime());

return new oracle.jbo.domain.Date(t);

}

Monday, September 12, 2011

Oracle ADF – Date validation for future date

//Your Page
<af:inputDate label="Label1" id="id1s" rendered="true">
<af:validateDateTimeRange maximum="#{SampleBean.maxDate}"/>

</af:inputDate>

//Bean code stuff

public Date getMaxDate(){
Calendar cl = Calendar.getInstance();
cl.setTime(new Date());
cl.add(Calendar.DATE, 1);// you can alter max dates from here.. 0,1,2..
Date toDate = cl.getTime();
return toDate;

}

Oracle ADF – Get current Row from Iterator

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

DCIteratorBinding iterator = bc.findIteratorBinding("customVOIterator");

Row r = iterator.getCurrentRow();

String val = (String)r.getAttribute("customField");

Oracle ADF – How to access binding value of UI component using a bean class

<af:inputText value="#{bindings.Name.inputValue}"

id="Name" >

<f:validator binding="#{bindings.Name.validator}"/>

</af:inputText>

// get the binding container

import oracle.binding.AttributeBinding;

import oracle.binding.BindingContainer;

import oracle.adf.model.BindingContext;

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

// get an ADF attribute value from the ADF page definitions

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

String val =

attr.getInputValue();