1 15 package org.apache.tapestry.parse; 16 17 import java.util.HashMap ; 18 import java.util.Map ; 19 20 import org.apache.hivemind.Location; 21 import org.apache.hivemind.util.ToStringBuilder; 22 23 33 34 public class OpenToken extends TemplateToken 35 { 36 private String _tag; 37 38 private String _id; 39 40 private String _componentType; 41 42 private Map _attributes; 43 44 57 58 public OpenToken(String tag, String id, String componentType, Location location) 59 { 60 super(TokenType.OPEN, location); 61 62 _tag = tag; 63 _id = id; 64 _componentType = componentType; 65 } 66 67 70 71 public String getId() 72 { 73 return _id; 74 } 75 76 79 80 public String getTag() 81 { 82 return _tag; 83 } 84 85 89 90 public String getComponentType() 91 { 92 return _componentType; 93 } 94 95 public void addAttribute(String name, String value) 96 { 97 if (_attributes == null) 98 _attributes = new HashMap (); 99 100 _attributes.put(name, value); 101 } 102 103 106 107 public Map getAttributesMap() 108 { 109 return _attributes; 110 } 111 112 protected void extendDescription(ToStringBuilder builder) 113 { 114 builder.append("id", _id); 115 builder.append("componentType", _componentType); 116 builder.append("tag", _tag); 117 builder.append("attributes", _attributes); 118 } 119 120 } | Popular Tags |