1 16 package org.apache.cocoon.faces.taglib; 17 18 import org.apache.cocoon.faces.FacesUtils; 19 20 import javax.faces.component.UIComponent; 21 import javax.faces.component.UIParameter; 22 import javax.faces.FacesException; 23 24 27 public class ParameterTag extends UIComponentTag { 28 29 private String name; 30 private String value; 31 32 public void setName(String name) { 33 this.name = name; 34 } 35 36 public void setValue(String value) { 37 this.value = value; 38 } 39 40 protected String getComponentType() { 41 return "javax.faces.Parameter"; 42 } 43 44 protected String getRendererType() { 45 return null; 46 } 47 48 protected void setProperties(UIComponent component) { 49 super.setProperties(component); 50 51 UIParameter parameter; 52 try { 53 parameter = (UIParameter) component; 54 } catch (ClassCastException cce) { 55 throw new FacesException("Tag <" + getClass().getName() + "> expected UIParameter. " + 56 "Got <" + component.getClass().getName() + ">"); 57 } 58 59 if (name != null) { 60 if (FacesUtils.isExpression(name)) { 61 parameter.setValueBinding("name", createValueBinding(name)); 62 } else { 63 parameter.setName(name); 64 } 65 } 66 67 if (value != null) { 68 if (FacesUtils.isExpression(value)) { 69 parameter.setValueBinding("value", createValueBinding(value)); 70 } else { 71 parameter.setValue(value); 72 } 73 } 74 } 75 76 public void recycle() { 77 super.recycle(); 78 this.name = null; 79 this.value = null; 80 } 81 } 82 | Popular Tags |