1 package com.sri.emo.dbobj.model_tree;
2
3 import com.jcorporate.expresso.core.controller.Transition;
4
5 import java.io.Serializable;
6 import java.util.ArrayList;
7 import java.util.Collections;
8 import java.util.List;
9
10 /***
11 * Represents a particular node on the model tree. Also implements the
12 * <tt>Composite Pattern</tt> since it contains multiple types all nested
13 * in a tree structure.
14 *
15 * @author Michael Rimov
16 */
17 public interface ModelNode {
18
19 /***
20 * <tt>Special Case</tt> for when there are no children for a particular
21 * node in the model.
22 */
23 static final List NO_CHILDREN = Collections.unmodifiableList(new ArrayList(0));
24
25 /***
26 * <tt>Special Case</tt> for when there is no parent node for a particular
27 * model. Since there is only one instance, the equality reference
28 * operator (==) can be used instead of equals() to check for parent.
29 */
30 static final ModelNode NO_PARENT = new NoParentNode();
31
32 /***
33 * <tt>Special Case</tt> for when there is no link to view or edit the
34 * node.
35 */
36 static final Transition NO_LINK = new Transition();
37
38 /***
39 * Retrieve the items in the composite model.
40 *
41 * @return a list of ModelComposite objects or NO_CHILDREN if this is
42 * a leaf node.
43 */
44 List getChildren();
45
46 /***
47 * Retrieves the parent or returns NO_PARENT if we are already at the
48 * top of the node.
49 *
50 * @return ModelCompositeNode or NO_PARENT.
51 */
52 ModelNode getParent();
53
54 /***
55 * Retrieve the viewable interface of what we are dealing with.
56 *
57 * @return ModelVisitable
58 */
59 ModelVisitable getVisitable();
60
61 /***
62 * Retrieve the label assigned to the node.
63 *
64 * @return String label.
65 */
66 String getLabel();
67
68 /***
69 * Retrieve the link to get to the node for editing. (Similar to IViewable)
70 *
71 * @return Transition.
72 */
73 Transition getLink();
74
75 /***
76 * Contains status about the node itself -- are all parts and subparts
77 * completely filled?
78 *
79 * @return ModelFillStatus -- enumeration type
80 */
81 ModelFillStatus getModelFillStatus();
82
83
84 /***
85 * Returns a node completion status which represents whether the
86 * factory was able to build a non-recursive complete model for the given
87 * node in question or
88 *
89 * @return NodeCompletionStatus
90 */
91 NodeCompletionStatus getNodeCompletionStatus();
92
93 /***
94 * This is a method to allow 'tagging' particular nodes with application
95 * specific information and processing the node differently based on that
96 * information. The default hierarchy has no specifics of what kind
97 * of information may be stored there other than it be serializable
98 * for maximum flexibility in the future.
99 *
100 * @return Serializable
101 */
102 Serializable getAdditionalInfo();
103
104 /***
105 * Sets the additional tag information to be associated with this node.
106 *
107 * @param newInfo the new application-specific information.
108 */
109 void setAdditionalInfo(Serializable newInfo);
110
111
112 }