001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.jee;
017:
018: import javax.xml.bind.annotation.XmlAccessType;
019: import javax.xml.bind.annotation.XmlAccessorType;
020: import javax.xml.bind.annotation.XmlAttribute;
021: import javax.xml.bind.annotation.XmlElement;
022: import javax.xml.bind.annotation.XmlID;
023: import javax.xml.bind.annotation.XmlTransient;
024: import javax.xml.bind.annotation.XmlType;
025: import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
026: import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
027: import java.util.ArrayList;
028: import java.util.Collection;
029: import java.util.List;
030: import java.util.Map;
031:
032: /**
033: * The tag defines a unique tag in this tag library. It has one
034: * attribute, id.
035: * <p/>
036: * The tag element may have several subelements defining:
037: * <p/>
038: * description Optional tag-specific information
039: * <p/>
040: * display-name A short name that is intended to be
041: * displayed by tools
042: * <p/>
043: * icon Optional icon element that can be used
044: * by tools
045: * <p/>
046: * name The unique action name
047: * <p/>
048: * tag-class The tag handler class implementing
049: * javax.servlet.jsp.tagext.JspTag
050: * <p/>
051: * tei-class An optional subclass of
052: * javax.servlet.jsp.tagext.TagExtraInfo
053: * <p/>
054: * body-content The body content type
055: * <p/>
056: * variable Optional scripting variable information
057: * <p/>
058: * attribute All attributes of this action that are
059: * evaluated prior to invocation.
060: * <p/>
061: * dynamic-attributes Whether this tag supports additional
062: * attributes with dynamic names. If
063: * true, the tag-class must implement the
064: * javax.servlet.jsp.tagext.DynamicAttributes
065: * interface. Defaults to false.
066: * <p/>
067: * example Optional informal description of an
068: * example of a use of this tag
069: * <p/>
070: * tag-extension Zero or more extensions that provide extra
071: * information about this tag, for tool
072: * consumption
073: */
074: @XmlAccessorType(XmlAccessType.FIELD)
075: @XmlType(name="tagType",propOrder={"descriptions","displayNames","icon","name","tagClass","teiClass","bodyContent","variable","attribute","dynamicAttributes","example","tagExtension"})
076: public class Tag {
077: @XmlTransient
078: protected TextMap description = new TextMap();
079: @XmlTransient
080: protected TextMap displayName = new TextMap();
081: @XmlElement(name="icon",required=true)
082: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
083:
084: @XmlElement(required=true)
085: protected String name;
086: @XmlElement(name="tag-class",required=true)
087: protected String tagClass;
088: @XmlElement(name="tei-class")
089: protected String teiClass;
090: @XmlElement(name="body-content",required=true)
091: protected BodyContent bodyContent;
092: protected List<Variable> variable;
093: protected List<TldAttribute> attribute;
094: @XmlElement(name="dynamic-attributes")
095: protected String dynamicAttributes;
096: protected String example;
097: @XmlElement(name="tag-extension")
098: protected List<TldExtension> tagExtension;
099: @XmlAttribute
100: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
101: @XmlID
102: protected String id;
103:
104: @XmlElement(name="description",required=true)
105: public Text[] getDescriptions() {
106: return description.toArray();
107: }
108:
109: public void setDescriptions(Text[] text) {
110: description.set(text);
111: }
112:
113: public String getDescription() {
114: return description.get();
115: }
116:
117: @XmlElement(name="display-name",required=true)
118: public Text[] getDisplayNames() {
119: return displayName.toArray();
120: }
121:
122: public void setDisplayNames(Text[] text) {
123: displayName.set(text);
124: }
125:
126: public String getDisplayName() {
127: return displayName.get();
128: }
129:
130: public Collection<Icon> getIcons() {
131: if (icon == null) {
132: icon = new LocalCollection<Icon>();
133: }
134: return icon;
135: }
136:
137: public Map<String, Icon> getIconMap() {
138: if (icon == null) {
139: icon = new LocalCollection<Icon>();
140: }
141: return icon.toMap();
142: }
143:
144: public Icon getIcon() {
145: return icon.getLocal();
146: }
147:
148: public String getName() {
149: return name;
150: }
151:
152: public void setName(String value) {
153: this .name = value;
154: }
155:
156: public String getTagClass() {
157: return tagClass;
158: }
159:
160: public void setTagClass(String value) {
161: this .tagClass = value;
162: }
163:
164: public String getTeiClass() {
165: return teiClass;
166: }
167:
168: public void setTeiClass(String value) {
169: this .teiClass = value;
170: }
171:
172: public BodyContent getBodyContent() {
173: return bodyContent;
174: }
175:
176: public void setBodyContent(BodyContent value) {
177: this .bodyContent = value;
178: }
179:
180: public List<Variable> getVariable() {
181: if (variable == null) {
182: variable = new ArrayList<Variable>();
183: }
184: return this .variable;
185: }
186:
187: public List<TldAttribute> getAttribute() {
188: if (attribute == null) {
189: attribute = new ArrayList<TldAttribute>();
190: }
191: return this .attribute;
192: }
193:
194: public String getDynamicAttributes() {
195: return dynamicAttributes;
196: }
197:
198: public void setDynamicAttributes(String value) {
199: this .dynamicAttributes = value;
200: }
201:
202: public String getExample() {
203: return example;
204: }
205:
206: public void setExample(String value) {
207: this .example = value;
208: }
209:
210: public List<TldExtension> getTagExtension() {
211: if (tagExtension == null) {
212: tagExtension = new ArrayList<TldExtension>();
213: }
214: return this .tagExtension;
215: }
216:
217: public String getId() {
218: return id;
219: }
220:
221: public void setId(String value) {
222: this.id = value;
223: }
224: }
|