com.ibm.ulc.ui.dataTypes
Class UIDateValidator

java.lang.Object
  |
  +--com.ibm.ulc.util.UlcObject
        |
        +--com.ibm.ulc.ui.UIProxy
              |
              +--com.ibm.ulc.ui.dataTypes.UIDataType
                    |
                    +--com.ibm.ulc.ui.dataTypes.UIDateValidator

public class UIDateValidator
extends UIDataType

See Also:
Serialized Form

Field Summary
protected  java.lang.String fAllValidChars
          The list of valid characters allowed as input.
protected  java.util.Vector fInputDateFormats
          The DateFormat objects stored in fInputDateFormats will try to perform the validation/formatting of input until one is successful.
protected  java.text.DateFormat fOutputDateFormat
          The current DateFormat object that will perform formatting of output.
protected static char OR_CHAR
          The list of valid characters allowed as input.
protected static java.lang.String validChars
          The list of valid characters allowed as input.
 
Fields inherited from class com.ibm.ulc.ui.UIProxy
fConnection, fId, fList, fOptionalEvents, fProxyParent
 
Constructor Summary
UIDateValidator()
          Default constructor for the receiver
 
Method Summary
protected  java.util.Vector alternativeFormatsFrom(java.lang.String format)
          Break the format string into a collection of formats where an unquoted OR_CHAR ('|') occurs.
 java.lang.Object convertToObject(int phase, java.lang.String newString, java.lang.Object previousValue)
          Convert the input string to a date.
 java.lang.String convertToString(java.lang.Object object, boolean forEditing)
          Return the String represenation of the object or the empty string if object is null.
 java.lang.String filterInput(java.lang.String newString)
          The default implementation returns original string without modification.
 void free()
          The receiver is being destroyed.
 void handleRequest(ORBConnection conn, java.lang.String request, Anything args)
          The ULC application has sent a request to this object.
 boolean hasValidCharacters(java.lang.String s)
           
protected  void initializeValidCharacters(java.lang.String formatString)
          Initialize the valid characters specific for the receiver: all characters of the formatString except aA..zZ are added to the standard valid characters (we do not take into account quoted letters).
protected  java.lang.String inputFormatFor(java.lang.String outputFormatString)
          Answer the input format (with abbreviated year) corresponding to the given output format
 void restoreState(ORBConnection conn, Anything args)
          This method is the first method called after this widget is instantiated.
 void setFormatString(java.lang.String outputFormatString)
          Set the formatters according to outputFormatString.
protected  void writeYsOn(int readYs, java.lang.StringBuffer writeStream)
          Write a suitable number of ys to the input format writeStream, given the fact that readYs are present in the output format.
 
Methods inherited from class com.ibm.ulc.ui.dataTypes.UIDataType
filterInput, filterInput, getCols, getDefaultValue
 
Methods inherited from class com.ibm.ulc.ui.UIProxy
add, add, addInstance, addMany, cachedResources, convert, convert, enableOptionalEvents, finalize, find, getApplication, getChildren, getConnection, getId, getManaged, getManaged, getProxyParent, getUI, internalAddToChildren, internalRemoveFromChildren, isChildOf, isChildWidget, isOptionalEventEnabled, isParentOf, newUpdate, printInstances, remove, remove, removeInstance, removeMany, sendEventULC, sendEventULC, sendEventULC, sendOptionalEventULC, sendOptionalEventULC, sendOptionalEventULC, sendULC, sendULC, setConnectionAndId, setOptionalEvents, setOptionalEventsEnabled, setProxyParent, trouble, updateCachedResource
 
Methods inherited from class com.ibm.ulc.util.UlcObject
trouble2, trouble2Err, troubleErr
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fInputDateFormats

protected java.util.Vector fInputDateFormats
The DateFormat objects stored in fInputDateFormats will try to perform the validation/formatting of input until one is successful.

fOutputDateFormat

protected java.text.DateFormat fOutputDateFormat
The current DateFormat object that will perform formatting of output.

validChars

protected static final java.lang.String validChars
The list of valid characters allowed as input.

fAllValidChars

protected java.lang.String fAllValidChars
The list of valid characters allowed as input.

OR_CHAR

protected static final char OR_CHAR
The list of valid characters allowed as input.
Constructor Detail

UIDateValidator

public UIDateValidator()
Default constructor for the receiver
Method Detail

alternativeFormatsFrom

protected java.util.Vector alternativeFormatsFrom(java.lang.String format)
Break the format string into a collection of formats where an unquoted OR_CHAR ('|') occurs. We iterate through the string with a finite automaton whose state is held by the 2 boolean variables inQuote and inChunk

convertToObject

public java.lang.Object convertToObject(int phase,
                                        java.lang.String newString,
                                        java.lang.Object previousValue)
                                 throws DataTypeConversionException
Convert the input string to a date. Throw an exception on error.
Overrides:
convertToObject in class UIDataType
Parameters:
phase - int The current validation phase. The phase can be one of the following:
	FORM_NOTIFICATION_IMMEADIATE : Typically no validation is performed in this case the input string is returned as is.
	FORM_NOTIFICATION_ON_FOCUS_CHANGE 	 
 	FORM_NOTIFICATION_ON_REQUEST
	
newString - The String to convert.
Returns:
An object representing the converted String or null.
See Also:
IDataType.convertToObject(int, String, Object)

convertToString

public java.lang.String convertToString(java.lang.Object object,
                                        boolean forEditing)
Return the String represenation of the object or the empty string if object is null. The default implementation calls the toString() to return a string representation of the object. Subclasses should override this method to return the formatted data type as a String.
Overrides:
convertToString in class UIDataType
See Also:
IDataType.convertToString(Object, boolean)

filterInput

public java.lang.String filterInput(java.lang.String newString)
The default implementation returns original string without modification.
Overrides:
filterInput in class UIDataType
See Also:
IDataType.filterInput(String)

free

public void free()
The receiver is being destroyed. Release all the associated resources.
Overrides:
free in class com.ibm.ulc.ui.UIProxy

handleRequest

public void handleRequest(ORBConnection conn,
                          java.lang.String request,
                          Anything args)
The ULC application has sent a request to this object. Do all processing necessary. If this object does not handle this request call super.handleRequest.
Overrides:
handleRequest in class com.ibm.ulc.ui.UIProxy
Parameters:
conn - ORBConnection The connection on which the reply should be sent.
request - String The string that identifies this request.
args - Anything The arguments associated with this request.

hasValidCharacters

public boolean hasValidCharacters(java.lang.String s)

initializeValidCharacters

protected void initializeValidCharacters(java.lang.String formatString)
Initialize the valid characters specific for the receiver: all characters of the formatString except aA..zZ are added to the standard valid characters (we do not take into account quoted letters). Creation date: (07.01.00 13:53:40)
Parameters:
formatString - java.lang.String

inputFormatFor

protected java.lang.String inputFormatFor(java.lang.String outputFormatString)
Answer the input format (with abbreviated year) corresponding to the given output format
Parameters:
outputFormatString - String
Returns:
String

restoreState

public void restoreState(ORBConnection conn,
                         Anything args)
This method is the first method called after this widget is instantiated. All widget specific initialization must take place in this method. All the parameters necessary to initialize this widget are specified in the arguments. Subclasses implementing this method must call the superclass implementation as well.
Overrides:
restoreState in class com.ibm.ulc.ui.UIProxy
Parameters:
conn - the UlcConnection in which this operation is performed
args - the Anything containing the optional initialization parameters

setFormatString

public void setFormatString(java.lang.String outputFormatString)
Set the formatters according to outputFormatString. outputFormatString is cut in several alternative format strings; for output the first format is chosen; for input we store the whole collection, and take the first that does not cause a parse exception. Note: Case *does* matter.

writeYsOn

protected void writeYsOn(int readYs,
                         java.lang.StringBuffer writeStream)
Write a suitable number of ys to the input format writeStream, given the fact that readYs are present in the output format.
Parameters:
readYs - int
writeStream - StringBuffer