Many a times, it is required to find an UIComponent from ADF managed bean, to do something with it, for example : change the value of an af:outputText, change readOnly property of an af:inputText etc.
private UIComponent getUIComponent(String id) {
FacesContext facesCtx = FacesContext.getCurrentInstance();
return findComponent(facesCtx.getViewRoot(), id);
}
private UIComponent findComponent(UIComponent base, String id) {
if (id.equals(base.getId())) {
return base;
}
UIComponent children = null;
UIComponent result = null;
Iterator childrens = base.getFacetsAndChildren();
while (childrens.hasNext() && (result == null)) {
children = (UIComponent)childrens.next();
if (id.equals(children.getId())) {
result = children;
break;
}
result = findComponent(children, id);
if (result != null) {
break;
}
}
return result;
}
This will search from the UI view root for all elements until it finds the UIComponent of the same ID.
NOTE : This is widely available in ADF community, I just wanted to make this available for those we are only looking for this utility.
private UIComponent getUIComponent(String id) {
FacesContext facesCtx = FacesContext.getCurrentInstance();
return findComponent(facesCtx.getViewRoot(), id);
}
private UIComponent findComponent(UIComponent base, String id) {
if (id.equals(base.getId())) {
return base;
}
UIComponent children = null;
UIComponent result = null;
Iterator childrens = base.getFacetsAndChildren();
while (childrens.hasNext() && (result == null)) {
children = (UIComponent)childrens.next();
if (id.equals(children.getId())) {
result = children;
break;
}
result = findComponent(children, id);
if (result != null) {
break;
}
}
return result;
}
This will search from the UI view root for all elements until it finds the UIComponent of the same ID.
NOTE : This is widely available in ADF community, I just wanted to make this available for those we are only looking for this utility.
Extra-ordinary Post. Amazing way of handling things. It shows your great understanding of the subject. Thanks for Sharing.
ReplyDeleteInformatica Training in Chennai
Informatica Training Center Chennai
Best Informatica Training Institute In Chennai
Best Informatica Training center In Chennai
Informatica institutes in Chennai
Informatica courses in Chennai
Informatica Training in Adyar
Informatica Training in Velachery
best kitchen chimney india
ReplyDeleteGood to know about the email list business. I was looking for such a service for a long time o grow my local business but the rates that other companies were offering were not satisfactory. Thanks for sharing the recommendations in this post!
ReplyDeleteSalesforce Training | Online Course | Certification in chennai | Salesforce Training | Online Course | Certification in bangalore | Salesforce Training | Online Course | Certification in hyderabad | Salesforce Training | Online Course | Certification in pune
Damien Grant
ReplyDeleteDamien Grant
Damien Grant
Damien Grant
Damien Grant
Damien Grant
Damien Grant
Damien Grant
I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here.Same as your blog i found another one Oracle Fusion Financials.Actually I was looking for the same information on internet for Oracle Financials Cloud and came across your blog. I am impressed by the information that you have on this blog. Thanks once more for all the details.
ReplyDeleteI have read your blog its very attractive and impressive
ReplyDeleteBest Oracle ADF Course in Bangalore
Thanks For sharing a nice post about all Course.It is very helpful and for us.
ReplyDeleteOracle ADF training in bangalore
digitechtricks
ReplyDeleteI have read your blog its very attractive and impressive