JClass 4.5.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

public class JCIPAddressValidator
extends JCStringValidator

This class validates objects of type IPAddress.

See Also:
Serialized Form

Field Summary
protected  int increment_field
           
protected  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
 
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(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.
 JCIntegerValidator[] getValidators()
          Returns the set of Integer validators used to validate each subfield.
 void inferSubField(int selection_start, int selection_end)
          Infers the sub-field 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(JCIntegerValidator[] validators)
          Sets the validators to be used for each subfield of the ip.
 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, 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 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.
Method Detail

getSupportedClasses

protected Class[] getSupportedClasses()
Creates a list of classes supported by the validator.
Overrides:
getSupportedClasses in class JCStringValidator

format

public String format(Object obj)
Formats the JCIPAddress.
Overrides:
format in class JCStringValidator

parse

public Object parse(Class class_type,
                    String text)
Parses the text into a JCIPAddress object.
Overrides:
parse in class JCStringValidator
Tags copied from class: AbstractValidator
Parameters:
text - text to be converted to an object

changeText

public void changeText(TextEvent e)
Called whenever a user enters a character interactively.
Overrides:
changeText in class JCStringValidator

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

setMask

public void setMask(String mask)
Overrides setMask so the mask cannot change.
Overrides:
setMask in class JCStringValidator
Tags copied from class: JCStringValidator
See Also:
JCStringValidator.setMaskChars(java.lang.String), JCStringValidator.getMask()

setIPValidators

public void setIPValidators(JCIntegerValidator[] validators)
Sets the validators to be used for each subfield of the ip. i.e. 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.

getValidators

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

validate

public boolean validate(Object obj)
Validates the ip address. This does not mean that it will check to see if the ip address is accessible by the network.
Overrides:
validate in class JCStringValidator
Tags copied from class: AbstractValidator
Parameters:
obj - object to be checked

setSpinPolicy

public void setSpinPolicy(int spin_policy)
Overrides setSpinPolicy since we always want SPIN_SUBFIELD for this validator.
Overrides:
setSpinPolicy in class AbstractValidator

addIncrement

protected Object addIncrement(Object current)
Increments the current object by the increment value.
Overrides:
addIncrement in class JCStringValidator

subtractIncrement

protected Object subtractIncrement(Object current)
Decrements the current object by the increment value.
Overrides:
subtractIncrement in class JCStringValidator

inferSubField

public void inferSubField(int selection_start,
                          int selection_end)
Infers the sub-field 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.
Overrides:
inferSubField in class AbstractValidator

setIncrement

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

getIncrement

public Integer getIncrement()
Returns the increment.

getIncrementField

public int getIncrementField()
Returns the 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.

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
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
Overrides:
convertFromSupported in class JCStringValidator
See Also:
convertToSupported(java.lang.Object)

getDefaultValue

public Object getDefaultValue()
Returns the default value for the field.
Overrides:
getDefaultValue in class JCStringValidator

setDefaultValue

public void setDefaultValue(Object default_value)
Sets the default value for the field.
Overrides:
setDefaultValue in class JCStringValidator

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