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: * Defines an action in this tag library that is implemented
034: * as a .tag file.
035: * <p/>
036: * The tag-file element has two required subelements:
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: * path Where to find the .tag file implementing this
049: * action, relative to the root of the web
050: * application or the root of the JAR file for a
051: * tag library packaged in a JAR. This must
052: * begin with /WEB-INF/tags if the .tag file
053: * resides in the WAR, or /META-INF/tags if the
054: * .tag file resides in a JAR.
055: * <p/>
056: * example Optional informal description of an
057: * example of a use of this tag
058: * <p/>
059: * tag-extension Zero or more extensions that provide extra
060: * information about this tag, for tool
061: * consumption
062: */
063: @XmlAccessorType(XmlAccessType.FIELD)
064: @XmlType(name="tagFileType",propOrder={"descriptions","displayNames","icon","name","path","example","tagExtension"})
065: public class TagFile {
066: @XmlTransient
067: protected TextMap description = new TextMap();
068: @XmlTransient
069: protected TextMap displayName = new TextMap();
070: @XmlElement(name="icon",required=true)
071: protected LocalCollection<Icon> icon = new LocalCollection<Icon>();
072:
073: @XmlElement(required=true)
074: protected String name;
075: @XmlElement(required=true)
076: protected String path;
077: protected String example;
078: @XmlElement(name="tag-extension")
079: protected List<TldExtension> tagExtension;
080: @XmlAttribute
081: @XmlJavaTypeAdapter(CollapsedStringAdapter.class)
082: @XmlID
083: protected String id;
084:
085: @XmlElement(name="description",required=true)
086: public Text[] getDescriptions() {
087: return description.toArray();
088: }
089:
090: public void setDescriptions(Text[] text) {
091: description.set(text);
092: }
093:
094: public String getDescription() {
095: return description.get();
096: }
097:
098: @XmlElement(name="display-name",required=true)
099: public Text[] getDisplayNames() {
100: return displayName.toArray();
101: }
102:
103: public void setDisplayNames(Text[] text) {
104: displayName.set(text);
105: }
106:
107: public String getDisplayName() {
108: return displayName.get();
109: }
110:
111: public Collection<Icon> getIcons() {
112: if (icon == null) {
113: icon = new LocalCollection<Icon>();
114: }
115: return icon;
116: }
117:
118: public Map<String, Icon> getIconMap() {
119: if (icon == null) {
120: icon = new LocalCollection<Icon>();
121: }
122: return icon.toMap();
123: }
124:
125: public Icon getIcon() {
126: return icon.getLocal();
127: }
128:
129: public String getName() {
130: return name;
131: }
132:
133: public void setName(String value) {
134: this .name = value;
135: }
136:
137: public String getPath() {
138: return path;
139: }
140:
141: public void setPath(String value) {
142: this .path = value;
143: }
144:
145: public String getExample() {
146: return example;
147: }
148:
149: public void setExample(String value) {
150: this .example = value;
151: }
152:
153: public List<TldExtension> getTagExtension() {
154: if (tagExtension == null) {
155: tagExtension = new ArrayList<TldExtension>();
156: }
157: return this .tagExtension;
158: }
159:
160: public String getId() {
161: return id;
162: }
163:
164: public void setId(String value) {
165: this.id = value;
166: }
167: }
|