JClass 4.5.0 API
Documentation

com.klg.jclass.field.validate
Class JCBigDecimalValidator

java.lang.Object
  |
  +--com.klg.jclass.field.validate.AbstractValidator
        |
        +--com.klg.jclass.field.validate.JCNumberValidator
              |
              +--com.klg.jclass.field.validate.JCBigDecimalValidator
Direct Known Subclasses:
JCDoubleValidator, JCFloatValidator

public class JCBigDecimalValidator
extends JCNumberValidator

This class validates objects of type BigDecimal.

See Also:
Serialized Form

Field Summary
protected  Object defaultValue
           
 
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_policy, SPIN_SUBFIELD, SPIN_WRAP, supportedClasses, UPPERCASE, valid_chars
 
Constructor Summary
JCBigDecimalValidator()
          Constructs a JCBigDecimalValidator.
JCBigDecimalValidator(Locale locale, Number min, Number max, Number increment, String display_pattern, boolean allow_null, boolean currency, boolean use_intl_currency_locale, Locale currency_locale, Object default_value)
          Constructs a JCBigDecimalValidator with the values specified.
 
Method Summary
protected  Object addIncrement(Object current)
           
 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.
 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 formatForEdit(Object obj)
          Generates a String representation of the given object for use in edit mode.
protected  BigDecimal getBigDecimal(Object num)
          Given a Number object, this method will return a BigDecimal object.
 Object getDefaultValue()
          Returns the default value for the field.
 Number getIncrement()
          Gets the number by which to spin the values in numeric spin fields.
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(BigDecimal 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.
 void setCursor(TextCursorEvent e)
          Sets the cursor to the specified position.
 void setDefaultValue(Object default_value)
          Sets the default value for the field.
 void setIncrement(Number increment)
          Sets the number by which to spin the values in numeric spin fields.
protected  void setPatterns()
           
protected  Object subtractIncrement(Object current)
           
 boolean validate(Object obj)
          Validates a given object.
 
Methods inherited from class com.klg.jclass.field.validate.JCNumberValidator
copyValue, format, getCurrencyLocale, getCurrencySymbol, getCurrencySymbol, getDisplayFormat, getDisplayPattern, getEditFormat, getEditPattern, getFirstValidCursorPosition, getIntlCurrencySymbol, getLocalCurrencySymbol, getUseIntlCurrencySymbol, isCurrency, setCurrency, setCurrencyLocale, 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

defaultValue

protected Object defaultValue
Constructor Detail

JCBigDecimalValidator

public JCBigDecimalValidator()
Constructs a JCBigDecimalValidator.

JCBigDecimalValidator

public JCBigDecimalValidator(Locale locale,
                             Number min,
                             Number max,
                             Number increment,
                             String display_pattern,
                             boolean allow_null,
                             boolean currency,
                             boolean use_intl_currency_locale,
                             Locale currency_locale,
                             Object default_value)
Constructs a JCBigDecimalValidator with the values specified.
Method Detail

getSupportedClasses

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

getBigDecimal

protected BigDecimal getBigDecimal(Object num)
Given a Number object, this method will return a BigDecimal object.

createDisplayFormat

protected DecimalFormat createDisplayFormat(Locale l)
Overrides:
createDisplayFormat in class JCNumberValidator

createEditFormat

protected DecimalFormat createEditFormat(Locale l)
Overrides:
createEditFormat in class JCNumberValidator

setPatterns

protected void setPatterns()
Overrides:
setPatterns in class JCNumberValidator

setCursor

public void setCursor(TextCursorEvent e)
Sets the cursor to the specified position.
Overrides:
setCursor in class JCNumberValidator
Tags copied from interface: JCValidator
Parameters:
text - the current text
prev_position - the previous position of the cursor
new_position - the new position of the cursor
Returns:
Returns the actual position that was set

addIncrement

protected Object addIncrement(Object current)
Overrides:
addIncrement in class AbstractValidator

subtractIncrement

protected Object subtractIncrement(Object current)
Overrides:
subtractIncrement in class AbstractValidator

getIncrement

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

setIncrement

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

inRange

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

inRange

public boolean inRange(Object value)
Checks if the value is in the valid range.
Overrides:
inRange in class AbstractValidator

changeText

public 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.
Overrides:
changeText in class AbstractValidator

parse

public Object parse(Class class_type,
                    String text)
Parses the given text and validates it.
Overrides:
parse in class AbstractValidator
Parameters:
class_type - object returned will be of the specified class type
text - text to parse

validate

public boolean validate(Object obj)
Validates a given object.
Overrides:
validate in class AbstractValidator
Tags copied from class: AbstractValidator
Parameters:
obj - object to be checked

formatForEdit

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

hasEditFormat

public boolean hasEditFormat()
Reports whether the validator has a different edit format or not.
Overrides:
hasEditFormat in class AbstractValidator

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
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 that the object passed in is not modified but only used as a reference
See Also:
convertToSupported(java.lang.Object)

getDefaultValue

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

setDefaultValue

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

Copyright© 1999-2000 KL Group Inc.
All rights reserved.