Java Doc for HtmlComponentValidator.java in  » J2EE » Sofia » com » salmonllc » html » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » Sofia » com.salmonllc.html 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.salmonllc.html.HtmlComponentValidator

HtmlComponentValidator
public class HtmlComponentValidator (Code)
This class can be used to do basic validations against rows and columns in a DataStore. Simple Validation Rules can be added using the addValidationRule method and all the tests can be iterated through using the findFirstError and findNextError methods.



Constructor Summary
public  HtmlComponentValidator(String applicationName, DataStoreBuffer ds)
     Constructs a new HtmlComponentValidator based on the DataStoreBuffer passed in.
public  HtmlComponentValidator(String applicationName, String DBProfile, DataStoreBuffer ds)
     Constructs a new HtmlComponentValidator based on the DataStoreBuffer passed in.

Method Summary
public  voidaddExpressionRule(String expression, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add validation rules that will be checked by the validator.
public  voidaddExpressionRule(DataStoreExpression expression, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add validation rules that will be checked by the validator.
Parameters:
  expression - A DataStoreExpression class that returns a boolean value.
 voidaddJavaScriptRule(String javaScript, String errorMessage, HtmlFormComponent focusComp)
    
public  voidaddLookupRule(String lookupTable, String searchExpression, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add validation rules that will be checked via a lookup to another table.
public  voidaddLookupRule(String lookupTable, String searchExpression, String errorMessage, HtmlFormComponent focusComp, String descColumn, String descBucket)
     Use this method to add validation rules that will be checked via a lookup to another table.
public  voidaddLookupRule(String lookupTable, DataStoreExpression searchExpression, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add validation rules that will be checked via a lookup to another table.
public  voidaddLookupRule(String lookupTable, DataStoreExpression searchExpression, String errorMessage, HtmlFormComponent focusComp, String descColumn, String descBucket)
     Use this method to add validation rules that will be checked via a lookup to another table.
public  voidaddRangeRule(String column, Object minValue, Object maxValue, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add a range validation rule that will be checked by the validator.
public  voidaddRegularExpressionRule(String column, String regExp, String errorMessage, HtmlFormComponent focusComp)
     Adds a regular expression rule to the datastore.
public  voidaddRequiredRule(String column, String errorMessage, HtmlFormComponent focusComp)
     Use this method to add validation rules that will be checked for a required field.
public  booleanfindNextError()
     Use this method to find the next rule that is being violated using the current row in the DataStore.
public  booleanfindNextError(int rowNo)
     Use this method to find the next rule that is being violated.
Parameters:
  rowNo - The row number in the DataStore to validate.
public  intgetCurrentRule()
    
public  DataStoreBuffergetDataStoreBuffer()
     This method returns the DataStoreBuffer that the component will validate.
public  HtmlFormComponentgetErrorComponent()
     This method returns the HtmlComponent that should have the focus when it's corresponding rule is violated or null if there are no errors.
public  StringgetErrorMessage()
     This method returns the error message that should be displayed when the current rule is violated or null if there are no errors.
public  intgetRuleCount()
    
public  StringgetRuleErrorMessage(int ruleNo)
    
public  HtmlFormComponentgetRuleFocusComponent(int ruleNo)
    
 StringgetRuleJavaScript(int ruleNo)
    
 ObjectgetRuleMaxValue(int ruleNo)
    
 ObjectgetRuleMinValue(int ruleNo)
    
 RegularExpressionMatchergetRuleRegExpression(int ruleNo)
    
public  intgetRuleType(int ruleNo)
    
public  booleangetValidateExpression()
    
public  booleangetValidateLookup()
    
public  booleangetValidateRange()
    
public  booleangetValidateRegExp()
    
public  booleangetValidateRequired()
    
public  voidpopulateDescriptions()
     Use this method to fill in the descriptions for lookup columns for the current row in the datastore.
public  voidpopulateDescriptions(int rowNo)
     Use this method to fill in the descriptions for lookup columns.
public  voidreset()
     Use this method to reset the validator to the first rule in the list.
public  voidsetValidateExpression(boolean b)
    
public  voidsetValidateLookup(boolean b)
    
public  voidsetValidateRange(boolean b)
    
public  voidsetValidateRegExp(boolean b)
    
public  voidsetValidateRequired(boolean b)
    


Constructor Detail
HtmlComponentValidator
public HtmlComponentValidator(String applicationName, DataStoreBuffer ds)(Code)
Constructs a new HtmlComponentValidator based on the DataStoreBuffer passed in.



HtmlComponentValidator
public HtmlComponentValidator(String applicationName, String DBProfile, DataStoreBuffer ds)(Code)
Constructs a new HtmlComponentValidator based on the DataStoreBuffer passed in.




Method Detail
addExpressionRule
public void addExpressionRule(String expression, String errorMessage, HtmlFormComponent focusComp) throws DataStoreException(Code)
Use this method to add validation rules that will be checked by the validator.
Parameters:
  expression - A boolean expression that will trigger an error if evaluated to false.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus too if the error expression returns false.



addExpressionRule
public void addExpressionRule(DataStoreExpression expression, String errorMessage, HtmlFormComponent focusComp) throws DataStoreException(Code)
Use this method to add validation rules that will be checked by the validator.
Parameters:
  expression - A DataStoreExpression class that returns a boolean value. It will trigger an error if the value returns false.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus too if the error expression returns false.



addJavaScriptRule
void addJavaScriptRule(String javaScript, String errorMessage, HtmlFormComponent focusComp)(Code)



addLookupRule
public void addLookupRule(String lookupTable, String searchExpression, String errorMessage, HtmlFormComponent focusComp) throws DataStoreException(Code)
Use this method to add validation rules that will be checked via a lookup to another table.
Parameters:
  lookupTable - The name of the table to lookup the value against.
Parameters:
  searchExpression - A DataStoreEvaluator expression that returns a String and will be used as the where clause for the SQL that will validate the data.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus to if the error expression returns false.



addLookupRule
public void addLookupRule(String lookupTable, String searchExpression, String errorMessage, HtmlFormComponent focusComp, String descColumn, String descBucket) throws DataStoreException(Code)
Use this method to add validation rules that will be checked via a lookup to another table. In addition to checking if a set of columns are valid, this type of rule will also fill in a bucket in the datastore with a description taken from the row retrieved in the lookup table.
Parameters:
  lookupTable - The name of the table to lookup the value against.
Parameters:
  searchExpression - A DataStoreEvaluator expression that returns a String and will be used as the where clause for the SQL that will validate the data.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus to if the error expression returns false.
Parameters:
  descColumn - The name of the column in the lookup table used to fill in the description.
Parameters:
  descBucket - The name of a bucket column in the datastore to place the description.



addLookupRule
public void addLookupRule(String lookupTable, DataStoreExpression searchExpression, String errorMessage, HtmlFormComponent focusComp) throws DataStoreException(Code)
Use this method to add validation rules that will be checked via a lookup to another table.
Parameters:
  lookupTable - The name of the table to lookup the value against.
Parameters:
  searchExpression - A DataStoreExpression that returns a String and will be used as the where clause for the SQL that will validate the data.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus to if the error expression returns false.



addLookupRule
public void addLookupRule(String lookupTable, DataStoreExpression searchExpression, String errorMessage, HtmlFormComponent focusComp, String descColumn, String descBucket) throws DataStoreException(Code)
Use this method to add validation rules that will be checked via a lookup to another table. In addition to checking if a set of columns are valid, this type of rule will also fill in a bucket in the datastore with a description taken from the row retrieved in the lookup table.
Parameters:
  lookupTable - The name of the table to lookup the value against.
Parameters:
  searchExpression - A DataStoreExpression that returns a String and will be used as the where clause for the SQL that will validate the data.
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus to if the error expression returns false.
Parameters:
  descColumn - The name of the column in the lookup table used to fill in the description.
Parameters:
  descBucket - The name of a bucket column in the datastore to place the description.



addRangeRule
public void addRangeRule(String column, Object minValue, Object maxValue, String errorMessage, HtmlFormComponent focusComp) throws DataStoreException(Code)
Use this method to add a range validation rule that will be checked by the validator.
Parameters:
  minValue - The minimum allowed value in the component
Parameters:
  maxValue - The maximum allowed value in the component
Parameters:
  errorMessage - The error message to display if the error expression returns false.
Parameters:
  focusComp - The HtmlComponent to set focus too if the error expression returns false.



addRegularExpressionRule
public void addRegularExpressionRule(String column, String regExp, String errorMessage, HtmlFormComponent focusComp)(Code)
Adds a regular expression rule to the datastore. The rule will be violated if the value in the focus component doesn't match the regular expression
Parameters:
  The - column to validate
Parameters:
  regExp - The regular expression to use for validation
Parameters:
  errorMessage - The error message to display if the field is not filled in.
Parameters:
  focusComp - The HtmlComponent to set focus too if the error expression returns false.



addRequiredRule
public void addRequiredRule(String column, String errorMessage, HtmlFormComponent focusComp)(Code)
Use this method to add validation rules that will be checked for a required field.
Parameters:
  column - The colum to validate
Parameters:
  errorMessage - The error message to display if the field is not filled in.
Parameters:
  focusComp - The HtmlComponent to set focus too if the error expression returns false.



findNextError
public boolean findNextError() throws Exception(Code)
Use this method to find the next rule that is being violated using the current row in the DataStore. true if no errors are found and false if an error is found.



findNextError
public boolean findNextError(int rowNo) throws Exception(Code)
Use this method to find the next rule that is being violated.
Parameters:
  rowNo - The row number in the DataStore to validate. true if no errors are found and false if an error is found.



getCurrentRule
public int getCurrentRule()(Code)
Returns the number of the rule that was violated or -1 if none was



getDataStoreBuffer
public DataStoreBuffer getDataStoreBuffer()(Code)
This method returns the DataStoreBuffer that the component will validate.



getErrorComponent
public HtmlFormComponent getErrorComponent()(Code)
This method returns the HtmlComponent that should have the focus when it's corresponding rule is violated or null if there are no errors.



getErrorMessage
public String getErrorMessage()(Code)
This method returns the error message that should be displayed when the current rule is violated or null if there are no errors.



getRuleCount
public int getRuleCount()(Code)
Return the number of rules in the validator



getRuleErrorMessage
public String getRuleErrorMessage(int ruleNo)(Code)
Returns the error message associated with a rule



getRuleFocusComponent
public HtmlFormComponent getRuleFocusComponent(int ruleNo)(Code)
Returns the form component associated with a rule



getRuleJavaScript
String getRuleJavaScript(int ruleNo)(Code)



getRuleMaxValue
Object getRuleMaxValue(int ruleNo)(Code)



getRuleMinValue
Object getRuleMinValue(int ruleNo)(Code)



getRuleRegExpression
RegularExpressionMatcher getRuleRegExpression(int ruleNo)(Code)



getRuleType
public int getRuleType(int ruleNo)(Code)
Returns the type of validation rule (com.salmonllc.sql.ValidationRule TYPE_ constants)



getValidateExpression
public boolean getValidateExpression()(Code)



getValidateLookup
public boolean getValidateLookup()(Code)



getValidateRange
public boolean getValidateRange()(Code)



getValidateRegExp
public boolean getValidateRegExp()(Code)



getValidateRequired
public boolean getValidateRequired()(Code)



populateDescriptions
public void populateDescriptions() throws Exception(Code)
Use this method to fill in the descriptions for lookup columns for the current row in the datastore.



populateDescriptions
public void populateDescriptions(int rowNo) throws Exception(Code)
Use this method to fill in the descriptions for lookup columns.
Parameters:
  rowNo - The row number in the DataStore to fill in.



reset
public void reset()(Code)
Use this method to reset the validator to the first rule in the list. Subsequent calls to findNextError will begin checking with the first rule instead of the one with the last error.



setValidateExpression
public void setValidateExpression(boolean b)(Code)

Parameters:
  b -



setValidateLookup
public void setValidateLookup(boolean b)(Code)

Parameters:
  b -



setValidateRange
public void setValidateRange(boolean b)(Code)

Parameters:
  b -



setValidateRegExp
public void setValidateRegExp(boolean b)(Code)

Parameters:
  b -



setValidateRequired
public void setValidateRequired(boolean b)(Code)

Parameters:
  b -



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.