KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > xml > lazydom > LazyNode


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  *
21  * $Id: LazyNode.java,v 1.3 2005/01/26 08:29:24 jkjome Exp $
22  */

23
24 package org.enhydra.xml.lazydom;
25
26 import org.w3c.dom.Document JavaDoc;
27 import org.w3c.dom.Node JavaDoc;
28
29 // FIXME: A lot of the assumptions of LazyNode vs LazyParent described
30
// below might be better encoded as method calls.
31

32 /**
33  * Interface use to define Lazy DOM methods that apply to every node.
34  * In addition to these methods, each node must:
35  * <UL>
36  * <LI> Supply a getTemplateXXX for the specific node type.
37  * <UL>
38  * <P>
39  * There are two basic interfaces for implementing LazyDOM nodes:
40  * LazyNode and LazyParent, with LazyParent extended LazyNode.
41  * They have the following properties:
42  * <UL>
43  * <LI> Only LazyParent nodes can contain other nodes.
44  * <LI> Only LazyParent nodes can exist with out their parent being
45  * expanded.
46  * <LI> All children of a LazyParent are expanded if one of the children
47  * is expanded.
48  * <LI> If a LazyNode that is not a LazyParent is expanded, its siblings
49  * are expanded.
50  * <LI> If a LazyParent's parent is expanded, its siblings are expanded.
51  * <LI> If a LazyParent's parent is not expanded, its siblings may or may not
52  * be expanded.
53  * </UL>
54  */

55 public interface LazyNode extends Node JavaDoc {
56     /**
57      * Constant to indicate an node does not have an id.
58      */

59     public static final int NULL_NODE_ID = -1;
60
61     /**
62      * Node id returned for the Document node.
63      */

64     public static final int DOCUMENT_NODE_ID = 0;
65
66     /*
67      * Mark this node into a template node. This assigns the node id, and
68      * flags the node as template.
69      * @param nodeId The node id to associate with the node.
70      */

71     public void makeTemplateNode(int nodeId);
72
73     /**
74      * Get the node numeric id number.
75      *
76      * @return The node id number, unique to this document, or NULL_NODE_ID
77      * if the node does not have an id assocaited with it.
78      */

79     public int getNodeId();
80
81     /**
82      * Check if this node is a template node.
83      */

84     public boolean isTemplateNode();
85
86     /**
87      * Get the template node as a LazyNode.
88      */

89     public LazyNode getTemplateNode();
90
91     /**
92      * Create a new node, using this node as the template.
93      */

94     public LazyNode templateClone(Document JavaDoc ownerDocument);
95 }
96
Popular Tags