Posts

Showing posts from February, 2015

SelectManyChoice with Typing Capability in InputText Field in ADF.

Image
Hi All, Today I am going to show how you can create a component like SelectmanyChoice with capability of typing the text field. As you might be knowing if we use default SelectManyChoice component from ADF Faces Component Palette then it will behave like the dropdown and when you will select the checkbox then it will show the selected value in text separated by semicolon. But in this case you cannot type the text. Scenario: Some days ago I got the requirement that the user should be able to type the value as well as select also from dropdown list in SelectManyChoice component. The default SelectManyChoice will look like this. So what I did is I have kept one InputText and SelectManyChoice component side by side and made the content width  of SelectManyChoice as 0px. But here one problem arises like there was some space coming in between of the input text and SelectManyChoice component as shown like below. So it was not looking good at all like default SelectManyCho...

Implement AutoSuggestion behavior in ADF

Image
Hi All, In this post I am going to show you how you can implement AutoSuggestion behavior in ADF. In this example I have taken the example of EmployeesVO which is based on EMPLOYEES table of HR schema. Suppose you have one DepatrmentId attribute in you view object EmployeesVO and you have dragged and dropped it on to your page as input text. as shown below. In you code it will look like this <?xml version='1.0' encoding='UTF-8'?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"           xmlns:f="http://java.sun.com/jsf/core"           xmlns:h="http://java.sun.com/jsf/html"           xmlns:af="http://xmlns.oracle.com/adf/faces/rich">   <jsp:directive.page contentType="text/html;charset=UTF-8"/>   <f:view>     <af:document id="d1">       <af:me...

Get DataType of Attribute in View Object Programatically

Hi All, In this post I am going to show you how you can get the datatype of the attribute i view object programatically. Suppose you have a view object with name "DepartmentVO" and you want to find out what is the datatype of the attribute "DepartmentId" programatically. To get Datatype you can use the following code. DCBindingContainer dcBindings =  (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();              DCIteratorBinding iterBind= (DCIteratorBinding) dcBindings .get("DepartmentVO1Iterator");             ViewObject vo=iterBind.getViewObject();             AttributeDefImpl attrDef = (AttributeDefImpl)vo.findAttributeDef("DepartmentId");             String datatype=attrDef.getJavaType().getName();   ...

Delete Child Record on Delete of Master Record in ADF

Image
Hi All, In this post I am going to show you how you can delete child record along with master record in ADF. There are multiple way to do this. 1) By doing configuration in Association 2) By Overriding remove method in EntityImpl Class 3) By Overriding remove method in VOROImpl Class  1) By doing configuration in Association To delete the child record of detail table on deleting of master table record through association you have to check the property "Implement Cascade Delete in association as follows: 2) By Overriding remove method in EntityImpl Class      /**      * Add entity remove logic in this method.      */     public void remove() {         RowIterator ri=getEmployeesEO();         while(ri.hasNext()){             ri.next().remove();    ...

Get Label of Attribute From Binding of Attribute In Page Definintion in ADF

        BindingContext bctx = BindingContext.getCurrent();         BindingContainer bindings = bctx.getCurrentBindingsEntry();         JUCtrlListBinding allDepartsmentList =             (JUCtrlListBinding)bindings.get(getAttrFieldBinding());         labelVal = allDepartsmentList.getLabel();

Preselect checkbox in SelectManyCheckbox Component in ADF

Image
Hi All, In this post I am going to show you how you can preselect the checkbox in SelectManyCheckbox component in ADF. Suppose you have created SelectManyCheckbox in your page as following: <?xml version='1.0' encoding='UTF-8'?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"           xmlns:f="http://java.sun.com/jsf/core"           xmlns:af="http://xmlns.oracle.com/adf/faces/rich">   <jsp:directive.page contentType="text/html;charset=UTF-8"/>   <f:view>     <af:document id="d1">       <af:messages id="m1"/>       <af:form id="f1">                      <af:selectManyCheckbox id="smc1"             ...

Create and Apply View Criteria with IN Clause and Other Clause Dynamically in ADF

Get the View Object instance                         ViewCriteria vc = vo.createViewCriteria();             vc.setName("INCriteria");             String inClause = "IN (10,20,30,40)";             ViewCriteriaRow criteriaRow = vc.createViewCriteriaRow();             criteriaRow.setAttribute("DepatmentId", inClause);             vc.addElement(criteriaRow);             vo.applyViewCriteria(vc, true);             vo.executeQuery(); If you want to add the view criteria with equal clause then us...

Get View Accesor or View Object From ListOfValue binding

Image
Hi All, In this post I am going to show how you can get view accessor or underlying view object from ListOfValue binding. Suppose you have created LOV on DepartmentId Attribute of EmployeesVO and for LOV you have used DepartmentRO as shown below. This attribute you have drag and drop on your page as InputListOfValues. So in corresponding page definition file you can see the ListOfValue binding as shown below. If you want to get the underlying view object or view accessor of this LOV programatically then in you bean code use following lines of code:             BindingContext bctx = BindingContext.getCurrent();             BindingContainer bindings = bctx.getCurrentBindingsEntry();             JUCtrlListBinding allDepartsmentList =             ...