JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.field.validate
Class JCIPAddressValidator

java.lang.Object
  |
  +--com.klg.jclass.field.validate.AbstractValidator
        |
        +--com.klg.jclass.field.validate.JCStringValidator
              |
              +--com.klg.jclass.field.validate.JCIPAddressValidator
All Implemented Interfaces:
JCValidator, Serializable

public class JCIPAddressValidator
extends JCStringValidator

This class validates objects of type IPAddress.

See Also:
Serialized Form

Field Summary
protected  int increment_field
           
protected  com.klg.jclass.field.validate.JCIntegerValidator[] validators
           
 
Fields inherited from class com.klg.jclass.field.validate.JCStringValidator
compiled_mask_ch, compiled_mask_sym, defaultValue, mask, mask_chars, mask_length, num_editable_pos, num_mask_match, 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
 
Fields inherited from interface com.klg.jclass.field.validate.JCValidator
DOWN, UP
 
Constructor Summary
JCIPAddressValidator()
          Constructs a JCIPAddressValidator.
JCIPAddressValidator(Locale locale, Number min1, Number max1, Number min2, Number max2, Number min3, Number max3, Number min4, Number max4, ListModel picklist, boolean match_picklist, Integer increment, boolean allow_null, Object default_value)
          Constructs a JCStringValidator with the values specified.
 
Method Summary
protected  Object addIncrement(Object current)
          Increments the current object by the increment value.
 void changeText(com.klg.jclass.field.validate.TextEvent e)
          Called whenever a user enters a character interactively.
 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 JCIPAddress.
 Object getDefaultValue()
          Returns the default value for the field.
 Integer getIncrement()
          Returns the increment.
 int getIncrementField()
          Returns the incrementField operated on by the currently set increment value.
protected  Class[] getSupportedClasses()
          Creates a list of classes supported by the validator.
 com.klg.jclass.field.validate.JCIntegerValidator[] getValidators()
          Returns the set of Integer validators used to validate each subfield.
 void inferSubField(int selection_start, int selection_end)
          Infers the subfield in the currently selected region that will be selected.
 Object parse(Class class_type, String text)
          Parses the text into a JCIPAddress object.
 void setDefaultValue(Object default_value)
          Sets the default value for the field.
 void setIncrement(Integer increment)
          Sets the increment when spinning a field.
 void setIncrementField(int field)
          Sets the value of the incrementField operated on by the increment.
 void setIPValidators(com.klg.jclass.field.validate.JCIntegerValidator[] validators)
          Sets the validators to be used for each subfield of the IP (for example, xxx.xxx.xxx.xxx).
 void setMask(String mask)
          Overrides setMask so the mask cannot change.
 void setSpinPolicy(int spin_policy)
          Overrides setSpinPolicy, since we always want SPIN_SUBFIELD for this validator.
protected  Object subtractIncrement(Object current)
          Decrements the current object by the increment value.
 boolean validate(Object obj)
          Validates the IP address.
 
Methods inherited from class com.klg.jclass.field.validate.JCStringValidator
compileMask, formatForEdit, getFirstValidCursorPosition, getLastValidInputCharPosition, getMask, getMaskChars, getNextCursorPosition, getNumMaskMatch, getParsedMask, getPlaceHolderChars, hasEditFormat, inRange, internalValidate, isValidChar, setCursor, setMaskChars, setNumMaskMatch, setPlaceHolderChars
 
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, isClassSupported, isValidChar, setAllowNull, setCasePolicy, setInvalidChars, setLocale, setMatchPickList, setMax, setMin, setPickList, setRange, setValidChars, spinDown, spinUp
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

increment_field

protected int increment_field

validators

protected com.klg.jclass.field.validate.JCIntegerValidator[] validators
Constructor Detail

JCIPAddressValidator

public JCIPAddressValidator()
Constructs a JCIPAddressValidator.


JCIPAddressValidator

public JCIPAddressValidator(Locale locale,
                            Number min1,
                            Number max1,
                            Number min2,
                            Number max2,
                            Number min3,
                            Number max3,
                            Number min4,
                            Number max4,
                            ListModel picklist,
                            boolean match_picklist,
                            Integer increment,
                            boolean allow_null,
                            Object default_value)
Constructs a JCStringValidator with the values specified.

Parameters:
allow_null -
default_value -
increment -
locale -
match_picklist -
max1 -
max2 -
max3 -
max4 -
min1 -
min2 -
min3 -
min4 -
picklist -
Method Detail

getSupportedClasses

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

Overrides:
getSupportedClasses in class JCStringValidator
Returns:

format

public String format(Object obj)
Formats the JCIPAddress.

Specified by:
format in interface JCValidator
Overrides:
format in class JCStringValidator
Parameters:
obj -
Returns:

parse

public Object parse(Class class_type,
                    String text)
Parses the text into a JCIPAddress object.

Specified by:
parse in interface JCValidator
Overrides:
parse in class JCStringValidator
Parameters:
class_type -
text -
Returns:

changeText

public void changeText(com.klg.jclass.field.validate.TextEvent e)
Called whenever a user enters a character interactively.

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

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
Overrides:
copyValue in class JCStringValidator
Parameters:
value -
Returns:

setMask

public void setMask(String mask)
Overrides setMask so the mask cannot change.

Overrides:
setMask in class JCStringValidator
Parameters:
mask -
See Also:
JCStringValidator.setMaskChars(java.lang.String), JCStringValidator.getMask()

setIPValidators

public void setIPValidators(com.klg.jclass.field.validate.JCIntegerValidator[] validators)
Sets the validators to be used for each subfield of the IP (for example, xxx.xxx.xxx.xxx). You can associate one validator for each subfield. If there are more than four validators specified, only the first four validators will be used.

Parameters:
validators -

getValidators

public com.klg.jclass.field.validate.JCIntegerValidator[] getValidators()
Returns the set of Integer validators used to validate each subfield.

Returns:
set of Integer validators used to validate each subfield

validate

public boolean validate(Object obj)
Validates the IP address.
Note: This does not mean that it will check to see if the IP address is accessible by the network.

Specified by:
validate in interface JCValidator
Overrides:
validate in class JCStringValidator
Parameters:
obj -
Returns:

setSpinPolicy

public void setSpinPolicy(int spin_policy)
Overrides setSpinPolicy, since we always want SPIN_SUBFIELD for this validator.

Overrides:
setSpinPolicy in class AbstractValidator
Parameters:
spin_policy -

addIncrement

protected Object addIncrement(Object current)
Increments the current object by the increment value.

Overrides:
addIncrement in class JCStringValidator
Parameters:
current -
Returns:

subtractIncrement

protected Object subtractIncrement(Object current)
Decrements the current object by the increment value.

Overrides:
subtractIncrement in class JCStringValidator
Parameters:
current -
Returns:

inferSubField

public void inferSubField(int selection_start,
                          int selection_end)
Infers the subfield in the currently selected region that will be selected. If there is no selected region, then the selected region is equal to the cursor position.

Specified by:
inferSubField in interface JCValidator
Overrides:
inferSubField in class AbstractValidator
Parameters:
selection_start -
selection_end -

setIncrement

public void setIncrement(Integer increment)
Sets the increment when spinning a field. The increment must be a Integer object.

Parameters:
increment -

getIncrement

public Integer getIncrement()
Returns the increment.

Returns:
increment

getIncrementField

public int getIncrementField()
Returns the incrementField operated on by the currently set increment value.

Returns:
incrementField operated on by the currently set increment value

setIncrementField

public void setIncrementField(int field)
Sets the value of the incrementField operated on by the increment.

Parameters:
field -

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.

Overrides:
convertToSupported in class JCStringValidator
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.

Overrides:
convertFromSupported in class JCStringValidator
Parameters:
from -
class_type -
Returns:
See Also:
convertToSupported(java.lang.Object)

getDefaultValue

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

Specified by:
getDefaultValue in interface JCValidator
Overrides:
getDefaultValue in class JCStringValidator
Returns:
default value for the field

setDefaultValue

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

Overrides:
setDefaultValue in class JCStringValidator
Parameters:
default_value -

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