Following code stuff explain how to get value from select one choice when it is in the table's column
public static Object evaluateEL(String el) {
FacesContext facesContext = FacesContext.getCurrentInstance();
ELContext elContext = facesContext.getELContext();
ExpressionFactory expressionFactory =
facesContext.getApplication().getExpressionFactory();
ValueExpression exp =
expressionFactory.createValueExpression(elContext, el,
Object.class);
return exp.getValue(elContext);
}
Object oVal =
ADFUtils.evaluateEL("#{row.bindings.FieldName.items['" +
valueChangeEvent.getNewValue() + "'].label}");
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, June 26, 2013
Wednesday, June 5, 2013
Oracle ADF : Get the selected value from SelectOneChoice not the Index;
You can get selected attribute value using iterator for SelectOneChoice
BindingContext bindingctx = BindingContext.getCurrent();
BindingContainer bindings = null;
bindings = bindingctx.getCurrentBindingsEntry();
DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
DCIteratorBinding dciter = null;
dciter = bindingsImpl.findIteratorBinding("yourIterator");// your lookup iterator
Object fieldVal = dciter.getViewObject().getCurrentRow().getAttribute("YourField");
System.out.println(dciter.getViewObject().getCurrentRow().getAttribute(fieldVal));
BindingContext bindingctx = BindingContext.getCurrent();
BindingContainer bindings = null;
bindings = bindingctx.getCurrentBindingsEntry();
DCBindingContainer bindingsImpl = (DCBindingContainer) bindings;
DCIteratorBinding dciter = null;
dciter = bindingsImpl.findIteratorBinding("yourIterator");// your lookup iterator
Object fieldVal = dciter.getViewObject().getCurrentRow().getAttribute("YourField");
System.out.println(dciter.getViewObject().getCurrentRow().getAttribute(fieldVal));
Sunday, June 17, 2012
Oracle ADF - Hot to convert upper case to input text values
-Using JavaScript
function toUpperCase(event) {
var inputField = event.getSource();
inputField.setValue(event.getNewValue().toUpperCase());
}
<:af:clientListener method="toUpperCase" type="valueChange"/>:
Or
-Using following CSS
<:af:inputText label="Hello World" id="it1" contentStyle="text-transform:uppercase;"/>:
Wednesday, June 6, 2012
Oracle ADF - How to iterate view object using java code
Following code stuff can be used to iterate view object without any effect to current view object.
ViewObjectImpl viewObject = getTestObject();
RowSetIterator iterator = viewObject.createRowSetIterator(null);
iterator.reset();
while (iterator.hasNext()) {
Row row = iterator.next();
// process the row here
}
iterator.closeRowSetIterator();
Oracle ADF - Another user has changed the row with Primary key
See : Chris Muir's blog : The case of the phantom ADF developer
Note : You can get above error while inserting/updating , the same entry altering using trigger or procedure.
this.getTransaction().setLockingMode(DBTransaction.LOCK_NONE);
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);
}
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>
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>
Subscribe to:
Posts (Atom)