|
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
A base class for all validators.
Field Summary | |
protected boolean |
abstractInitializing
|
protected boolean |
allow_null
|
static int |
AS_IS
Leaves characters as entered in the CasePolicy property. |
protected int |
case_policy
|
protected Object |
increment
|
protected String |
invalid_chars
|
protected ResourceBundle |
li
|
protected Locale |
locale
|
static int |
LOWERCASE
Converts characters to lower case in the CasePolicy property. |
protected boolean |
match_picklist
|
protected Object |
max
|
protected Object |
min
|
static int |
NOT_FOUND
|
protected ListModel |
picklist
|
static int |
SPIN_FIELD
Allows spinning up and down between the maximum and minimum values. |
protected int |
spin_policy
|
static int |
SPIN_SUBFIELD
Allows context sensitive spinning if it is allowed. |
static int |
SPIN_WRAP
Like spin field but allows continuous spinning. |
protected Class[] |
supportedClasses
|
static int |
UPPERCASE
Converts characters to upper case in the CasePolicy property. |
protected String |
valid_chars
|
Fields inherited from interface com.klg.jclass.field.validate.JCValidator |
DOWN,
UP |
Constructor Summary | |
AbstractValidator()
|
Method Summary | |
protected abstract Object |
addIncrement(Object current)
|
int |
calculateSpinability(Object current)
Determines if the value in the field can be spun further. |
void |
changeText(TextEvent e)
Changes the specified text from the start_position to the end_position by inserting/replacing it by rge specified new_text. |
protected StringBuffer |
checkValidInvalid(String text)
Given a partially complete string, this routine looks through the list and constructs a String that matches as much as possible. |
boolean |
compareValues(Object v1,
Object v2)
Since we cannot always rely on an objects equals() method we must define our own compare method. |
char |
convertCase(char c)
Returns the value of the character as filtered by the casePolicy of the validator. |
abstract 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. |
PopupFieldEditor |
createPopupComponent()
Returns the popup component. |
abstract String |
format(Object obj)
Generates a String representation of the given object. |
abstract String |
formatForEdit(Object obj)
Generates a String representation of the given object for use in edit mode. |
boolean |
getAllowNull()
Returns whether or not null is a valid value. |
int |
getCasePolicy()
Returns the value of the casePolicy property. |
abstract int |
getFirstValidCursorPosition()
Reports the first valid cursor position. |
String |
getInvalidChars()
Returns a String of characters that are not allowed to be typed in the current field. |
protected String |
getItem(int i)
Gets a String representation of the object at the specified position in to pick list. |
Locale |
getLocale()
Returns the Locale used for formatting and parsing. |
boolean |
getMatchPickList()
Returns the value of matchPickList. |
Object |
getMax()
Returns the maximum possible value of the object checked by the validator. |
Object |
getMin()
Returns the minimum possible value of the object checked by the validator. |
protected Object |
getNextValue(int current_index)
Returns the next value in the pickList or "null" if we are already at the end of the list. |
ListModel |
getPickList()
Gets the pick list. |
int |
getPickListIndex(Object obj)
Checks to see if a given object is in the pick list. |
protected Object |
getPreviousValue(int current_index)
Returns the previous value in the pickList or "null" if we are already at the beginning of the list. |
int |
getSpinPolicy()
Returns the spin policy. |
String |
getValidChars()
Returns a String of characters that are allowed to be typed in the current field. |
abstract boolean |
hasEditFormat()
Returns true if the validator has a different edit format. |
void |
inferSubField(int s,
int e)
Infer the sub field we need to work on from the current selected region If there is no selected region then the selected region is equal to the cursor position we don't ever need to look at the cursor position This particular implementation is a stub meant to be overridden if a particular validator supports subfields |
protected abstract boolean |
inRange(Object value)
|
boolean |
isClassSupported(Class c)
Returns true if the class passed in is the native type that the validator is designed to support. |
boolean |
isValidChar(char c)
Determines whether the character specified is allowed in the field. |
abstract Object |
parse(Class c,
String text)
Validates the current display string and returns a new Object if successful, or "null" if validation fails. |
void |
setAllowNull(boolean allow_null)
Sets whether or not a null value is supplied. |
void |
setCasePolicy(int v)
Sets the value of the casePolicy property. |
abstract void |
setCursor(TextCursorEvent e)
Sets the cursor to the specified position. |
void |
setInvalidChars(String v)
Sets a String of characters that are not allowed to be input in the current field. |
void |
setLocale(Locale locale)
Sets the Locale used for formatting and parsing. |
void |
setMatchPickList(boolean v)
Sets the value of matchPickList, which controls whether values must match those in the PickList of the validator or not. |
void |
setMax(Object max)
Sets the maximum possible value of the object checked by the validator. |
void |
setMin(Object min)
Sets the minimum possible value of the object checked by the validator. |
void |
setPickList(ListModel picklist)
Sets the pick list. |
void |
setRange(Object min,
Object max)
Sets the max and min properties simultaneously. |
void |
setSpinPolicy(int spin_policy)
Sets the value of SpinPolicy. |
void |
setValidChars(String v)
Sets a String of characters which are allowed to be input in the current field. |
Object |
spinDown(Object current)
If the validator has the ability to "spin" then this gives us the previous value. |
Object |
spinUp(Object current)
If the validator has the ability to "spin" then this returns the next value. |
protected abstract Object |
subtractIncrement(Object current)
|
boolean |
validate(Object obj)
Validates the specified internal object and returns the Object if successful, or "null" if validation fails. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int AS_IS
public static final int UPPERCASE
public static final int LOWERCASE
public static final int SPIN_FIELD
public static final int SPIN_SUBFIELD
public static final int SPIN_WRAP
public static final int NOT_FOUND
protected Object max
protected Object min
protected Locale locale
protected Object increment
protected boolean allow_null
protected int case_policy
protected String invalid_chars
protected boolean match_picklist
protected String valid_chars
protected ListModel picklist
protected int spin_policy
protected boolean abstractInitializing
protected ResourceBundle li
protected Class[] supportedClasses
Constructor Detail |
public AbstractValidator()
Method Detail |
public void changeText(TextEvent e)
public abstract void setCursor(TextCursorEvent e)
text
- the current textprev_position
- the previous position of the cursornew_position
- the new position of the cursorpublic abstract Object parse(Class c, String text) throws FieldParseException
text
- text to be converted to an objectpublic boolean validate(Object obj)
obj
- object to be checkedpublic abstract Object copyValue(Object value)
public boolean compareValues(Object v1, Object v2)
public abstract String format(Object obj)
public abstract String formatForEdit(Object obj)
public abstract boolean hasEditFormat()
public abstract int getFirstValidCursorPosition()
public boolean getAllowNull()
public void setAllowNull(boolean allow_null)
public int getSpinPolicy()
setSpinPolicy(int)
public void setSpinPolicy(int spin_policy)
Value | Meaning |
---|---|
SPIN_FIELD | Default value. Allow spinning up and down between the maximum and minimum |
SPIN_SUBFIELD | Allow context sensitive spinning if it is allowed |
SPIN_WRAP | Like spin field but allows spinning from max to min and min to max |
public void inferSubField(int s, int e)
public Locale getLocale()
public void setLocale(Locale locale)
public int getCasePolicy()
setCasePolicy(int)
public void setCasePolicy(int v)
v
- AS_IS, UPPERCASE, LOWERCASEpublic char convertCase(char c)
convert
- value whose case is to be checkedpublic ListModel getPickList()
public void setPickList(ListModel picklist)
public int getPickListIndex(Object obj)
public boolean getMatchPickList()
setMatchPickList(boolean)
public void setMatchPickList(boolean v)
protected Object getNextValue(int current_index)
current_index
- index of the current item in the picklistprotected Object getPreviousValue(int current_index)
current_index
- index of the current item in the picklistpublic String getValidChars()
setValidChars(java.lang.String)
,
isValidChar(char)
public void setValidChars(String v)
isValidChar(char)
public String getInvalidChars()
setInvalidChars(java.lang.String)
,
isValidChar(char)
public void setInvalidChars(String v)
isValidChar(char)
public boolean isValidChar(char c)
setInvalidChars(java.lang.String)
,
setValidChars(java.lang.String)
public Object getMax()
setMax(java.lang.Object)
public void setMax(Object max)
setRange(java.lang.Object, java.lang.Object)
,
setMin(java.lang.Object)
public Object getMin()
setMin(java.lang.Object)
public void setMin(Object min)
setRange(java.lang.Object, java.lang.Object)
,
setMax(java.lang.Object)
public void setRange(Object min, Object max)
protected abstract boolean inRange(Object value)
protected String getItem(int i)
protected abstract Object addIncrement(Object current)
protected abstract Object subtractIncrement(Object current)
public Object spinUp(Object current)
public Object spinDown(Object current)
public int calculateSpinability(Object current)
protected StringBuffer checkValidInvalid(String text)
public boolean isClassSupported(Class c)
public PopupFieldEditor createPopupComponent()
|
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 |