
gxt-2.1.1-sources.com.extjs.gxt.ui.client.widget.table.DateTimeCellRenderer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gxt Show documentation
Show all versions of gxt Show documentation
Rich Internet Application Framework for GWT
/*
* Ext GWT - Ext for GWT
* Copyright(c) 2007-2009, Ext JS, LLC.
* [email protected]
*
* http://extjs.com/license
*/
package com.extjs.gxt.ui.client.widget.table;
import java.util.Date;
import com.extjs.gxt.ui.client.widget.Component;
import com.google.gwt.i18n.client.DateTimeFormat;
/**
* A CellRenderer
implementation for date and times.
*
* @see DateTimeFormat
*/
public class DateTimeCellRenderer implements CellRenderer {
private DateTimeFormat format;
/**
* Creates a date time cell renderer.
*
* @param pattern the date time format
*/
public DateTimeCellRenderer(String pattern) {
this.format = DateTimeFormat.getFormat(pattern);
}
/**
* Creates a new date time cell renderer.
*
* @param format the date time format
*/
public DateTimeCellRenderer(DateTimeFormat format) {
this.format = format;
}
public String render(T item, String property, Object value) {
if (value == null) {
return "";
}
return format.format((Date) value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy