IBM Branch Transformation Toolkit Javadoc

com.ibm.dse.gui
Class DateConverter

java.lang.Object
  extended bycom.ibm.dse.gui.Formatter
      extended bycom.ibm.dse.gui.Converter
          extended bycom.ibm.dse.gui.DateConverter
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class DateConverter
extends Converter

The DateConverter class is responsible for Date validation and conversion.

See Also:
Serialized Form

Field Summary
(package private)  java.lang.String fieldPattern
           
 
Fields inherited from class com.ibm.dse.gui.Converter
propertyChange
 
Constructor Summary
DateConverter()
          This constructor creates a DateConverter object.
DateConverter(java.lang.String anErrorMessage, java.lang.String aPattern, boolean useSeparator, java.lang.String separator, boolean fourDigitsYear, int ordering)
          This constructor creates a DateConverter object.
 
Method Summary
 java.lang.String format(java.lang.String text)
          Formats an unformatted (or already formatted) String into a formatted String.
 java.lang.Object formatAsConversionType(java.lang.String text)
          Converts a String into a Date.
 java.lang.String formatFromConversionType(java.lang.Object input)
          Converts a Date into a String.
(package private)  java.lang.String getDateText(java.lang.String text, int index1, int index2, int index3, int ordering)
          It is responsible for adding '19' or '20 in the year
 DateFormat getFormat()
          Gets the format property (DateFormat) value.
 java.lang.String getPattern()
          Gets the pattern property (java.lang.String) value.
 char getSeparator()
          Gets the separator property (char) value.
 java.util.Date getTheDate()
          Gets the theDate property (java.util.Date) value.
 void setFormat(DateFormat f)
          Sets the format property (DateFormat) value.
 void setPattern(java.lang.String pattern)
          Sets the pattern property (java.lang.String) value.
 void setSeparator(char separator)
          Sets the separator property (char) value.
 void setTheDate(java.util.Date theDate)
          Sets the theDate property (java.util.Date) value.
 boolean validate(java.lang.String userInput)
          Returns a boolean that indicates if the validation has been achieved successfully or not.
 boolean validateKey(java.lang.String userInput, java.awt.event.KeyEvent keyEvent)
          Returns a boolean that indicates if the validation has been achieved successfully or not for this new key.
 
Methods inherited from class com.ibm.dse.gui.Converter
addPropertyChangeListener, firePropertyChange, getErrorMessage, getIsConvertible, getIsNull, getPropertyChange, removePropertyChangeListener, setErrorMessage, setIsConvertible, setIsNull, validateWithError
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fieldPattern

java.lang.String fieldPattern
Constructor Detail

DateConverter

public DateConverter()
This constructor creates a DateConverter object.


DateConverter

public DateConverter(java.lang.String anErrorMessage,
                     java.lang.String aPattern,
                     boolean useSeparator,
                     java.lang.String separator,
                     boolean fourDigitsYear,
                     int ordering)
This constructor creates a DateConverter object.

Parameters:
anErrorMessage - java.lang.String, the error message
aPattern - java.lang.String, the pattern
separator - String, the separator
fourDigitsYear - boolean, indicated if four digits or two digits are used for the year
ordering - int, the position of day, month and year
Method Detail

format

public java.lang.String format(java.lang.String text)
Description copied from class: Formatter
Formats an unformatted (or already formatted) String into a formatted String.

Overrides:
format in class Formatter
Parameters:
text - java.lang.String, the String to be formatted
Returns:
java.lang.String

formatAsConversionType

public java.lang.Object formatAsConversionType(java.lang.String text)
Converts a String into a Date.

Specified by:
formatAsConversionType in class Formatter
Parameters:
text - java.lang.String, the String to be converted
Returns:
Object - the result of converting the aString parameter into a Date

formatFromConversionType

public java.lang.String formatFromConversionType(java.lang.Object input)
Converts a Date into a String.

Specified by:
formatFromConversionType in class Formatter
Parameters:
input - Object, the date to be converted
Returns:
String - the result of converting the input parameter into a String

getDateText

java.lang.String getDateText(java.lang.String text,
                             int index1,
                             int index2,
                             int index3,
                             int ordering)
It is responsible for adding '19' or '20 in the year


getFormat

public DateFormat getFormat()
Gets the format property (DateFormat) value.

Returns:
DateFormat - the format property value.
See Also:
setFormat(com.ibm.dse.base.DateFormat)

getPattern

public java.lang.String getPattern()
Gets the pattern property (java.lang.String) value.

Returns:
String - the pattern property value.
See Also:
setPattern(java.lang.String)

getSeparator

public char getSeparator()
Gets the separator property (char) value.

Returns:
char - the separator property value.
See Also:
setSeparator(char)

getTheDate

public java.util.Date getTheDate()
Gets the theDate property (java.util.Date) value.

Returns:
Date - the theDate property value.
See Also:
setTheDate(java.util.Date)

setFormat

public void setFormat(DateFormat f)
Sets the format property (DateFormat) value.

See Also:
getSeparator()

setPattern

public void setPattern(java.lang.String pattern)
Sets the pattern property (java.lang.String) value.

See Also:
getPattern()

setSeparator

public void setSeparator(char separator)
Sets the separator property (char) value.

See Also:
getSeparator()

setTheDate

public void setTheDate(java.util.Date theDate)
Sets the theDate property (java.util.Date) value.

See Also:
getTheDate()

validate

public boolean validate(java.lang.String userInput)
Returns a boolean that indicates if the validation has been achieved successfully or not.

Overrides:
validate in class Converter
Parameters:
userInput - java.lang.String - the string to be validated
Returns:
boolean - the result of the validation

validateKey

public boolean validateKey(java.lang.String userInput,
                           java.awt.event.KeyEvent keyEvent)
Returns a boolean that indicates if the validation has been achieved successfully or not for this new key.

Overrides:
validateKey in class Converter
Parameters:
userInput - java.lang.String - the string writed.
keyEvent - java.awt.event.KeyEvent - new key.
Returns:
boolean - the result of the validation.

IBM Branch Transformation Toolkit Javadoc

(c) Copyright IBM Corporation 1998, 2005