@Test public void setFormatWithInvalidDate() { Locale.setDefault(Locale.GERMANY); DatePM pm = new DatePM(); pm.setText("14.0"); DateFormat format = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US); pm.setFormat(format); assertEquals("14.0", pm.getText()); }
public void setFormat(DateFormat newFormat) { Format oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; Date oldValue = null; try { oldValue = getDate(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = (DateFormat)newFormat.clone(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); revalidate(); if (doReformat) { setDate(oldValue); } }
DatePM extends TextPM implements IDatePM { public void setFormat(DateFormat newFormat) { Format oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; Date oldValue = null; try { oldValue = getDate(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = (DateFormat)newFormat.clone(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); revalidate(); if (doReformat) { setDate(oldValue); } } }
DatePM extends TextPM implements IDatePM { public void setFormat(DateFormat newFormat) { Format oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; Date oldValue = null; try { oldValue = getDate(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = (DateFormat)newFormat.clone(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); revalidate(); if (doReformat) { setDate(oldValue); } } DatePM(); }
DatePM extends TextPM implements IDatePM { public void setFormat(DateFormat newFormat) { Format oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; Date oldValue = null; try { oldValue = getDate(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = (DateFormat)newFormat.clone(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); revalidate(); if (doReformat) { setDate(oldValue); } } DatePM(); static synchronized DateFormatProvider getDefaultDateFormatProvider(); static synchronized void setDefaultDateFormatProvider(DateFormatProvider provider); DateFormat getFormat(); void setFormat(DateFormat newFormat); Date getDate(); void setDate(Date date); void setDefaultDate(Date date); @Override Comparable<?> getComparable(); }
DatePM extends TextPM implements IDatePM { public void setFormat(DateFormat newFormat) { Format oldFormat = format; if (oldFormat == newFormat) { return; } boolean doReformat; Date oldValue = null; try { oldValue = getDate(); doReformat = true; } catch (ConversionException ex) { doReformat = false; } format = (DateFormat)newFormat.clone(); getPropertyChangeSupport().firePropertyChange("format", oldFormat, newFormat); revalidate(); if (doReformat) { setDate(oldValue); } } DatePM(); static synchronized DateFormatProvider getDefaultDateFormatProvider(); static synchronized void setDefaultDateFormatProvider(DateFormatProvider provider); DateFormat getFormat(); void setFormat(DateFormat newFormat); Date getDate(); void setDate(Date date); void setDefaultDate(Date date); @Override Comparable<?> getComparable();  }