1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.view.facelets; 20 21 import java.io.IOException; 22 import java.net.URL; 23 24 import javax.el.ELException; 25 import javax.el.ExpressionFactory; 26 import javax.faces.FacesException; 27 import javax.faces.application.Resource; 28 import javax.faces.component.UIComponent; 29 import javax.faces.context.FacesContext; 30 import javax.faces.view.facelets.Facelet; 31 import javax.faces.view.facelets.FaceletException; 32 33 34 /** 35 * @author Leonardo Uribe (latest modification by $Author$) 36 * @version $Revision$ $Date$ 37 * @since 2.0.1 38 */ 39 public abstract class AbstractFacelet extends Facelet 40 { 41 42 /** 43 * Return this Facelet's ExpressionFactory instance 44 * 45 * @return internal ExpressionFactory instance 46 */ 47 public abstract ExpressionFactory getExpressionFactory(); 48 49 /** 50 * Used for delegation by the DefaultFaceletContext. 51 * 52 * @see javax.faces.view.facelets.FaceletContext#includeFacelet(UIComponent, String) 53 * @param ctx 54 * FaceletContext to pass to the included Facelet 55 * @param parent 56 * UIComponent to apply changes to 57 * @param path 58 * relative path to the desired Facelet from the FaceletContext 59 * @throws IOException 60 * @throws FacesException 61 * @throws FaceletException 62 * @throws ELException 63 */ 64 public abstract void include(AbstractFaceletContext ctx, UIComponent parent, String path) 65 throws IOException, FacesException, FaceletException, ELException; 66 67 /** 68 * Grabs a DefaultFacelet from referenced DefaultFaceletFacotry 69 * 70 * @see org.apache.myfaces.view.facelets.impl.DefaultFaceletFactory#getFacelet(URL) 71 * @param ctx 72 * FaceletContext to pass to the included Facelet 73 * @param parent 74 * UIComponent to apply changes to 75 * @param url 76 * URL source to include Facelet from 77 * @throws IOException 78 * @throws FacesException 79 * @throws FaceletException 80 * @throws ELException 81 */ 82 public abstract void include(AbstractFaceletContext ctx, UIComponent parent, URL url) 83 throws IOException, FacesException, FaceletException, ELException; 84 85 /** 86 * Return the alias name for error messages and logging 87 * 88 * @return alias name 89 */ 90 public abstract String getAlias(); 91 92 public abstract void applyCompositeComponent(AbstractFaceletContext ctx, UIComponent parent, Resource resource) 93 throws IOException, FacesException, FaceletException, ELException; 94 95 public abstract void applyDynamicComponentHandler(FacesContext facesContext, UIComponent parent, 96 String baseKey) 97 throws IOException, FacesException, FaceletException, ELException; 98 99 public abstract boolean isBuildingCompositeComponentMetadata(); 100 101 /** 102 * Return an identifier used to derive an unique id per facelet instance. This 103 * value should be the same for viewMetadata and normal facelet instances. 104 * 105 * @return 106 */ 107 public String getFaceletId() 108 { 109 return getAlias(); 110 } 111 }