EchoPoint
1.0

echopoint.validation
Class SimpleRuleSet

java.lang.Object
  extended byechopoint.validation.SimpleRuleSet
All Implemented Interfaces:
java.io.Serializable, ValidationMutableRuleSet, ValidationRuleSet

public class SimpleRuleSet
extends java.lang.Object
implements ValidationMutableRuleSet

SimpleRuleSet is an base class that can be used as the basis of other ValidationRuleSet classes. Initially it contains no rules and returns ValidationRuleSet.RULE_ON_DEFAULT during getRunOptions().

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface echopoint.validation.ValidationRuleSet
RULE_ON_BLUR_RUN_AGGRESSIVE, RULE_ON_BLUR_RUN_ALL, RULE_ON_DEFAULT, RULE_ON_SUBMIT_RUN_ALL
 
Constructor Summary
SimpleRuleSet()
          Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the no rules in place.
SimpleRuleSet(int runOptions)
          Constructs a SimpleRuleSet with the runOptions and no rules in place
SimpleRuleSet(int runOptions, ValidationRule rule)
          Constructs a SimpleRuleSet with the specified runOptions and the specified ValidationRule.
SimpleRuleSet(int runOptions, ValidationRule[] rules)
           
SimpleRuleSet(int runOptions, ValidationRule[] rules, java.lang.String fieldName)
          Constructs a SimpleRuleSet with the specified runOptions and the array of ValidationRules and the specified field name.
SimpleRuleSet(java.lang.String fieldName)
          Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the no rules in place and the specified field name.
SimpleRuleSet(ValidationRule rule)
          Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the specified ValidationRule.
SimpleRuleSet(ValidationRule[] rules)
          Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the specified array of ValidationRules.
 
Method Summary
 void add(int index, ValidationRule rule)
          Adds a rule to the rule set at the specified index
 void add(ValidationRule rule)
          Adds a rule to the end of the ruleset
 ClientAddressable getClientResultDisplay()
          This returns a component that implements ClientAddressable and can therefore by used to display the result of a client side validation.
 java.lang.String getName(Validateable validateable)
          If a field name was provided on the constructor or via the setName() method, then it will be sued as the field name.
 ValidationRule[] getRules()
          Returns an array of ValidationRules fro this ValidationRuleSet.
 int getRunOptions()
          Returns ValidationRuleSet.RULE_ON_DEFAULT as the default.
 java.util.Iterator iterator()
          Returns an iterator that can iterate over the rules in the ruleset
 void remove(int index)
          Removes the rule at the specified index
 void remove(ValidationRule rule)
          Removes the specified rule
 void setClientResultDisplay(ClientAddressable clientResultDisplay)
          Sets the clientResultDisplay to use or null if its not needed.
 void setName(java.lang.String fieldName)
          Sets the name to be returned in the getName() method.
 void setRunOptions(int newRunOptions)
          Sets the new run optons for this ruleset
 int size()
          Returns the number of rules in the ruleset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleRuleSet

public SimpleRuleSet()
Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the no rules in place.


SimpleRuleSet

public SimpleRuleSet(java.lang.String fieldName)
Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the no rules in place and the specified field name.

Parameters:
fieldName - - the name of the field

SimpleRuleSet

public SimpleRuleSet(int runOptions)
Constructs a SimpleRuleSet with the runOptions and no rules in place

Parameters:
runOptions - - the run options to use

SimpleRuleSet

public SimpleRuleSet(ValidationRule rule)
Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the specified ValidationRule.

Parameters:
rule - - the ValidationRule to use

SimpleRuleSet

public SimpleRuleSet(ValidationRule[] rules)
Constructs a SimpleRuleSet with runOptions as ValidationRuleSet.RULE_ON_DEFAULT and the specified array of ValidationRules.

Parameters:
rules - - the ValidationRules to use

SimpleRuleSet

public SimpleRuleSet(int runOptions,
                     ValidationRule rule)
Constructs a SimpleRuleSet with the specified runOptions and the specified ValidationRule.

Parameters:
runOptions - - the run options to use
rule - - the ValidationRule to use

SimpleRuleSet

public SimpleRuleSet(int runOptions,
                     ValidationRule[] rules)

SimpleRuleSet

public SimpleRuleSet(int runOptions,
                     ValidationRule[] rules,
                     java.lang.String fieldName)
Constructs a SimpleRuleSet with the specified runOptions and the array of ValidationRules and the specified field name.

Parameters:
runOptions - - the run options to use
rules - - the ValidationRules to use
fieldName - - if this is non null, then it will be used as the rule set name
Method Detail

iterator

public java.util.Iterator iterator()
Description copied from interface: ValidationMutableRuleSet
Returns an iterator that can iterate over the rules in the ruleset

Specified by:
iterator in interface ValidationMutableRuleSet
Returns:
an iterator that can iterate over the rules in the ruleset
See Also:
ValidationMutableRuleSet.iterator()

size

public int size()
Description copied from interface: ValidationMutableRuleSet
Returns the number of rules in the ruleset

Specified by:
size in interface ValidationMutableRuleSet
Returns:
the number of rules in the ruleset
See Also:
ValidationMutableRuleSet.size()

add

public void add(ValidationRule rule)
Description copied from interface: ValidationMutableRuleSet
Adds a rule to the end of the ruleset

Specified by:
add in interface ValidationMutableRuleSet
Parameters:
rule - - the new rule to be added
See Also:
ValidationMutableRuleSet.add(echopoint.validation.ValidationRule)

add

public void add(int index,
                ValidationRule rule)
Description copied from interface: ValidationMutableRuleSet
Adds a rule to the rule set at the specified index

Specified by:
add in interface ValidationMutableRuleSet
Parameters:
index - - the index to add the rule at
rule - - the new ValidationRule
See Also:
ValidationMutableRuleSet.add(int, echopoint.validation.ValidationRule)

remove

public void remove(ValidationRule rule)
Description copied from interface: ValidationMutableRuleSet
Removes the specified rule

Specified by:
remove in interface ValidationMutableRuleSet
Parameters:
rule - - the rule to rmeove
See Also:
ValidationMutableRuleSet.remove(echopoint.validation.ValidationRule)

remove

public void remove(int index)
Description copied from interface: ValidationMutableRuleSet
Removes the rule at the specified index

Specified by:
remove in interface ValidationMutableRuleSet
Parameters:
index - - the index of the rule to be removed
See Also:
ValidationMutableRuleSet.remove(int)

getRunOptions

public int getRunOptions()
Returns ValidationRuleSet.RULE_ON_DEFAULT as the default.

Specified by:
getRunOptions in interface ValidationRuleSet
Returns:
the rule set otions
See Also:
ValidationRuleSet.getRunOptions()

setRunOptions

public void setRunOptions(int newRunOptions)
Sets the new run optons for this ruleset

Parameters:
newRunOptions -

getRules

public ValidationRule[] getRules()
Description copied from interface: ValidationRuleSet
Returns an array of ValidationRules fro this ValidationRuleSet. The rules are run to see if this ValidationRuleSet is valid.

Specified by:
getRules in interface ValidationRuleSet
Returns:
an array of ValidationRules fro this ValidationRuleSet.
See Also:
ValidationRuleSet.getRules()

getName

public java.lang.String getName(Validateable validateable)
If a field name was provided on the constructor or via the setName() method, then it will be sued as the field name.

Otherwise the Validateable's getIdentifier() will be used to look for the attribute named "validationName". For example "type=1; validationName=suburb" would return a field name of 'suburb'.

If this is not available, a name will be generates in the form "field"XXXX where XXX is an unique id

Specified by:
getName in interface ValidationRuleSet
Parameters:
validateable -
Returns:
a String name based on validateable
See Also:
ValidationRuleSet.getName(Validateable), IdKit.getAttribute(Object, String)

setName

public void setName(java.lang.String fieldName)
Sets the name to be returned in the getName() method.

Parameters:
fieldName - - the new field name
See Also:
getName(Validateable)

getClientResultDisplay

public ClientAddressable getClientResultDisplay()
Description copied from interface: ValidationRuleSet
This returns a component that implements ClientAddressable and can therefore by used to display the result of a client side validation. If null is returned, then the default client side popup box will be shown

Specified by:
getClientResultDisplay in interface ValidationRuleSet
Returns:
a component that implements ClientAddressable
See Also:
ValidationRuleSet.getClientResultDisplay()

setClientResultDisplay

public void setClientResultDisplay(ClientAddressable clientResultDisplay)
Sets the clientResultDisplay to use or null if its not needed.

Parameters:
clientResultDisplay - the clientResultDisplay to use.
See Also:
ValidationRuleSet.getClientResultDisplay()

EchoPoint
1.0