/** * @see org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider#getTextFormat() */ @Override public final String getTextFormat() { return converter.getDatePattern(getLocale()); } }
/** * @see org.apache.wicket.markup.html.form.AbstractTextComponent.ITextFormatProvider#getTextFormat() */ @Override public final String getTextFormat() { return converter.getDatePattern(getLocale()); } }
/** * Creates a ConversionException and sets additional context information to it. * * @param cause * - {@link RuntimeException} cause * @param locale * - {@link Locale} used to set 'format' variable with localized pattern * @return {@link ConversionException} */ private ConversionException newConversionException(RuntimeException cause, Locale locale) { return new ConversionException(cause) .setVariable("format", getDatePattern(locale)); }
/** * Creates a ConversionException and sets additional context information to it. * * @param cause * - {@link RuntimeException} cause * @param locale * - {@link Locale} used to set 'format' variable with localized pattern * @return {@link ConversionException} */ private ConversionException newConversionException(RuntimeException cause, Locale locale) { return new ConversionException(cause) .setVariable("format", getDatePattern(locale)); }
/** * Gets the date pattern to use for putting selected values in the coupled component. * * @return The date pattern */ protected String getDatePattern() { String format = null; if (component instanceof ITextFormatProvider) { format = ((ITextFormatProvider) component).getTextFormat(); // it is possible that components implement ITextFormatProvider but // don't provide a format } if (format == null) { IConverter converter = component.getConverter(DateTime.class); if (!(converter instanceof DateConverter)) { converter = component.getConverter(Date.class); } format = ((DateConverter) converter).getDatePattern(component.getLocale()); } return format; }