Friday, September 24, 2010

Highlight the currently selected row with a different color in ADF table

The following styleClass EL expression would achieve the required functionality

<af:table value="#{bindings.EmployeeDetailsVO.collectionModel}"
          var="row" rows="#{bindings.EmployeeDetailsVO.rangeSize}"
          styleClass=#{row.row ==  bindings.EmployeeDetailsVO.currentRow ? 'background-color:Green;' : 'default'}
          emptyText="#{bindings.EmployeeDetailsVO.viewable ? 'No results'  : ' Denied.'}"
          fetchSize="#{bindings.EmployeeDetailsVO.rangeSize}" rowSelection="single"
          rowBandingInterval="1" columnStretching="last" autoHeightRows="-1" id="t2"
          disableColumnReordering="true">

Sunday, March 28, 2010

convert java.util.Calender to java.util.date

import java.text.SimpleDateFormat;

import java.util.Calendar;
import java.util.Date;

public class DateUtils {
    public static void main(String [] args) {
        Calendar cal = Calendar.getInstance();
        Date d =  cal.getTime();

        SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy HH:mm aa");
        String documentDate = sdf.format(d);

        System.out.println(documentDate);
    }
}


Sample output

Mar 28, 2016 11:36 AM

Thursday, March 11, 2010

How to create Database tables based on Entity Objects in Oracle ADF?

Its a common scenario to create the Oracle ADF Business Components based on a particular database schema but what if we want to achieve the reverse scenario?

First of all let me clarify to the readers that we can create an entity object in ADF model project without basing it on any database schema as shown below















We have created the entity Object and we want to create the database table based on that.
  • Select the create Database Objects from the context menu

  • Select the entity object based on which the database table will be created
  • Once done, the confirmation dialog is shown as below