| Line | Hits | Source |
|---|---|---|
| 1 | /* | |
| 2 | Chrysalis Web Framework [http://chrysalis.sourceforge.net] | |
| 3 | Copyright (c) 2002, 2003, 2004, Paul Strack | |
| 4 | ||
| 5 | All rights reserved. | |
| 6 | ||
| 7 | Redistribution and use in source and binary forms, with or without | |
| 8 | modification, are permitted provided that the following conditions are met: | |
| 9 | ||
| 10 | 1. Redistributions of source code must retain the above copyright notice, this | |
| 11 | list of conditions and the following disclaimer. | |
| 12 | ||
| 13 | 2. Redistributions in binary form must reproduce the above copyright notice, | |
| 14 | this list of conditions and the following disclaimer in the documentation | |
| 15 | and/or other materials provided with the distribution. | |
| 16 | ||
| 17 | 3. Neither the name of the copyright holder nor the names of its contributors | |
| 18 | may be used to endorse or promote products derived from this software without | |
| 19 | specific prior written permission. | |
| 20 | ||
| 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| 22 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 23 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 24 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
| 25 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 26 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 27 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | |
| 28 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 29 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 31 | */ | |
| 32 | ||
| 33 | package org.chwf.plugin; | |
| 34 | ||
| 35 | import java.io.IOException; | |
| 36 | ||
| 37 | import javax.servlet.jsp.JspException; | |
| 38 | import javax.servlet.jsp.JspWriter; | |
| 39 | ||
| 40 | /** | |
| 41 | * An abstract superclass for custom client-side validation scripting. | |
| 42 | * The plugin can be customized if the developer wishes to use some client-side | |
| 43 | * validation library other than FormValidation.js. | |
| 44 | * | |
| 45 | * @author <a href="mailto:pfstrack@users.sourceforge.net">Paul Strack</a> | |
| 46 | */ | |
| 47 | 1 | public abstract class Scripter { |
| 48 | ||
| 49 | /** Id for the scripter plugin in the config file. */ | |
| 50 | public static final String SCRIPTER_ID = "scripter"; | |
| 51 | ||
| 52 | /** The default scripter. */ | |
| 53 | private static final String DEFAULT_SCRIPTER = | |
| 54 | "org.chwf.plugin.defaults.DefaultScripter"; | |
| 55 | ||
| 56 | /** The scripter specified in the configuration. */ | |
| 57 | 1 | private static final Scripter SCRIPTER = init(); |
| 58 | ||
| 59 | /** | |
| 60 | * Initialize the scripter. | |
| 61 | * | |
| 62 | * @return The scripter. | |
| 63 | * @throws IllegalStateException If scripter cannot be initialized. | |
| 64 | */ | |
| 65 | private static Scripter init() throws IllegalStateException { | |
| 66 | 1 | Object plugin = |
| 67 | Plugin.initPlugin(Scripter.class, SCRIPTER_ID, DEFAULT_SCRIPTER); | |
| 68 | 1 | return (Scripter) plugin; |
| 69 | } | |
| 70 | ||
| 71 | /** No-op constructor. */ | |
| 72 | 1 | protected Scripter() { |
| 73 | 1 | } |
| 74 | ||
| 75 | /** | |
| 76 | * Returns the <code>Scripter</code> object.<p> | |
| 77 | * | |
| 78 | * @return The scripter. | |
| 79 | */ | |
| 80 | public static Scripter getInstance() { | |
| 81 | 20 | return Scripter.SCRIPTER; |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * Print JavaScript validation logic for a particular input tag.<p> | |
| 86 | * | |
| 87 | * @param data The validation data. | |
| 88 | * @param out The JspWriter for output. | |
| 89 | * @throws IOException For IO exceptions. | |
| 90 | * @throws JspException If the property cannot be initialized. | |
| 91 | */ | |
| 92 | public abstract void printValidations(ValidationData data, JspWriter out) | |
| 93 | throws IOException, JspException; | |
| 94 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |