Monday, March 31, 2014

How to Bind UI Component to Backing Bean


This blog explains about binding UI component to backing bean, This is not a best practice to bind UI component, If it is really required then only I suggest to bind any UI component to backing bean.

- Select the UI component which you want to bind, Go to the properties of the selected UI component. Click on 'Down Arrow' as highlighted in yellow color in below picture corresponding to 'Binding' attribute.


- If you have already managed bean configured then select from the drop down, otherwise click on 'New' and create the new managed bean. Click on 'New' button associated to 'Property' field and give meaningful name for the property , Click on 'Ok' button, this will create setter and getter properties for the selected UI component in selected managed bean.

- Below is the 'Create Managed Bean' window.




Wednesday, March 26, 2014

How to programatically create a row in ADF ?

This blog outlines very basic requirement, that is how to create a row impl class programatically and sets to View object.

- Create Updatable or Transient View object and add it to Application Data Module as shown below


- Create a Java method in App Module Impl class as shown below

- Expose the above method to client interface as shown below


- Once after this method is available in client interface, you would see the method in Data Control as shown below, You can drag this method onto page or page fragment as a button/link. This will automatically creates method bindings in a page definition.


Thursday, March 20, 2014

How do we determine the type of Browser ?

This article explains about determining the type of the browser using Custom Filter class

Create a Custom Filter class which implements Filter Interface, get the "User-Agent" from HttpServletRequest class as shown below.


       

      public void doFilter(ServletRequest servletRequest,
                         ServletResponse servletResponse,
                         FilterChain filterChain){
        
        if(servletResponse instanceof HttpServletResponse && servletRequest instanceof HttpServletRequest ){
            HttpServletResponse response = (HttpServletResponse)servletResponse;
            HttpServletRequest request = (HttpServletRequest)servletRequest;
   // This will determine what type of the browser user sends requrest from
            String userAgent=request.getHeader("User-Agent");
   }
   }
       
 

How to display empty results on a page using

It might be very common requirement, not to display all the results first time when a page loaded,

 Write a simple method as shown below in AM Impl class, drag this on to the task flow and mark it as default activity. executeEmptyRowset() will apply false criteria and bring no results.

    public void initializeEmpSearchResults(){
          // Get VO Instance and invoke executeEptyRowSet()
          getEmpVO1().executeEmptyRowSet();
    }

Wednesday, March 19, 2014

IE 11 Compatibility with ADF

I recently encountered Jdeveloper 11.1.1.7 is not compatiable with IE11 browser, none of the buttons works as expected as well always displays warning popup with IE11.

After installing Patch # 18277370 to Jdeveloper using Opatch, I am able to run the ADF application successfully in IE11 browser without any issues.


https://blogs.oracle.com/proactivejavadevelopment/entry/supportability_on_internet_explorer_11

Please follow my blog How to install patch to Jdeveloper ? to install patch to Jdeveloper.

Sunday, March 16, 2014

How to programatically invoke a button on ADF Form ?

This blog explains about how to invoke a button in a backing bean programatically based on some condition ?

       
        import javax.faces.event.ActionEvent;
        import oracle.adf.view.rich.component.rich.nav.RichCommandButton;
 // Get the commandButton component based on command button ID
        RichCommandButton button = (RichCommandButton) JSFUtils.findComponent("backBtn");
        ActionEvent actionEventBut = new ActionEvent(button);
  // Add it to actionEvent queue
        actionEventBut.queue();
  // Below is the logic to get the root component
  FacesContext facesContext = FacesContext.getCurrentInstance();
  if (facesContext != null) {
            UIComponent root = facesContext.getViewRoot();
            component = findComponent(root, pComponentId);
        }
  private static UIComponent findComponent(UIComponent pRoot,
                                             String pComponentId) {
        if (pComponentId.equals(pRoot.getId()))
            return pRoot;

        UIComponent kid = null;
        UIComponent result = null;
        Iterator kids = pRoot.getFacetsAndChildren();
        while (kids.hasNext() && (result == null)) {
            kid = (UIComponent)kids.next();
            if (pComponentId.equals(kid.getId())) {
                result = kid;
                break;
            }
            result = findComponent(kid, pComponentId);
            if (result != null) {
                break;
            }
        }
        return result;
    }
  
       
 

Thursday, March 6, 2014

How to increase JDeveloper Memory


Locate jdev.conf and ide.conf files at installed Middleware location


C:\Oracle\Middleware1117\jdeveloper\ide\bin

C:\Oracle\Middleware1117\jdeveloper\jdev\bin

Add Below property

AddVMOption  -Xmx640M