JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field.validate
Class JCLongValidator

java.lang.Object
  |
  +--com.klg.jclass.field.validate.AbstractValidator
        |
        +--com.klg.jclass.field.validate.JCNumberValidator
              |
              +--com.klg.jclass.field.validate.JCLongValidator
All Implemented Interfaces:
JCValidator, Serializable
Direct Known Subclasses:
JCByteValidator, JCIntegerValidator, JCShortValidator

public class JCLongValidator
extends JCNumberValidator

This class validates objects of type long.

See Also:
Serialized Form

Field Summary
protected  Object CANT_USE_DISPLAY_LIST
           
protected  Object defaultValue
           
protected  String[] display_list
           
protected static String maxstring
           
protected static String minstring
           
 
Fields inherited from class com.klg.jclass.field.validate.JCNumberValidator
currency_locale, currencySymbols, display_pattern, displayFormat, edit_pattern, editFormat, exponentialChar, isCurrency, spin_policy, symbols, use_intl_currency_symbol
 
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_SUBFIELD, SPIN_WRAP, supportedClasses, UPPERCASE, valid_chars
 
Fields inherited from interface com.klg.jclass.field.validate.JCValidator
DOWN, UP
 
Constructor Summary
JCLongValidator()
          Constructs a JCLongValidator.
JCLongValidator(Locale locale, Number min, Number max, ListModel picklist, boolean match_picklist, String[] display_list, Number increment, String display_pattern, boolean allow_null, boolean currency, boolean use_intl_currency_locale, Locale currency_locale, Object default_value)
          Constructs a JCLongValidator with the values specified.
 
Method Summary
protected  Object addIncrement(Object current)
           
 void changeText(com.klg.jclass.field.validate.TextEvent e)
          Changes the specified text from the start_position to the end_position by inserting/replacing it by specified new_text.
 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.
protected  DecimalFormat createDisplayFormat(Locale l)
           
protected  DecimalFormat createEditFormat(Locale l)
           
 String format(Object obj)
          Returns a formatted String given an object.
 String formatForEdit(Object obj)
          Generates a String representation of the given object for use in edit mode.
protected  Object formatFromDisplayList(Object obj)
           
 Object getDefaultValue()
          Returns the default value for the field.
 String[] getDisplayList()
          Returns the value of DisplayList.
 Number getIncrement()
          Gets the number by which to spin the values in numeric spin fields.
 String[] getStringList()
          Returns the value of DisplayList.
protected  Class[] getSupportedClasses()
          Creates a list of classes supported by the validator.
 boolean hasEditFormat()
          Reports whether the validator has a different edit format or not.
 boolean inRange(long value)
          Checks if the value is in the valid range.
 boolean inRange(Number value)
          Checks if the value is in the valid range.
 boolean inRange(Object value)
          Checks if the value is in the valid range.
 Object parse(Class class_type, String text)
          Parses the given text and validates it.
protected  Object parseFromDisplayList(String text)
           
 void setDefaultValue(Object default_value)
          Sets the default value for the field.
 void setDisplayList(String[] list)
          Sets the display list, which specifies a String format for the value in the picklist independent of what the format() method generates.
 void setIncrement(long increment)
          Sets the number by which to spin the values in numeric spin fields.
 void setIncrement(Number increment)
          Sets the number by which to spin the values in numeric spin fields.
 void setMax(long max)
          Sets the maximum valid value.
 void setMin(long min)
          Sets the minimum valid value.
protected  void setPatterns()
           
protected  Object subtractIncrement(Object current)
           
 boolean validate(Object value)
          Validates a given object.
 
Methods inherited from class com.klg.jclass.field.validate.JCNumberValidator
copyValue, getCurrencyLocale, getCurrencySymbol, getCurrencySymbol, getDisplayFormat, getDisplayPattern, getEditFormat, getEditPattern, getFirstValidCursorPosition, getIntlCurrencySymbol, getLocalCurrencySymbol, getUseIntlCurrencySymbol, isCurrency, setCurrency, setCurrencyLocale, setCursor, setDisplayFormat, setDisplayPattern, setEditFormat, setEditPattern, setLocale, setUseIntlCurrencySymbol
 
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, 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

minstring

protected static final String minstring

maxstring

protected static final String maxstring

display_list

protected String[] display_list

defaultValue

protected Object defaultValue

CANT_USE_DISPLAY_LIST

protected Object CANT_USE_DISPLAY_LIST
Constructor Detail

JCLongValidator

public JCLongValidator()
Constructs a JCLongValidator.


JCLongValidator

public JCLongValidator(Locale locale,
                       Number min,
                       Number max,
                       ListModel picklist,
                       boolean match_picklist,
                       String[] display_list,
                       Number increment,
                       String display_pattern,
                       boolean allow_null,
                       boolean currency,
                       boolean use_intl_currency_locale,
                       Locale currency_locale,
                       Object default_value)
Constructs a JCLongValidator with the values specified.

Parameters:
allow_null -
currency -
currency_locale -
default_value -
display_list -
display_pattern -
increment -
locale -
match_picklist -
max -
min -
picklist -
use_intl_currency_locale -
Method Detail

getSupportedClasses

protected Class[] getSupportedClasses()
Creates a list of classes supported by the validator.

Returns:

getDisplayList

public String[] getDisplayList()
Returns the value of DisplayList.

Returns:
the value of DisplayList
See Also:
setDisplayList(java.lang.String[])

getStringList

public String[] getStringList()
Returns the value of DisplayList. If the user has not set a Displaylist, the validator will construct one from the picklist using the format() method on the items in the picklist. If the picklist has not been set, then this method will return null.

Returns:
See Also:
setDisplayList(java.lang.String[]), AbstractValidator.setPickList(javax.swing.ListModel)

setDisplayList

public void setDisplayList(String[] list)
Sets the display list, which specifies a String format for the value in the picklist independent of what the format() method generates. This is particularly useful in the case of Enumerated Database types where 1 = Mr, 2 = Mrs, etc. In this case, you would set the DisplayList so that if the internal value was 1, then Mr would be displayed.

Parameters:
list -

setMax

public void setMax(long max)
Sets the maximum valid value.

Parameters:
max -

setMin

public void setMin(long min)
Sets the minimum valid value.

Parameters:
min -

addIncrement

protected Object addIncrement(Object current)
Specified by:
addIncrement in class AbstractValidator

setPatterns

protected void setPatterns()
Specified by:
setPatterns in class JCNumberValidator

createDisplayFormat

protected DecimalFormat createDisplayFormat(Locale l)
Specified by:
createDisplayFormat in class JCNumberValidator

createEditFormat

protected DecimalFormat createEditFormat(Locale l)
Specified by:
createEditFormat in class JCNumberValidator

subtractIncrement

protected Object subtractIncrement(Object current)
Specified by:
subtractIncrement in class AbstractValidator

getIncrement

public Number getIncrement()
Gets the number by which to spin the values in numeric spin fields.

Returns:

setIncrement

public void setIncrement(Number increment)
Sets the number by which to spin the values in numeric spin fields.

Parameters:
increment -

setIncrement

public void setIncrement(long increment)
Sets the number by which to spin the values in numeric spin fields.

Parameters:
increment -

inRange

public boolean inRange(long value)
Checks if the value is in the valid range.

Parameters:
value -
Returns:

inRange

public boolean inRange(Number value)
Checks if the value is in the valid range.

Parameters:
value -
Returns:

inRange

public boolean inRange(Object value)
Checks if the value is in the valid range.

Specified by:
inRange in class AbstractValidator
Parameters:
value -
Returns:

changeText

public void changeText(com.klg.jclass.field.validate.TextEvent e)
Changes the specified text from the start_position to the end_position by inserting/replacing it by specified new_text.

Specified by:
changeText in interface JCValidator
Overrides:
changeText in class AbstractValidator
Parameters:
e -

parse

public Object parse(Class class_type,
                    String text)
Parses the given text and validates it.

Specified by:
parse in interface JCValidator
Specified by:
parse in class AbstractValidator
Parameters:
class_type - object returned will be of the specified class type
text - text to parse
Returns:

validate

public boolean validate(Object value)
Validates a given object.

Specified by:
validate in interface JCValidator
Overrides:
validate in class AbstractValidator
Parameters:
value -
Returns:

formatForEdit

public String formatForEdit(Object obj)
Generates a String representation of the given object for use in edit mode.

Specified by:
formatForEdit in interface JCValidator
Specified by:
formatForEdit in class AbstractValidator
Parameters:
obj -
Returns:

hasEditFormat

public boolean hasEditFormat()
Reports whether the validator has a different edit format or not.

Specified by:
hasEditFormat in interface JCValidator
Specified by:
hasEditFormat in class AbstractValidator
Returns:

format

public String format(Object obj)
Returns a formatted String given an object.

Specified by:
format in interface JCValidator
Overrides:
format in class JCNumberValidator
Parameters:
obj -
Returns:
formatted String given an object

convertToSupported

public Object convertToSupported(Object obj)
Converts the specified type (if possible) to the type supported by the validator. To reverse this operation, use the convertFromSupported() method.

Specified by:
convertToSupported in class AbstractValidator
Parameters:
obj -
Returns:
See Also:
convertFromSupported(java.lang.Object, java.lang.Class)

convertFromSupported

public Object convertFromSupported(Object from,
                                   Class class_type)
Converts the supported type to the type supported by the validator.
Note: The object passed in is not modified but only used as a reference.

Specified by:
convertFromSupported in class AbstractValidator
Parameters:
from -
class_type -
Returns:
See Also:
convertToSupported(java.lang.Object)

getDefaultValue

public Object getDefaultValue()
Returns the default value for the field.

Returns:
default value for the field

setDefaultValue

public void setDefaultValue(Object default_value)
Sets the default value for the field.

Parameters:
default_value -

parseFromDisplayList

protected Object parseFromDisplayList(String text)

formatFromDisplayList

protected Object formatFromDisplayList(Object obj)

Copyright © 2004 Quest Software Inc..
All rights reserved.