/**
   * Convert report parameter value object into string.
   *
   * @param reportParameterObj report parameter value object.
   * @return parameter value in string.
   */
  public String format(Object reportParameterObj) {
    String reportParameterValue = null;

    if (reportParameterObj != null && uLocale != null) {
      if (reportParameterObj instanceof String) {
        StringFormatter sf = getStringFormatter();
        if (sf != null) {
          reportParameterValue = sf.format((String) reportParameterObj);
        } else {
          reportParameterValue = reportParameterObj.toString();
        }
      } else if (reportParameterObj instanceof Date) {
        DateFormatter df = getDateFormatter();
        if (df != null) {
          reportParameterValue = df.format((Date) reportParameterObj);
        } else {
          reportParameterValue = reportParameterObj.toString();
        }
      } else if (reportParameterObj instanceof Double) {
        NumberFormatter nf = getNumberFormatter();
        if (nf != null) {
          reportParameterValue = nf.format(((Double) reportParameterObj).doubleValue());
        } else {
          reportParameterValue = reportParameterObj.toString();
        }
      } else if (reportParameterObj instanceof BigDecimal) {
        NumberFormatter nf = getNumberFormatter();
        if (nf != null) {
          reportParameterValue = nf.format((BigDecimal) reportParameterObj);
        } else {
          reportParameterValue = reportParameterObj.toString();
        }
      } else if (reportParameterObj instanceof Boolean) {
        reportParameterValue = ((Boolean) reportParameterObj).toString();
      } else if (reportParameterObj instanceof Number) {
        NumberFormatter nf = getNumberFormatter();
        if (nf != null) {
          reportParameterValue = nf.format(((Number) reportParameterObj));
        } else {
          reportParameterValue = reportParameterObj.toString();
        }
      } else {
        reportParameterValue = (reportParameterObj.toString());
      }
    }

    return reportParameterValue;
  }
 /**
  * Get date formatter.
  *
  * @return DateFormatter object
  */
 private DateFormatter getDateFormatter() {
   if (df == null && uLocale != null) {
     df = new DateFormatter(uLocale, timeZone);
     if (format != null) {
       df.applyPattern(format);
     }
   }
   return df;
 }
 /**
  * localize the value to a string.
  *
  * @param value
  * @param style
  * @param locale
  * @return
  */
 protected String localizeValue(Object value, IScriptStyle style) {
   if (value == null) {
     return null;
   }
   if (value instanceof Number) {
     String format = getNumberFormat(style);
     NumberFormatter fmt = getNumberFormatter(format);
     ;
     return fmt.format((Number) value);
   }
   if (value instanceof java.util.Date) {
     String format = getDateFormat(style, (java.util.Date) value);
     DateFormatter fmt = getDateFormatter(format);
     return fmt.format((Date) value);
   } else if (value instanceof String) {
     String format = getStringFormat(style);
     StringFormatter fmt = getStringFormatter(format);
     return fmt.format((String) value);
   }
   return value.toString();
 }
 private String getDataText(Object element) {
   if (element != null) {
     if (expectedColumnDataType == DataType.SQL_DATE_TYPE && element instanceof Date) {
       formatter.applyPattern("yyyy-MM-dd"); // $NON-NLS-1$
       return formatter.format((Date) element);
     } else if (expectedColumnDataType == DataType.SQL_TIME_TYPE && element instanceof Date) {
       formatter.applyPattern("HH:mm:ss.SSS"); // $NON-NLS-1$
       return formatter.format((Date) element);
     } else if (expectedColumnDataType == DataType.DATE_TYPE && element instanceof Date) {
       formatter.applyPattern("yyyy-MM-dd HH:mm:ss.SSS"); // $NON-NLS-1$
       return formatter.format((Date) element);
     }
     // Because of fixed Timestamp format problem(T60058),add DataTypeUtil.toString(element );
     // But this will make nunmber format has "," ,such as 10000 to be 10,000
     // In SelectValueDialog ,it call DataTypeUtil.toLocaleNeutralString( element )
     // So add follow code to call DataTypeUtil.toLocaleNeutralString( element )
     else if (element instanceof Number) {
       try {
         return DataTypeUtil.toLocaleNeutralString(element);
       } catch (BirtException e) {
         return String.valueOf(element);
       }
     } else {
       try {
         return DataTypeUtil.toString(element);
       } catch (BirtException e) {
         return String.valueOf(element);
       }
     }
   }
   return null;
 }
  /**
   * Parse the input string to an object.
   *
   * @param reportParameterValue input string to parse
   * @return an object
   */
  protected Object parseDateTime(String reportParameterValue) {
    DateFormatter df = getDateFormatter();
    if (df == null) {
      return null;
    }

    try {
      return df.parse(reportParameterValue);
    } catch (ParseException e) {
      df = new DateFormatter("Short Date", uLocale);
      try {
        return df.parse(reportParameterValue);
      } catch (ParseException ex) {
        df = new DateFormatter("Medium Time", uLocale);
        try {
          return df.parse(reportParameterValue);
        } catch (ParseException exx) {
          return null;
        }
      }
    }
  }