There used to be... the one for timestamp.. but in 1.4-rc4 you must make one yourself (by tweaking the converter).
public class SqlTimestampTextField extends TextField<Timestamp> { /** * @param id * @param modelObject * @param property * @param datePattern */ public SqlTimestampTextField(String id, Object modelObject, String property, String datePattern) { this(id, new PropertyModel<Timestamp>(modelObject, property), datePattern); } /** * @param id * @param model * @param datePattern */ public SqlTimestampTextField(String id, IModel<Timestamp> model, String datePattern) { super(id, model, Timestamp.class); } /** * @see org.apache.wicket.markup.html.form.FormComponent#getInput() */ @Override public String getInput() { String value = super.getInput(); if (Utils.isEmptyWithTrim(value)) { value = null; } if (value != null) { value = value.replace('.', ':'); if ((!Utils.isEmpty(value)) && (value.indexOf(':') < 0)) { value = new StringBuilder(value).append(":00").toString(); } } return value; } /** * @see org.apache.wicket.Component#getConverter(java.lang.Class) */ @Override public IConverter getConverter(Class<?> type) { if (type == Timestamp.class) { return ParametrizedConverterLocator.get(type); } return super.getConverter(type); } /** * @see org.apache.wicket.markup.html.form.AbstractTextComponent#isInputNullable() */ @Override public boolean isInputNullable() { return true; } } public class TimeToSqlTimestampConverter extends AbstractConverter { private static final long serialVersionUID = 1L; private final int dateFormat; /** * Construct. */ public TimeToSqlTimestampConverter() { dateFormat = DateFormat.SHORT; } /** * Construct. * * @param dateFormat * See java.text.DateFormat for details. Defaults to DateFormat.SHORT */ public TimeToSqlTimestampConverter(int dateFormat) { this.dateFormat = dateFormat; } /** * * @see org.apache.wicket.util.convert.IConverter#convertToObject(java.lang.String, * java.util.Locale) */ public Timestamp convertToObject(final String value, Locale locale) { if (value == null) { return null; } if (locale == null) { locale = Locale.getDefault(); } DateFormat format = DateFormat.getTimeInstance(dateFormat, locale); try { Date date = format.parse(value); return new Timestamp(date.getTime()); } catch (ParseException e) { throw newConversionException("Cannot parse '" + value + "' using format " + format, value, locale); } } /** * * @see org.apache.wicket.util.convert.converters.AbstractConverter#convertToString(java.lang.Object, * java.util.Locale) */ @Override public String convertToString(final Object value, Locale locale) { if (value == null) { return null; } if (locale == null) { locale = Locale.getDefault(); } Timestamp timestamp = (Timestamp)value; DateFormat format = DateFormat.getTimeInstance(dateFormat, locale); return format.format(timestamp); } /** * * @see org.apache.wicket.util.convert.converters.AbstractConverter#getTargetType() */ @Override protected Class<Timestamp> getTargetType() { return Timestamp.class; } } You can easily change the Timestamp to time.. ** Martin 2009/6/8 hill180 <hill...@gmail.com>: > I understand there is the Datetimefield, but is there a field for just time. > > -jose > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org