Initial Commit
[packages] / xemacs-packages / jde / java / src / jde / debugger / command / ReferenceModel.java
1 package jde.debugger.gui;
2
3 import javax.swing.tree.MutableTreeNode;
4 import javax.swing.tree.TreeNode;
5
6 import jde.debugger.JDEException;
7
8
9
10 /** Base class for displaying different types of references */
11 abstract class ReferenceModel
12 {
13
14   /**  Default ReferenceModel constructor */
15   ReferenceModel( ) {
16
17   } // ReferenceModel constructor
18
19   /** Get the number of children.
20    * @return The number of fields that we should be displaying.
21    */
22   abstract int getChildCount();
23
24   /** Returns if the node allows children */
25   abstract boolean getAllowsChildren();
26
27 //    * @throws ClassNotLoadedException If the class hasn't been loaded.
28 //    * This shouldn't be possible, but the compiler doesn't know that.
29 //    */
30   /** Create a child at the given index.
31    * @param childIndex index of child to create
32    * @return A tree node for the child at the given index
33    * @throws JDEException If an error occurs.
34    */
35   abstract MutableTreeNode createChildAt(int index) throws JDEException;
36
37
38   /** Get a string to represent the value of the variable */
39   abstract String getValue();
40
41
42   /** Update the values in the children
43    * @param children The array of old child values
44    */
45   abstract void updateChildren(TreeNode[] children);
46
47   /** Convert the TreeNode to an LVTreeNode.
48    * @param node The TreeNode to convert
49    * @return node cast to an LVTreeNode, or null if node is not an
50    * LVTreeNode
51    */
52   protected static LVTreeNode asLVTreeNode(TreeNode node) {
53     if (node instanceof LVTreeNode)
54       return (LVTreeNode) node;
55     else
56       return null;
57   }
58 } // End of class ReferenceModel