|
|||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ITreeDataModel.java | - | - | - | - |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.contrib.tree.model; | |
16 | ||
17 | import java.util.Iterator; | |
18 | ||
19 | /** | |
20 | * The interface that defines a suitable data model for a <code>TreeView component</code>. | |
21 | * | |
22 | * @author ceco | |
23 | */ | |
24 | public interface ITreeDataModel | |
25 | { | |
26 | /** | |
27 | * Returns the root node of the tree | |
28 | */ | |
29 | Object getRoot(); | |
30 | ||
31 | /** | |
32 | * Returns the number of children of parent node. | |
33 | * @param objParent is the parent object whose nr of children are sought | |
34 | */ | |
35 | int getChildCount(Object objParent); | |
36 | ||
37 | /** | |
38 | * Get an iterator to the Collection of children belonging to the parent node object | |
39 | * @param objParent is the parent object whose children are requested | |
40 | */ | |
41 | Iterator getChildren(Object objParent); | |
42 | ||
43 | /** | |
44 | * Get the actual node object based on some identifier (for example an UUID) | |
45 | * @param objUniqueKey is the unique identifier of the node object being retrieved | |
46 | * @return the instance of the node object identified by the key | |
47 | */ | |
48 | Object getObject(Object objUniqueKey); | |
49 | ||
50 | /** | |
51 | * Get the unique identifier (UUID) of the node object with a certain parent node | |
52 | * @param objTarget is the Object whose identifier is required | |
53 | * @param objParentUniqueKey is the unique id of the parent of objTarget | |
54 | * @return the unique identifier of objTarget | |
55 | */ | |
56 | Object getUniqueKey(Object objTarget, Object objParentUniqueKey); | |
57 | ||
58 | /** | |
59 | * Get the unique identifier of the parent of an object | |
60 | * @param objChildUniqueKey is the identifier of the Object for which the parent identifier is sought | |
61 | * @return the identifier (possibly UUID) of the parent of objChildUniqueKey | |
62 | */ | |
63 | Object getParentUniqueKey(Object objChildUniqueKey); | |
64 | ||
65 | /** | |
66 | * Check to see (on the basis of some node object identifier) whether the parent node is indeed the parent of the object | |
67 | * @param objChildUniqueKey is the identifier of the object whose parent is being checked | |
68 | * @param objParentUniqueKey is the identifier of the parent which is to be checked against | |
69 | */ | |
70 | boolean isAncestorOf(Object objChildUniqueKey, Object objParentUniqueKey); | |
71 | ||
72 | } |
|