Rational Developer for Power Systems Software
V7.6

com.ibm.etools.iseries.ui
Class ComparisonRangeValidator

java.lang.Object
  extended by com.ibm.etools.iseries.ui.AbstractValidator
      extended by com.ibm.etools.iseries.ui.ComparisonRangeValidator
All Implemented Interfaces:
Validator, PropertyChangeListener, VetoableChangeListener, Serializable, EventListener

public class ComparisonRangeValidator
extends AbstractValidator
implements PropertyChangeListener, VetoableChangeListener, Serializable

ComparisonRangeValidator extends AbstractValidator. It can perform two types of data validation:

The type of validation is set in the validityCheckType property.

Comparison Validation can be:

Range Validation is true if the comparing value is greater or equal to the minimum value and less than or equal to the maximum value.

In order to perform a validation, DataAttributes information must be passed to the ComparisonRangeValidator so that the comparison value (numeric or character string) is specified.

The property nullAllowed defaults to true. When no data is entered, the field will not change to reverse the image color if null conflicts with the validation. For example, if the validityCheckType is Comparison, comparisonType is GT, and comparisonValue is "abc", the null string will not be valid since it is less than "abc". But if nullAllowed is true, the field will not change to reverse the image color.

You can set a collatorStrength property to determine the level of difference considered significant in comparisons. The strengths are identical to the strength of java.text.Collator. Four strengths are allowed:

The default strength is java.text.Collator.PRIMARY. You can also set the decomposition mode of Collator. There are three levels of decomposition mode:

The default value is java.text.Collator.NO_DECOMPOSITION.

See Also:
Collator, DefaultValidator, Validator, Serialized Form

Field Summary
static int COMPARISON_EQ
          Comparison type is Equal
static int COMPARISON_GE
          Comparison type is Greater Than and Equal
static int COMPARISON_GT
          Comparison type is Greater Than
static int COMPARISON_LE
          Comparison type is Less Than and Equal
static int COMPARISON_LT
          Comparison type is Less Than
static int COMPARISON_NE
          Comparison type is Not Equal
static int COMPARISON_NG
          Comparison type is Not Greater Than
static int COMPARISON_NL
          Comparison type is Not Less Than
static int COMPARISON_NONE
          Comparison type is none.
static String Copyright
           
protected  PropertyChangeSupport propertyChange
           
static int VALIDITYTYPE_COMPARISON
          Validity check type is Comparison type.
static int VALIDITYTYPE_NONE
          Validity check type is none.
static int VALIDITYTYPE_RANGE
          Validity check type is Range type.
 
Fields inherited from interface com.ibm.etools.iseries.ui.Validator
copyright
 
Constructor Summary
ComparisonRangeValidator()
          Constructs a new ComparisonRangeValidator
ComparisonRangeValidator(Attributes dataAttributes)
          Constructs a new ComparisonRangeValidator with the specified DataAttributes.
ComparisonRangeValidator(Attributes dataAttributes, int validityCheckType, int comparisonType, String comparisonValue, String minimumRange, String maximumRange)
          Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange.
ComparisonRangeValidator(Attributes dataAttributes, int validityCheckType, int comparisonType, String comparisonValue, String minimumRange, String maximumRange, int collatorStrength, int decompositionMode)
          Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange, collatorStrength and decompositionMode.
ComparisonRangeValidator(Attributes dataAttributes, int validityCheckType, int comparisonType, String comparisonValue, String minimumRange, String maximumRange, int collatorStrength, int decompositionMode, boolean nullAllowed)
          Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange, collatorStrength, decompositionMode and nullAllowed.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener l)
           
 void addVetoableChangeListener(VetoableChangeListener l)
          Add a vetoableChangeListener.
static String Copyright()
          This method returns the copyright notice for this class.
 void firePropertyChange(String propertyName, Object oldValue, Object newValue)
          The firePropertyChange method was generated to support the propertyChange field.
 int getCollatorStrength()
          Gets the collatorStrngth property (int) value.
 int getComparisonType()
          Gets the comparisonType property (int) value.
 String getComparisonValue()
          Gets the comparisonValue property (java.lang.String) value.
 Attributes getDataAttributes()
          Gets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 int getDecompositionMode()
          Gets the decompositionMode property (int) value.
 String getMaximumRange()
          Gets the maximumRange property (java.lang.String) value.
 String getMinimumRange()
          Gets the minimumRange property (java.lang.String) value.
 boolean getNullAllowed()
          Gets the nullAllowed property (boolean) value.
protected  PropertyChangeSupport getPropertyChange()
          Accessor for the propertyChange field.
 int getValidityCheckType()
          Gets the validityCheckType property (int) value.
 boolean isDataValid(String strData)
          Does validation on a string.
 void propertyChange(PropertyChangeEvent e)
          Examine the PropertyChangeEvent and decides what to do on a particular event.
 void removePropertyChangeListener(PropertyChangeListener l)
          Removes a propertyChangeListener.
 void removeVetoableChangeListener(VetoableChangeListener l)
          Removes a vetoableChangeListener.
 void setCollatorStrength(int strength)
          Sets the collatorStrength property (int) value.
 void setComparisonType(int type)
          Sets the comparisonType property (int) value.
 void setComparisonValue(String value)
          Sets the comparisonValue property (java.lang.String) value.
 void setDataAttributes(Attributes a)
          Sets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.
 void setDecompositionMode(int mode)
          Sets the decompositionMode property (int) value.
 void setMaximumRange(String maxRange)
          Sets the maximumRange property (java.lang.String) value.
 void setMinimumRange(String minRange)
          Sets the minimumRange property (java.lang.String) value.
 void setNullAllowed(boolean allowed)
          Sets the nullAllowed property (boolean) value.
 void setValidityCheckType(int valType)
          Sets the validityCheckType property (int) value.
 void vetoableChange(PropertyChangeEvent e)
          This method gets called when a constrained property is changed.
 
Methods inherited from class com.ibm.etools.iseries.ui.AbstractValidator
fireVetoableChange, getVetoPropertyChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Copyright

public static final String Copyright
See Also:
Constant Field Values

VALIDITYTYPE_NONE

public static final int VALIDITYTYPE_NONE
Validity check type is none.

See Also:
Constant Field Values

VALIDITYTYPE_COMPARISON

public static final int VALIDITYTYPE_COMPARISON
Validity check type is Comparison type.

See Also:
Constant Field Values

VALIDITYTYPE_RANGE

public static final int VALIDITYTYPE_RANGE
Validity check type is Range type.

See Also:
Constant Field Values

COMPARISON_NONE

public static final int COMPARISON_NONE
Comparison type is none.

See Also:
Constant Field Values

COMPARISON_EQ

public static final int COMPARISON_EQ
Comparison type is Equal

See Also:
Constant Field Values

COMPARISON_NE

public static final int COMPARISON_NE
Comparison type is Not Equal

See Also:
Constant Field Values

COMPARISON_LT

public static final int COMPARISON_LT
Comparison type is Less Than

See Also:
Constant Field Values

COMPARISON_NL

public static final int COMPARISON_NL
Comparison type is Not Less Than

See Also:
Constant Field Values

COMPARISON_GT

public static final int COMPARISON_GT
Comparison type is Greater Than

See Also:
Constant Field Values

COMPARISON_NG

public static final int COMPARISON_NG
Comparison type is Not Greater Than

See Also:
Constant Field Values

COMPARISON_LE

public static final int COMPARISON_LE
Comparison type is Less Than and Equal

See Also:
Constant Field Values

COMPARISON_GE

public static final int COMPARISON_GE
Comparison type is Greater Than and Equal

See Also:
Constant Field Values

propertyChange

protected transient PropertyChangeSupport propertyChange
Constructor Detail

ComparisonRangeValidator

public ComparisonRangeValidator()
Constructs a new ComparisonRangeValidator


ComparisonRangeValidator

public ComparisonRangeValidator(Attributes dataAttributes)
Constructs a new ComparisonRangeValidator with the specified DataAttributes. Please note that the parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes

ComparisonRangeValidator

public ComparisonRangeValidator(Attributes dataAttributes,
                                int validityCheckType,
                                int comparisonType,
                                String comparisonValue,
                                String minimumRange,
                                String maximumRange)
Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
validityCheckType - int
comparisonType - int
comparisonValue - java.lang.String
minimumRange - java.lang.String
maximumRange - java.lang.String

ComparisonRangeValidator

public ComparisonRangeValidator(Attributes dataAttributes,
                                int validityCheckType,
                                int comparisonType,
                                String comparisonValue,
                                String minimumRange,
                                String maximumRange,
                                int collatorStrength,
                                int decompositionMode)
Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange, collatorStrength and decompositionMode. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
validityCheckType - int
comparisonType - int
comparisonValue - java.lang.String
minimumRange - java.lang.String
maximumRange - java.lang.String
collatorStrength - int
decompositionMode - int

ComparisonRangeValidator

public ComparisonRangeValidator(Attributes dataAttributes,
                                int validityCheckType,
                                int comparisonType,
                                String comparisonValue,
                                String minimumRange,
                                String maximumRange,
                                int collatorStrength,
                                int decompositionMode,
                                boolean nullAllowed)
Constructs a new ComparisonRangeValidator with the specified DataAttributes, validityCheckType, comparisonType, comparisonValue, minimumRange, maximumRange, collatorStrength, decompositionMode and nullAllowed. Please note that the first parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Parameters:
dataAttributes - com.ibm.etools.iseries.ui.Attributes
validityCheckType - int
comparisonType - int
comparisonValue - java.lang.String
minimumRange - java.lang.String
maximumRange - java.lang.String
collatorStrength - int
decompositionMode - int
nullAllowed - boolean
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener l)

addVetoableChangeListener

public void addVetoableChangeListener(VetoableChangeListener l)
Add a vetoableChangeListener.

Overrides:
addVetoableChangeListener in class AbstractValidator
Parameters:
l - java.beans.VetoableChangeListener

Copyright

public static String Copyright()
This method returns the copyright notice for this class.

Returns:
java.lang.String

firePropertyChange

public void firePropertyChange(String propertyName,
                               Object oldValue,
                               Object newValue)
The firePropertyChange method was generated to support the propertyChange field.


getCollatorStrength

public int getCollatorStrength()
Gets the collatorStrngth property (int) value.

Returns:
The collatorStrength property value.
See Also:
setCollatorStrength(int)

getComparisonType

public int getComparisonType()
Gets the comparisonType property (int) value.

Returns:
The comparisonType property value.
See Also:
setComparisonType(int)

getComparisonValue

public String getComparisonValue()
Gets the comparisonValue property (java.lang.String) value.

Returns:
The comparisonValue property value.
See Also:
setComparisonValue(java.lang.String)

getDataAttributes

public Attributes getDataAttributes()
Gets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value.

Specified by:
getDataAttributes in interface Validator
Specified by:
getDataAttributes in class AbstractValidator
Returns:
The dataAttributes property value.
See Also:
setDataAttributes(com.ibm.etools.iseries.ui.Attributes)

getDecompositionMode

public int getDecompositionMode()
Gets the decompositionMode property (int) value.

Returns:
The decompositionMode property value.
See Also:
setDecompositionMode(int)

getMaximumRange

public String getMaximumRange()
Gets the maximumRange property (java.lang.String) value.

Returns:
The maximumRange property value.
See Also:
setMaximumRange(java.lang.String)

getMinimumRange

public String getMinimumRange()
Gets the minimumRange property (java.lang.String) value.

Returns:
The minimumRange property value.
See Also:
setMinimumRange(java.lang.String)

getNullAllowed

public boolean getNullAllowed()
Gets the nullAllowed property (boolean) value.

Returns:
The nullAllowed property value.
See Also:
setNullAllowed(boolean)

getPropertyChange

protected PropertyChangeSupport getPropertyChange()
Accessor for the propertyChange field.


getValidityCheckType

public int getValidityCheckType()
Gets the validityCheckType property (int) value.

Returns:
The validityCheckType property value.
See Also:
setValidityCheckType(int)

isDataValid

public boolean isDataValid(String strData)
Does validation on a string.

Specified by:
isDataValid in interface Validator
Specified by:
isDataValid in class AbstractValidator
Parameters:
strData - String
Returns:
true or false

propertyChange

public void propertyChange(PropertyChangeEvent e)
Examine the PropertyChangeEvent and decides what to do on a particular event.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
e - java.beans.PropertyChangeEvent

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener l)
Removes a propertyChangeListener.

Parameters:
l - PropertyChangeListener

removeVetoableChangeListener

public void removeVetoableChangeListener(VetoableChangeListener l)
Removes a vetoableChangeListener.

Overrides:
removeVetoableChangeListener in class AbstractValidator
Parameters:
l - java.beans.VetoableChangeListener

setCollatorStrength

public void setCollatorStrength(int strength)
                         throws PropertyVetoException
Sets the collatorStrength property (int) value.

Parameters:
strength - Must be one of the values: java.text.Collator.PRIMARY, java.text.Collator.SECONDARY, java.text.Collator.TERTIARY, java.text.Collator.IDENTICAL.
Throws:
PropertyVetoException
See Also:
getCollatorStrength()

setComparisonType

public void setComparisonType(int type)
                       throws PropertyVetoException
Sets the comparisonType property (int) value.

Parameters:
comparisonType - The new value for the property.
Throws:
PropertyVetoException
See Also:
getComparisonType()

setComparisonValue

public void setComparisonValue(String value)
Sets the comparisonValue property (java.lang.String) value.

Parameters:
comparisonValue - The new value for the property.
See Also:
getComparisonValue()

setDataAttributes

public void setDataAttributes(Attributes a)
                       throws PropertyVetoException
Sets the dataAttributes property (com.ibm.etools.iseries.ui.Attributes) value. Please note that the parameter must be an instance of com.ibm.etools.iseries.ui.DataAttributes; otherwise java.beans.PropertyVetoException will be thrown at run time.

Specified by:
setDataAttributes in interface Validator
Specified by:
setDataAttributes in class AbstractValidator
Parameters:
dataAttributes - The new value for the property.
Throws:
PropertyVetoException
See Also:
getDataAttributes()

setDecompositionMode

public void setDecompositionMode(int mode)
                          throws PropertyVetoException
Sets the decompositionMode property (int) value.

Parameters:
strength - Must be one of the values: java.text.Collator.NO_DECOMPOSITION, java.text.Collator.CANONICAL_DECOMPOSITION, java.text.Collator.FULL_DECOMPOSITION.
Throws:
PropertyVetoException
See Also:
getDecompositionMode()

setMaximumRange

public void setMaximumRange(String maxRange)
Sets the maximumRange property (java.lang.String) value.

Parameters:
maximumRange - The new value for the property.
See Also:
getMaximumRange()

setMinimumRange

public void setMinimumRange(String minRange)
Sets the minimumRange property (java.lang.String) value.

Parameters:
minimumRange - The new value for the property.
See Also:
getMinimumRange()

setNullAllowed

public void setNullAllowed(boolean allowed)
Sets the nullAllowed property (boolean) value.

Parameters:
allowed - The new value for the property.
See Also:
getNullAllowed()

setValidityCheckType

public void setValidityCheckType(int valType)
                          throws PropertyVetoException
Sets the validityCheckType property (int) value.

Parameters:
validityCheckType - The new value for the property.
Throws:
PropertyVetoException
See Also:
getValidityCheckType()

vetoableChange

public void vetoableChange(PropertyChangeEvent e)
                    throws PropertyVetoException
This method gets called when a constrained property is changed.

Specified by:
vetoableChange in interface VetoableChangeListener
Parameters:
e - java.beans.PropertyChangeEvent a PropertyChangeEvent object describing the event source and the property that has changed.
Throws:
PropertyVetoException - if the recipient wishes the property change to be rolled back.

Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.