|
JClass 4.5.0 API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.field.validate.AbstractValidator | +--com.klg.jclass.field.validate.JCStringValidator
This class validates objects of type String.
Field Summary | |
protected char[] |
compiled_mask_ch
|
protected int[] |
compiled_mask_sym
|
protected Object |
defaultValue
|
protected String |
mask
|
protected String |
mask_chars
|
protected int |
mask_length
|
protected int |
num_editable_pos
|
protected int |
num_mask_match
|
protected String |
place_holder_chars
|
Fields inherited from class com.klg.jclass.field.validate.AbstractValidator |
abstractInitializing,
allow_null,
AS_IS,
case_policy,
increment,
invalid_chars,
li,
locale,
LOWERCASE,
match_picklist,
max,
min,
NOT_FOUND,
picklist,
SPIN_FIELD,
spin_policy,
SPIN_SUBFIELD,
SPIN_WRAP,
supportedClasses,
UPPERCASE,
valid_chars |
Constructor Summary | |
JCStringValidator()
Constructs a JCStringValidator. |
|
JCStringValidator(Locale locale,
String mask,
int num_match,
String place_holder_chars,
ListModel picklist,
boolean match_picklist,
String valid_chars,
String invalid_chars,
boolean allow_null,
Object default_value)
Constructs a JCStringValidator with the values specified. |
Method Summary | |
protected Object |
addIncrement(Object current)
|
void |
changeText(TextEvent e)
Processes all changes in the text field. |
protected void |
compileMask()
This routine compiles the mask into 2 arrays. |
Object |
convertFromSupported(Object from,
Class class_type)
Converts the supported type to the type supported by the validator. |
Object |
convertToSupported(Object obj)
Converts the specified type (if possible) to the type supported by the validator. |
Object |
copyValue(Object value)
Since the clone() method is protected in the Object class we cannot actually clone a generic object without knowing what it is; therefore the validator must provide this routine to do the copying for JCField |
String |
format(Object obj)
Formats the text. |
String |
formatForEdit(Object obj)
Generates a String representation of the given object for use in edit mode. |
Object |
getDefaultValue()
Returns the default value for the field. |
int |
getFirstValidCursorPosition()
Returns the first valid cursor position in the text field. |
String |
getMask()
Returns the current mask. |
String |
getMaskChars()
Returns the mask characters used. |
protected int |
getNextCursorPosition(int current_position,
boolean direction)
Gets the next non-literal cursor position. |
int |
getNumMaskMatch()
Returns the number of characters to match with the mask. |
String |
getParsedMask()
Returns a string with only literals in the correct position. |
String |
getPlaceHolderChars()
Returns the placeholder string. |
protected Class[] |
getSupportedClasses()
Creates a list of classes supported by the validator. |
boolean |
hasEditFormat()
Returns true if the validator has a different edit format. |
boolean |
inRange(Object value)
Checks if the value is in the valid range. |
protected boolean |
internalValidate(Object obj)
This does the actual validation for the validate method. |
protected boolean |
isValidChar(StringBuffer buffer,
int string_position,
int actual_position)
This function checks to see if the character entered is valid. |
Object |
parse(Class class_type,
String text)
Validates the text after the text field loses focus. |
void |
setCursor(TextCursorEvent e)
Moves the cursor to a valid cursor position. |
void |
setDefaultValue(Object default_value)
Sets the default value for the field. |
void |
setMask(String mask)
Sets the mask to be used. |
void |
setMaskChars(String mask_chars)
Sets the mask characters to be used. |
void |
setNumMaskMatch(int num_mask_match)
Sets the number of characters to match with the mask from left to right. |
void |
setPlaceHolderChars(String place_holder_chars)
Sets the placeholder string, which specifies the characters to use instead of an empty mask. |
protected Object |
subtractIncrement(Object current)
|
boolean |
validate(Object obj)
Validates the value in the field. |
Methods inherited from class com.klg.jclass.field.validate.AbstractValidator |
calculateSpinability,
checkValidInvalid,
compareValues,
convertCase,
createPopupComponent,
getAllowNull,
getCasePolicy,
getInvalidChars,
getItem,
getLocale,
getMatchPickList,
getMax,
getMin,
getNextValue,
getPickList,
getPickListIndex,
getPreviousValue,
getSpinPolicy,
getValidChars,
inferSubField,
isClassSupported,
isValidChar,
setAllowNull,
setCasePolicy,
setInvalidChars,
setLocale,
setMatchPickList,
setMax,
setMin,
setPickList,
setRange,
setSpinPolicy,
setValidChars,
spinDown,
spinUp |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
protected int[] compiled_mask_sym
protected char[] compiled_mask_ch
protected int mask_length
protected int num_editable_pos
protected String mask
protected String place_holder_chars
protected String mask_chars
protected int num_mask_match
protected Object defaultValue
Constructor Detail |
public JCStringValidator()
public JCStringValidator(Locale locale, String mask, int num_match, String place_holder_chars, ListModel picklist, boolean match_picklist, String valid_chars, String invalid_chars, boolean allow_null, Object default_value)
Method Detail |
protected Class[] getSupportedClasses()
public Object copyValue(Object value)
public void setNumMaskMatch(int num_mask_match)
getNumMaskMatch()
public int getNumMaskMatch()
setNumMaskMatch(int)
public void setMask(String mask)
setMaskChars(java.lang.String)
,
getMask()
public String getMask()
setMask(java.lang.String)
public void setPlaceHolderChars(String place_holder_chars)
getPlaceHolderChars()
public String getPlaceHolderChars()
setPlaceHolderChars(java.lang.String)
public void setMaskChars(String mask_chars)
getMaskChars()
public String getMaskChars()
setMaskChars(java.lang.String)
public String getParsedMask()
setMask(java.lang.String)
public boolean inRange(Object value)
protected void compileMask()
protected boolean isValidChar(StringBuffer buffer, int string_position, int actual_position)
protected int getNextCursorPosition(int current_position, boolean direction)
public void changeText(TextEvent e)
public void setCursor(TextCursorEvent e)
text
- the current textprev_position
- the previous position of the cursornew_position
- the new position of the cursorpublic Object parse(Class class_type, String text)
text
- text to be converted to an objectpublic boolean validate(Object obj)
obj
- object to be checkedprotected boolean internalValidate(Object obj)
public String format(Object obj)
public int getFirstValidCursorPosition()
public String formatForEdit(Object obj)
public boolean hasEditFormat()
protected Object addIncrement(Object current)
protected Object subtractIncrement(Object current)
public Object convertToSupported(Object obj)
convertFromSupported(java.lang.Object, java.lang.Class)
public Object convertFromSupported(Object from, Class class_type)
convertToSupported(java.lang.Object)
public Object getDefaultValue()
public void setDefaultValue(Object default_value)
|
Copyright© 1999-2000 KL Group Inc. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |