KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > facelets > tag > jsf > core > ValidateDelegateHandler


1 /**
2  * Licensed under the Common Development and Distribution License,
3  * you may not use this file except in compliance with the License.
4  * You may obtain a copy of the License at
5  *
6  * http://www.sun.com/cddl/
7  *
8  * Unless required by applicable law or agreed to in writing, software
9  * distributed under the License is distributed on an "AS IS" BASIS,
10  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
11  * implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */

14
15 package com.sun.facelets.tag.jsf.core;
16
17 import javax.faces.validator.Validator;
18
19 import com.sun.facelets.FaceletContext;
20 import com.sun.facelets.tag.TagAttribute;
21 import com.sun.facelets.tag.MetaRuleset;
22 import com.sun.facelets.tag.jsf.ValidateHandler;
23 import com.sun.facelets.tag.jsf.ValidatorConfig;
24
25 /**
26  * Register a named Validator instance on the UIComponent associated with the
27  * closest parent UIComponent custom action.<p/> See <a target="_new"
28  * HREF="http://java.sun.com/j2ee/javaserverfaces/1.1_01/docs/tlddocs/f/validator.html">tag
29  * documentation</a>.
30  *
31  * @author Jacob Hookom
32  * @version $Id: ValidateDelegateHandler.java,v 1.3 2005/08/24 04:38:50 jhook Exp $
33  */

34 public final class ValidateDelegateHandler extends ValidateHandler {
35
36     private final TagAttribute validatorId;
37
38     public ValidateDelegateHandler(ValidatorConfig config) {
39         super(config);
40         this.validatorId = this.getRequiredAttribute("validatorId");
41     }
42
43     /**
44      * Uses the specified "validatorId" to get a new Validator instance from the
45      * Application.
46      *
47      * @see javax.faces.application.Application#createValidator(java.lang.String)
48      * @see com.sun.facelets.tag.jsf.ValidateHandler#createValidator(com.sun.facelets.FaceletContext)
49      */

50     protected Validator createValidator(FaceletContext ctx) {
51         return ctx.getFacesContext().getApplication().createValidator(
52                 this.validatorId.getValue(ctx));
53     }
54
55     protected MetaRuleset createMetaRuleset(Class JavaDoc type) {
56         return super.createMetaRuleset(type).ignoreAll();
57     }
58
59 }
60
Popular Tags