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 javax.faces.component; 20 21 import javax.faces.context.FacesContext; 22 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFComponent; 23 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFProperty; 24 25 /** 26 * This tag associates a parameter name-value pair with the nearest parent UIComponent. A UIComponent is created to 27 * represent this name-value pair, and stored as a child of the parent component; what effect this has depends upon the 28 * renderer of that parent component. 29 * <p> 30 * Unless otherwise specified, all attributes accept static values or EL expressions. 31 * </p> 32 */ 33 @JSFComponent(clazz = "javax.faces.component.UIParameter", template = true, 34 name = "f:param", tagClass = "org.apache.myfaces.taglib.core.ParamTag") 35 abstract class _UIParameter extends UIComponentBase 36 { 37 38 static public final String COMPONENT_FAMILY = "javax.faces.Parameter"; 39 static public final String COMPONENT_TYPE = "javax.faces.Parameter"; 40 41 /** 42 * Disable this property; although this class extends a base-class that defines a read/write rendered property, this 43 * particular subclass does not support setting it. Yes, this is broken OO design: direct all complaints to the JSF 44 * spec group. 45 */ 46 @Override 47 @JSFProperty(tagExcluded = true) 48 public void setRendered(boolean state) 49 { 50 super.setRendered(state); 51 // call parent method due TCK problems 52 // throw new UnsupportedOperationException(); 53 } 54 55 @Override 56 protected FacesContext getFacesContext() 57 { 58 //In theory the parent most of the times has 59 //the cached FacesContext instance, because this 60 //element is purely logical, and the parent is the one 61 //where encodeXXX was invoked. But only limit the 62 //search to the closest parent. 63 UIComponent parent = getParent(); 64 if (parent != null && parent.isCachedFacesContext()) 65 { 66 return parent.getFacesContext(); 67 } 68 else 69 { 70 return super.getFacesContext(); 71 } 72 } 73 74 /** 75 * The value of this component. 76 * 77 * @return the new value value 78 */ 79 @JSFProperty 80 public abstract Object getValue(); 81 82 /** 83 * The name under which the value is stored. 84 * 85 * @return the new name value 86 */ 87 @JSFProperty 88 public abstract String getName(); 89 90 /** 91 * If this property is true, the value of this component is 92 * just ignored or skipped. 93 * 94 * @since 2.0 95 */ 96 @JSFProperty(defaultValue="false", tagExcluded=true) 97 public abstract boolean isDisable(); 98 }