Source code: com/sun/facelets/tag/ui/DefineHandler.java
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.ui;
16
17 import java.io.IOException;
18
19 import javax.el.ELException;
20 import javax.faces.FacesException;
21 import javax.faces.component.UIComponent;
22
23 import com.sun.facelets.FaceletContext;
24 import com.sun.facelets.FaceletException;
25 import com.sun.facelets.tag.TagAttribute;
26 import com.sun.facelets.tag.TagAttributeException;
27 import com.sun.facelets.tag.TagConfig;
28 import com.sun.facelets.tag.TagHandler;
29
30 /**
31 * @author Jacob Hookom
32 * @version $Id: DefineHandler.java,v 1.3 2005/08/24 04:38:55 jhook Exp $
33 */
34 public final class DefineHandler extends TagHandler {
35
36 private final String name;
37
38 /**
39 * @param config
40 */
41 public DefineHandler(TagConfig config) {
42 super(config);
43 TagAttribute attr = this.getRequiredAttribute("name");
44 if (!attr.isLiteral()) {
45 throw new TagAttributeException(this.tag, attr, "Must be Literal");
46 }
47 this.name = attr.getValue();
48 }
49
50 /*
51 * (non-Javadoc)
52 *
53 * @see com.sun.facelets.FaceletHandler#apply(com.sun.facelets.FaceletContext,
54 * javax.faces.component.UIComponent)
55 */
56 public void apply(FaceletContext ctx, UIComponent parent)
57 throws IOException, FacesException, FaceletException, ELException {
58 this.nextHandler.apply(ctx, parent);
59 }
60
61 public String getName() {
62 return this.name;
63 }
64 }