1 23 package com.sun.enterprise.tools.jsfext.layout.descriptor; 24 25 import java.io.IOException ; 26 27 import javax.faces.context.FacesContext; 28 import javax.faces.context.ResponseWriter; 29 import javax.faces.component.UIComponent; 30 31 32 39 public class LayoutAttribute extends LayoutElementBase implements LayoutElement { 40 41 44 public LayoutAttribute(LayoutElement parent, String name, String value, String property) { 45 super(parent, name); 46 _name = name; 47 _value = value; 48 _property = property; 49 } 50 51 54 public String getName() { 55 return _name; 56 } 57 58 61 public String getValue() { 62 return _value; 63 } 64 65 68 public String getProperty() { 69 return _property; 70 } 71 72 82 protected boolean encodeThis(FacesContext context, UIComponent component) throws IOException { 83 ResponseWriter writer = context.getResponseWriter(); 85 86 Object value = resolveValue(context, component, getValue()); 88 if ((value != null) && !value.toString().trim().equals("")) { 89 String name = getName(); 90 String prop = getProperty(); 91 if (prop == null) { 92 prop = name; 94 } else if (prop.equals("null")) { 95 prop = null; 96 } 97 writer.writeAttribute(name, value, prop); 98 } 99 100 return false; 102 } 103 104 private String _name = null; 105 private String _value = null; 106 private String _property = null; 107 } 108 | Popular Tags |