KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > diagnostics > report > html > Element


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23 package com.sun.enterprise.diagnostics.report.html;
24
25 import java.util.List JavaDoc;
26
27 /**
28  * A single element in an HTML document. Elements may contain
29  * other elements and text, in a strict order. They may also
30  * have attributes assigned to them.
31  */

32 public interface Element extends Container {
33
34     /**
35      * Add a element to this element.
36      * @param name The name of the new element.
37      */

38     public Element addElement(String JavaDoc name);
39     
40     /**
41      * Add a attribute to this element.
42      * @param id The name of the attribute.
43      * @param value The value of the attribute.
44      */

45     public Attribute addAttribute(String JavaDoc id, String JavaDoc value);
46     
47     /**
48      * Factory method to create a new comment and add it to this
49      * element. The content of the comment is escaped as appropriate.
50      * @param content The content of this comment.
51      * @return The new comment.
52      * @see Text
53      */

54     public Text addComment(String JavaDoc content);
55     
56     /**
57      * Factory method to create a new text instance and add it to this
58      * element. The content of the text is escaped as appropriate.
59      * @param text The text to add.
60      * @return The new text instance.
61      */

62     public Text addText(String JavaDoc text);
63     
64     /**
65      * Get all child elements of this element.
66      * @return The list of child elements.
67      */

68     public List JavaDoc<Element> getElements();
69     
70     /**
71      * Get all child elements of this element which have the specified
72      * name.
73      * @param name The element name.
74      * @return The list of child elements.
75      */

76     public List JavaDoc<Element> getElements(String JavaDoc name);
77     
78     /**
79      * Get all comments in this element.
80      * @return The list of all comments.
81      */

82     public List JavaDoc<Text> getComments();
83     
84     /**
85      * Get all text contained in this element.
86      * @return The list of text nodes contained in this element.
87      */

88     public List JavaDoc<Text> getTexts();
89     
90     /**
91      * Get all attributes of this element.
92      * @return The list of all attributes.
93      */

94     public List JavaDoc<Attribute> getAttributes();
95     
96     /**
97      * Get all attributes of this element whose name matches the given
98      * name.
99      * @param name The attribute name.
100      * @return The list of all matching attributes.
101      */

102     public List JavaDoc<Attribute> getAttributes(String JavaDoc name);
103     
104     /**
105      * Get the name of this element.
106      * @return The name of this element.
107      */

108     public String JavaDoc getName();
109     
110     /**
111      * Set the name of this element. The previous name is discarded.
112      * Note that element names are not case-sensitive; on output they
113      * are all converted to upper-case.
114      * @param name The new name of this element.
115      */

116     public void setName(String JavaDoc name);
117 }
118
Popular Tags