Saturday, June 15, 2013

How to build ADF UI components without using ADF Business Components


Usecase : How to build ADF UI components without using ADF Business Components

There is a way to build ADF UI components without using ADF Business components, For example if the application doesn't involve with any database transactions and all the UI components built on top of external data source, then we can eliminate use of business components and use simple POJO(Plain Old Java Objects) to build simple to Complex UI screens. Though we can use transient view object achieve similar functionality but requirement is totally eliminate use of business components (VO's , AM Impl) then below approach will workout very well

Implementation :

- Create a POJO with all the getter/setter properties for required attributes which need to be displayed on .jspx or .jsff

- Define a backing bean, Which holds the above defined POJO as a class level attributes with getter/setter properties.

- Drag the required UI components from the component pallet , and binds the each UI component value to backing bean. POJO properties.

- For eg : Define <af:table> component based on POJO , Remember we have to implement rangeSize, selectionListener,empListQueryListener operations

 <af:table value="#{pageFlowScope.EmpBean.empTable.tableRows}"
                          var="row"
                          rows="#{pageFlowScope.EmpBean.empTable.rangeSize}"
                          emptyText="#{pageFlowScope.EmpBean.empTable.emptyText}"
                          fetchSize="#{pageFlowScope.EmpBean.empTable.rangeSize}"
                          filterModel="#{pageFlowScope.EmpBean.empTable.filter}"
                          queryListener="#{pageFlowScope.EmpBean.empListQueryListener}"
                          varStatus="vs" partialTriggers="::refresh"
                          selectionListener="#{pageFlowScope.EmpBean.empTable.selectionListener}"
                          rowSelection="single" id="tEmp"
                          summary="Employee List" filterVisible="true"
                          selectedRowKeys="#{pageFlowScope.EmpBean.empTable.selectedRowKeys}">

- For eg : <af:inputText>

<af:inputText value="#{pageFlowScope.EmpBean.empPOJO.firstName}"
              readOnly="#{!pageFlowScope.EmpBean.displayReadOnly}"
              label="#{loadplanninguiBundle['COLUMN.FIRST_NAME_LABEL']}"
              id="it6">
</af:inputText>

-  With this approach, not required to create any data control as well.

1 comment:

  1. If you are looking into earning cash from your websites or blogs via popup advertisments, you can try one of the most reputable networks: ExoClick.

    ReplyDelete