org.mmbase.applications.editwizard
Class Validator
java.lang.Object
|
+--org.mmbase.applications.editwizard.Validator
- public class Validator
- extends java.lang.Object
This class validates pre-html documents for the EditWizard.
It is mainly used to register invalid form and fields.
- Since:
- MMBase-1.6
- Version:
- $Id: Validator.java,v 1.4.2.2 2003/08/08 08:13:39 michiel Exp $
- Author:
- Kars Veling, Pierre van Rooden
|
Method Summary |
static void |
addValidationError(org.w3c.dom.Node validationnode,
int errortype,
java.lang.String errormsg)
This method adds a validation error to the form. |
static void |
createStepsOverview(org.w3c.dom.Document prehtml,
org.w3c.dom.Document schema)
Constructs an overview-node in the pre-html where all steps are described. |
static boolean |
validate(org.w3c.dom.Document prehtml,
org.w3c.dom.Document schema)
Validates the given prehtml-xml. |
static boolean |
validateField(org.w3c.dom.Node field)
This method validates one field. |
static int |
validateForm(org.w3c.dom.Node form)
This method can validate one form. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Validator
public Validator()
validate
public static boolean validate(org.w3c.dom.Document prehtml,
org.w3c.dom.Document schema)
- Validates the given prehtml-xml. Returns true if everything is valid, false if errors are found.
Detailed information about the errors are placed as subnodes of the invalid fields.
- Parameters:
Document - prehtml the prehtml which should be validatedDocument - schema the wizardschema which is needed to validate at all- Returns:
- True is the form is valid, false if it is invalid
validateForm
public static int validateForm(org.w3c.dom.Node form)
- This method can validate one form. It returns the number of invalid fields in the form.
- Parameters:
form - The form to be validated.- Returns:
- The number of invalid fields found.
validateField
public static boolean validateField(org.w3c.dom.Node field)
- This method validates one field.
- Parameters:
field - the field which should be validated.- Returns:
- true is the field is valid, false if it is invalid.
addValidationError
public static void addValidationError(org.w3c.dom.Node validationnode,
int errortype,
java.lang.String errormsg)
- This method adds a validation error to the form.
- Parameters:
validationnode - this node was validatederrortype - what kind of error was it?errormsg - what errormessage should be placed.
createStepsOverview
public static void createStepsOverview(org.w3c.dom.Document prehtml,
org.w3c.dom.Document schema)
- Constructs an overview-node in the pre-html where all steps are described.
Also, information about valid and non-valid form-schema's are placed in the steps-overview.
The node looks like this:
<steps-validator valid="false" allowsave="false" allowcancel="true">
<step form-schema="schema-id" valid="true" />
<step form-schema="schema-id" valid="false" />
</steps-validator>
THis method creates a steps-overview which can be used by the html to show what forms are valid and what are not.
- Parameters:
prehtml - the prehtml data nodeschema - the original wizardschema
MMBase build 1.6.5.20030923