KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > xam > dom > DocumentComponent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.xml.xam.dom;
21
22 import org.netbeans.modules.xml.xam.*;
23 import org.w3c.dom.Element JavaDoc;
24 import org.w3c.dom.Node JavaDoc;
25
26 /**
27  * A component in model.
28  *
29  */

30 public interface DocumentComponent<C extends DocumentComponent> extends Component<C> {
31     public static final String JavaDoc TEXT_CONTENT_PROPERTY = "textContent";
32
33     /**
34      * Returns the DOM element corresponding to this component.
35      */

36     Element JavaDoc getPeer();
37
38     /**
39      * @return string value of the given attribute.
40      */

41     String JavaDoc getAttribute(Attribute attribute);
42     
43     /**
44      * Sets the attribute value.
45      * @param eventPropertyName name property change event to fire.
46      * @param attribute the attribute to set value for.
47      * @param value for the attribute.
48      */

49     void setAttribute(String JavaDoc eventPropertyName, Attribute attribute, Object JavaDoc value);
50     
51     /**
52      * Returns true if the component is part of the document model.
53      */

54     boolean isInDocumentModel();
55     
56     /**
57      * Returns the position of this component in the schema document,
58      * expressed as an offset from the start of the document.
59      * @return the position of this component in the document
60      */

61     int findPosition();
62
63     /**
64      * Returns true if the node referenced by this component is n.
65      */

66     boolean referencesSameNode(Node JavaDoc n);
67
68     /**
69      * Returns child component backed by given element node.
70      */

71     public C findChildComponent(Element JavaDoc e);
72
73     /**
74      * Returns position of the attribute by the given name, or -1 if not found.
75      */

76     public int findAttributePosition(String JavaDoc attributeName);
77 }
78
Popular Tags