1 /* 2 * This file was automatically generated by Apache Tiles Autotag. 3 */ 4 package org.apache.tiles.jsp.taglib; 5 6 import java.io.IOException; 7 8 import javax.servlet.jsp.JspException; 9 import javax.servlet.jsp.tagext.SimpleTagSupport; 10 11 import org.apache.tiles.autotag.core.runtime.ModelBody; 12 import org.apache.tiles.autotag.core.runtime.AutotagRuntime; 13 14 /** 15 * <p> 16 * <strong>Declare a list that will be pass as attribute to tile. </strong> 17 * </p> 18 * <p> 19 * Declare a list that will be pass as attribute to tile. List elements are 20 * added using the tags 'addAttribute' or 'addListAttribute'. This tag can only 21 * be used inside 'insertTemplate', 'insertDefinition', 'definition' tags. 22 * </p> 23 */ 24 public class PutListAttributeTag extends SimpleTagSupport { 25 26 /** 27 * The template model. 28 */ 29 private org.apache.tiles.template.PutListAttributeModel model = new org.apache.tiles.template.PutListAttributeModel(); 30 31 /** 32 * The name of the attribute to put. 33 */ 34 private java.lang.String name; 35 36 /** 37 * A comma-separated list of roles. If present, the attribute 38 * will be rendered only if the current user belongs to one of the roles. 39 */ 40 private java.lang.String role; 41 42 /** 43 * If <code>true</code>, the list attribute will use, as first elements, the 44 * list contained in the list attribute, put with the same name, of the containing definition. 45 */ 46 private boolean inherit; 47 48 /** 49 * If <code>true</code> the attribute will be cascaded to all nested attributes. 50 */ 51 private boolean cascade; 52 53 /** 54 * Getter for name property. 55 * 56 * @return 57 * The name of the attribute to put. 58 */ 59 public java.lang.String getName() { 60 return name; 61 } 62 63 /** 64 * Setter for name property. 65 * 66 * @param name 67 * The name of the attribute to put. 68 */ 69 public void setName(java.lang.String name) { 70 this.name = name; 71 } 72 73 /** 74 * Getter for role property. 75 * 76 * @return 77 * A comma-separated list of roles. If present, the attribute 78 * will be rendered only if the current user belongs to one of the roles. 79 */ 80 public java.lang.String getRole() { 81 return role; 82 } 83 84 /** 85 * Setter for role property. 86 * 87 * @param role 88 * A comma-separated list of roles. If present, the attribute 89 * will be rendered only if the current user belongs to one of the roles. 90 */ 91 public void setRole(java.lang.String role) { 92 this.role = role; 93 } 94 95 /** 96 * Getter for inherit property. 97 * 98 * @return 99 * If <code>true</code>, the list attribute will use, as first elements, the 100 * list contained in the list attribute, put with the same name, of the containing definition. 101 */ 102 public boolean isInherit() { 103 return inherit; 104 } 105 106 /** 107 * Setter for inherit property. 108 * 109 * @param inherit 110 * If <code>true</code>, the list attribute will use, as first elements, the 111 * list contained in the list attribute, put with the same name, of the containing definition. 112 */ 113 public void setInherit(boolean inherit) { 114 this.inherit = inherit; 115 } 116 117 /** 118 * Getter for cascade property. 119 * 120 * @return 121 * If <code>true</code> the attribute will be cascaded to all nested attributes. 122 */ 123 public boolean isCascade() { 124 return cascade; 125 } 126 127 /** 128 * Setter for cascade property. 129 * 130 * @param cascade 131 * If <code>true</code> the attribute will be cascaded to all nested attributes. 132 */ 133 public void setCascade(boolean cascade) { 134 this.cascade = cascade; 135 } 136 137 /** {@inheritDoc} */ 138 @Override 139 public void doTag() throws JspException, IOException { 140 AutotagRuntime<org.apache.tiles.request.Request> runtime = new org.apache.tiles.request.jsp.autotag.JspAutotagRuntime(); 141 if (runtime instanceof SimpleTagSupport) { 142 SimpleTagSupport tag = (SimpleTagSupport) runtime; 143 tag.setJspContext(getJspContext()); 144 tag.setJspBody(getJspBody()); 145 tag.setParent(getParent()); 146 tag.doTag(); 147 } 148 org.apache.tiles.request.Request request = runtime.createRequest(); 149 ModelBody modelBody = runtime.createModelBody(); 150 model.execute( 151 name, 152 role, 153 inherit, 154 cascade, 155 request, modelBody 156 ); 157 } 158 }