KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > lenya > cms > publication > SiteTreeNode


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 /* $Id: SiteTreeNode.java 160543 2005-04-08 11:30:01Z andreas $ */
19
20 package org.apache.lenya.cms.publication;
21
22 import java.util.List JavaDoc;
23
24 /**
25  * This interface is a wrapper around the more general w3c.Node which
26  * hides some details which are irrelevant for site tree nodes. It basically
27  * delegates everything to the Node.
28  */

29 public interface SiteTreeNode {
30
31     /**
32      * Get the parent-id of this node.
33      *
34      * @return the parent-id.
35      */

36     String JavaDoc getParentId();
37     
38     /**
39      * Returns the parent node of this node.
40      * @return A sitetree node.
41      */

42     SiteTreeNode getParent();
43
44     /**
45      * Returns the parent node of this node or null if the parent has no label for the given language.
46      * @param language A language string.
47      * @return A sitetree node.
48      */

49     SiteTreeNode getParent(String JavaDoc language);
50
51     /**
52      * Get the absolute id of this node.
53      *
54      * @return the absolute id.
55      */

56     String JavaDoc getAbsoluteId();
57
58     /**
59      * Get the absolute parent-id of this node.
60      *
61      * @return the absolute parent-id.
62      */

63     String JavaDoc getAbsoluteParentId();
64
65     /**
66      * Get the id of this node.
67      *
68      * @return the node id.
69      */

70     String JavaDoc getId();
71
72     /**
73      * Get all labels for this node (independent of their language attribute).
74      *
75      * @return an <code>Array</code> of labels.
76      */

77     Label[] getLabels();
78
79     /**
80      * Get the label for a specific language.
81      *
82      * @param xmlLanguage the language for which the label is requested.
83      *
84      * @return a <code>Label</code> if there is one for the given language,
85      * null otherwise.
86      */

87     Label getLabel(String JavaDoc xmlLanguage);
88
89     /**
90      * Add a label to this node iff the node does not have this label already.
91      *
92      * @param label the label to be added.
93      */

94     void addLabel(Label label);
95
96     /**
97      * Remove a label from this node.
98      *
99      * @param label the label to be removed.
100      */

101     void removeLabel(Label label);
102
103     /**
104      * Check whether this node is visible in the navigation
105      *
106      * @return true if this node is visible. The method should also
107      * return true if the attribute is not set. That means a node missing
108      * this attribute becomes visible by default.
109      */

110     boolean visibleInNav();
111
112     /**
113      * Get the href of this node.
114      *
115      * @return the href.
116      */

117     String JavaDoc getHref();
118
119     /**
120      * Get the suffix of this node.
121      *
122      * @return the suffix.
123      */

124     String JavaDoc getSuffix();
125
126     /**
127      * Check whether this node has a link.
128      *
129      * @return true if this node has a link.
130      */

131     boolean hasLink();
132
133     /**
134      * Get the sitetreenodes, which are children of this node
135      *
136      * @return the children.
137      */

138     SiteTreeNode[] getChildren();
139
140     /**
141      * Get the sitetreenodes, which are children of this node
142      * and contain a label for the given language.
143      *
144      * @param language A language string.
145      * @return the children.
146      */

147     SiteTreeNode[] getChildren(String JavaDoc language);
148
149     /**
150      * Remove the children of the node
151      *
152      * @return the removed node
153      * @deprecated Use deleteChildren() instead
154      */

155     SiteTreeNode[] removeChildren();
156     
157     /**
158      * Remove the children of this node.
159      */

160     void deleteChildren() throws SiteTreeException;
161
162     /**
163      * Get the sitetreenodes, which are the siblings following this node
164      *
165      * @return the children.
166      */

167     SiteTreeNode[] getNextSiblings();
168
169     /**
170      * @return string. The document-id corresponding to the next sibling node.
171      */

172     String JavaDoc getNextSiblingDocumentId();
173
174     /**
175      * Call the visit method of the visitor, that mean
176      * the operation that shall be perfoemed on this node
177      * (Visitor pattern)
178      * @param visitor The visitor.
179      *
180      * @throws DocumentException if an error occurs
181      */

182     void accept(SiteTreeNodeVisitor visitor) throws DocumentException;
183
184     /**
185      * Traverse the node ant its children and call the
186      * accept method.
187      * @param visitor The visitor.
188      *
189      * @throws DocumentException if an error occurs
190      */

191     void acceptSubtree(SiteTreeNodeVisitor visitor) throws DocumentException;
192
193     /**
194      * Traverse in a reverse way the node ant its children and call the
195      * accept method.
196      * @param visitor The visitor.
197      *
198      * @throws DocumentException if an error occurs
199      */

200     void acceptReverseSubtree(SiteTreeNodeVisitor visitor) throws DocumentException;
201  
202     /**
203      * Sets a label of an this node. If the label does not exist, it is added.
204      * Otherwise, the existing label is replaced.
205      *
206      * @param label the label to add
207      */

208     void setLabel(Label label);
209  
210     /**
211      * Sets an attribute of this node. If the attribute already exists its value will be overwritten
212      *
213      * @param attributeName name of the attribute
214      * @param attributeValue the value of the respective attribute
215      */

216     void setNodeAttribute (String JavaDoc attributeName, String JavaDoc attributeValue);
217
218     /**
219      * Give a list of the children and this node in a pre order way
220      * @return The list
221      */

222     List JavaDoc preOrder();
223     
224     /**
225      * Give a list of the children and this node in a post order way
226      * @return The list
227      */

228     List JavaDoc postOrder();
229     
230 }
231
Popular Tags