com.sibvisions.rad.ui.swing.ext.text
Class DateFormatter

java.lang.Object
  extended by javax.swing.JFormattedTextField.AbstractFormatter
      extended by com.sibvisions.rad.ui.swing.ext.text.DateFormatter
All Implemented Interfaces:
Serializable

public class DateFormatter
extends JFormattedTextField.AbstractFormatter

The DateFormatter can handle null values and empty Strings and handle complex date formats.

See Also:
Serialized Form

Constructor Summary
DateFormatter()
          Constructs a new date formatter with default date format.
DateFormatter(DateFormat pDateFormat)
          Constructs a new date formatter that supports empty Strings and null values.
 
Method Summary
 DateFormat getDateFormat()
          Gets the date format.
 String getDatePattern()
          Gets the date format pattern.
 void setDateFormat(DateFormat pDateFormat)
          Gets the date format.
 void setDatePattern(String pDatePattern)
          Gets the date format pattern.
 Object stringToValue(String pText)
          
 String valueToString(Object pValue)
          
 
Methods inherited from class javax.swing.JFormattedTextField.AbstractFormatter
clone, getActions, getDocumentFilter, getFormattedTextField, getNavigationFilter, install, invalidEdit, setEditValid, uninstall
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateFormatter

public DateFormatter()
Constructs a new date formatter with default date format.


DateFormatter

public DateFormatter(DateFormat pDateFormat)
Constructs a new date formatter that supports empty Strings and null values.

Parameters:
pDateFormat - the formatter that should support empty Strings and null values.
Method Detail

stringToValue

public Object stringToValue(String pText)
                     throws ParseException

Specified by:
stringToValue in class JFormattedTextField.AbstractFormatter
Throws:
ParseException

valueToString

public String valueToString(Object pValue)
                     throws ParseException

Specified by:
valueToString in class JFormattedTextField.AbstractFormatter
Throws:
ParseException

getDateFormat

public DateFormat getDateFormat()
Gets the date format.

Returns:
the date format.

setDateFormat

public void setDateFormat(DateFormat pDateFormat)
Gets the date format.

Parameters:
pDateFormat - the date format.

getDatePattern

public String getDatePattern()
Gets the date format pattern.

Returns:
the date format pattern.

setDatePattern

public void setDatePattern(String pDatePattern)
Gets the date format pattern.

Parameters:
pDatePattern - the date format pattern.


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.