JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field.validate
Class JCNumberValidator

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

public abstract class JCNumberValidator
extends AbstractValidator

This class is a base class for numeric validators.

See Also:
Serialized Form

Field Summary
protected  Locale currency_locale
           
protected  DecimalFormatSymbols currencySymbols
           
protected  String display_pattern
           
protected  DecimalFormat displayFormat
           
protected  String edit_pattern
           
protected  DecimalFormat editFormat
           
protected  String exponentialChar
           
protected  boolean isCurrency
           
protected  int spin_policy
           
protected  DecimalFormatSymbols symbols
           
protected  boolean 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
JCNumberValidator()
           
 
Method Summary
 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.
protected abstract  DecimalFormat createDisplayFormat(Locale l)
           
protected abstract  DecimalFormat createEditFormat(Locale l)
           
 String format(Object obj)
          Returns a formatted String given an object.
 Locale getCurrencyLocale()
          Returns the locale used to determine the currency symbol to use.
 String getCurrencySymbol()
          Returns the appropriate currency symbol of the current locale.
 String getCurrencySymbol(Locale l)
          Returns the appropriate currency symbol of the specified locale.
 DecimalFormat getDisplayFormat()
          Gets the DecimalFormat object being used by the validator.
 String getDisplayPattern()
          Returns the displayPattern.
 DecimalFormat getEditFormat()
          Gets the DecimalFormat object being used by the validator.
 String getEditPattern()
          Returns the current editPattern.
 int getFirstValidCursorPosition()
          Reports the first valid cursor position.
protected  String getIntlCurrencySymbol(Locale l)
           
protected  String getLocalCurrencySymbol(Locale l)
           
 boolean getUseIntlCurrencySymbol()
          Returns the status of the flag that indicates whether the international or local currency symbol is being used.
 boolean isCurrency()
          Returns true if the formatted data is a currency.
 void setCurrency(boolean is_currency)
          Sets the currency property for the data.
 void setCurrencyLocale(Locale l)
          Sets the locale used to determine the currency symbol.
 void setCursor(com.klg.jclass.field.validate.TextCursorEvent e)
          Sets the cursor to the specified position.
 void setDisplayFormat(DecimalFormat formatter)
          Sets the DecimalFormat object being used to format the data.
 void setDisplayPattern(String pattern)
          Sets a pattern on the DecimalFormat object used by the validator.
 void setEditFormat(DecimalFormat formatter)
          Sets the DecimalFormat object being used to format the data.
 void setEditPattern(String pattern)
          Sets a pattern on the DecimalFormat object used by the validator.
 void setLocale(Locale locale)
          Sets the Locale used for formatting and parsing.
protected abstract  void setPatterns()
           
 void setUseIntlCurrencySymbol(boolean s)
          Sets the status of the flag that indicates whether the international or local currency symbol is being used.
 
Methods inherited from class com.klg.jclass.field.validate.AbstractValidator
addIncrement, calculateSpinability, changeText, checkValidInvalid, compareValues, convertCase, convertFromSupported, convertToSupported, createPopupComponent, formatForEdit, getAllowNull, getCasePolicy, getInvalidChars, getItem, getLocale, getMatchPickList, getMax, getMin, getNextValue, getPickList, getPickListIndex, getPreviousValue, getSpinPolicy, getValidChars, hasEditFormat, inferSubField, inRange, isClassSupported, isValidChar, parse, setAllowNull, setCasePolicy, setInvalidChars, setMatchPickList, setMax, setMin, setPickList, setRange, setSpinPolicy, setValidChars, spinDown, spinUp, subtractIncrement, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.klg.jclass.field.validate.JCValidator
getDefaultValue
 

Field Detail

displayFormat

protected DecimalFormat displayFormat

editFormat

protected DecimalFormat editFormat

symbols

protected DecimalFormatSymbols symbols

currencySymbols

protected DecimalFormatSymbols currencySymbols

display_pattern

protected String display_pattern

edit_pattern

protected String edit_pattern

spin_policy

protected int spin_policy

exponentialChar

protected String exponentialChar

isCurrency

protected boolean isCurrency

currency_locale

protected Locale currency_locale

use_intl_currency_symbol

protected boolean use_intl_currency_symbol
Constructor Detail

JCNumberValidator

public JCNumberValidator()
Method Detail

copyValue

public 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.

Specified by:
copyValue in interface JCValidator
Specified by:
copyValue in class AbstractValidator
Parameters:
value - The value to be copied.
Returns:
The new copy of value.

setPatterns

protected abstract void setPatterns()

setLocale

public void setLocale(Locale locale)
Sets the Locale used for formatting and parsing.

Overrides:
setLocale in class AbstractValidator
Parameters:
locale -

createDisplayFormat

protected abstract DecimalFormat createDisplayFormat(Locale l)

createEditFormat

protected abstract DecimalFormat createEditFormat(Locale l)

setCursor

public void setCursor(com.klg.jclass.field.validate.TextCursorEvent e)
Sets the cursor to the specified position.

Specified by:
setCursor in interface JCValidator
Specified by:
setCursor in class AbstractValidator
Parameters:
e -

getDisplayPattern

public String getDisplayPattern()
Returns the displayPattern.

Returns:
displayPettern
See Also:
setDisplayPattern(java.lang.String)

setDisplayPattern

public void setDisplayPattern(String pattern)
Sets a pattern on the DecimalFormat object used by the validator.

Parameters:
pattern -
See Also:
DecimalFormat

getEditPattern

public String getEditPattern()
Returns the current editPattern.

Returns:
current editPattern
See Also:
setEditPattern(java.lang.String)

setEditPattern

public void setEditPattern(String pattern)
Sets a pattern on the DecimalFormat object used by the validator.

Parameters:
pattern -
See Also:
DecimalFormat

getDisplayFormat

public DecimalFormat getDisplayFormat()
Gets the DecimalFormat object being used by the validator.

Returns:

getEditFormat

public DecimalFormat getEditFormat()
Gets the DecimalFormat object being used by the validator.

Returns:

setDisplayFormat

public void setDisplayFormat(DecimalFormat formatter)
Sets the DecimalFormat object being used to format the data.

Parameters:
formatter -

setEditFormat

public void setEditFormat(DecimalFormat formatter)
Sets the DecimalFormat object being used to format the data.

Parameters:
formatter -

getFirstValidCursorPosition

public int getFirstValidCursorPosition()
Reports the first valid cursor position.

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

format

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

Specified by:
format in interface JCValidator
Specified by:
format in class AbstractValidator
Parameters:
obj -
Returns:
a formatted String

isCurrency

public boolean isCurrency()
Returns true if the formatted data is a currency.

Returns:
true if the formatted data is a currency

setCurrency

public void setCurrency(boolean is_currency)
Sets the currency property for the data.

Parameters:
is_currency -

getCurrencyLocale

public Locale getCurrencyLocale()
Returns the locale used to determine the currency symbol to use. If this has not been explicitly set, then the default locale of the validator is returned.

Returns:
locale used to determine the currency symbol to use

setCurrencyLocale

public void setCurrencyLocale(Locale l)
Sets the locale used to determine the currency symbol. If the CurrencyLocale is null, then the validator's Locale is used.

Parameters:
l -
See Also:
AbstractValidator.setLocale(java.util.Locale)

getLocalCurrencySymbol

protected String getLocalCurrencySymbol(Locale l)

getIntlCurrencySymbol

protected String getIntlCurrencySymbol(Locale l)

getCurrencySymbol

public String getCurrencySymbol(Locale l)
Returns the appropriate currency symbol of the specified locale.


getCurrencySymbol

public String getCurrencySymbol()
Returns the appropriate currency symbol of the current locale. If the currency locale matches the display locale and the useIntlCurrencySymbol flag is not set, then the local currency symbol will be returned; otherwise the international currency symbol is returned.

See Also:
setCurrencyLocale(java.util.Locale), AbstractValidator.setLocale(java.util.Locale), setUseIntlCurrencySymbol(boolean)

getUseIntlCurrencySymbol

public boolean getUseIntlCurrencySymbol()
Returns the status of the flag that indicates whether the international or local currency symbol is being used.

Returns:
status of the flag that indicates whether the international or local currency symbol is being used
See Also:
getCurrencySymbol(java.util.Locale)

setUseIntlCurrencySymbol

public void setUseIntlCurrencySymbol(boolean s)
Sets the status of the flag that indicates whether the international or local currency symbol is being used.

Parameters:
s -

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