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; }
/** * 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; }