00001 package edu.ksu.cis.bandera.abstraction.gui; 00002 00003 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 00004 * Bandera, a Java(TM) analysis and transformation toolkit * 00005 * Copyright (C) 1998, 1999, 2000 Shawn Laubach (laubach@acm.org) * 00006 * All rights reserved. * 00007 * * 00008 * This work was done as a project in the SAnToS Laboratory, * 00009 * Department of Computing and Information Sciences, Kansas State * 00010 * University, USA (http://www.cis.ksu.edu/santos). * 00011 * It is understood that any modification not identified as such is * 00012 * not covered by the preceding statement. * 00013 * * 00014 * This work is free software; you can redistribute it and/or * 00015 * modify it under the terms of the GNU Library General Public * 00016 * License as published by the Free Software Foundation; either * 00017 * version 2 of the License, or (at your option) any later version. * 00018 * * 00019 * This work is distributed in the hope that it will be useful, * 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00022 * Library General Public License for more details. * 00023 * * 00024 * You should have received a copy of the GNU Library General Public * 00025 * License along with this toolkit; if not, write to the * 00026 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * 00027 * Boston, MA 02111-1307, USA. * 00028 * * 00029 * Java is a trademark of Sun Microsystems, Inc. * 00030 * * 00031 * To submit a bug report, send a comment, or get the latest news on * 00032 * this project and other SAnToS projects, please visit the web-site * 00033 * http://www.cis.ksu.edu/santos * 00034 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 00035 import java.util.*; 00036 import javax.swing.tree.*; 00037 import javax.swing.table.*; 00038 public abstract class AbstractTreeNode implements TreeNode { 00039 Vector children; 00040 protected javax.swing.tree.TreeNode parent; 00041 public AbstractTreeNode() { 00042 children = new Vector(); 00043 } 00044 /** 00045 * Insert the method's description here. 00046 * Creation date: (5/12/00 1:04:50 PM) 00047 * @param node javax.swing.tree.TreeNode 00048 */ 00049 public void addChild(AbstractTreeNode node) { 00050 children.add(node); 00051 node.setParent(this); 00052 } 00053 /** 00054 * Insert the method's description here. 00055 * Creation date: (5/12/00 1:04:50 PM) 00056 * @param node javax.swing.tree.TreeNode 00057 */ 00058 public void addChild(TreeNode node) { 00059 children.add(node); 00060 } 00061 /** 00062 * Insert the method's description here. 00063 * Creation date: (5/12/00 12:52:47 PM) 00064 * @return java.util.Enumeration 00065 */ 00066 public Enumeration children() { 00067 return children.elements(); 00068 } 00069 /** 00070 * Insert the method's description here. 00071 * Creation date: (5/12/00 12:55:31 PM) 00072 * @return boolean 00073 */ 00074 public abstract boolean getAllowsChildren(); 00075 /** 00076 * Insert the method's description here. 00077 * Creation date: (5/12/00 1:18:30 PM) 00078 * @return javax.swing.table.TableCellEditor 00079 * @param column int 00080 */ 00081 public abstract TableCellEditor getCellEditor(int column); 00082 /** 00083 * Insert the method's description here. 00084 * Creation date: (5/12/00 1:18:30 PM) 00085 * @return javax.swing.table.TableCellEditor 00086 * @param column int 00087 */ 00088 public abstract TableCellRenderer getCellRenderer(int column); 00089 /** 00090 * Insert the method's description here. 00091 * Creation date: (5/12/00 12:54:18 PM) 00092 * @return javax.swing.tree.TreeNode 00093 * @param i int 00094 */ 00095 public TreeNode getChildAt(int i) { 00096 return (TreeNode) children.get(i); 00097 } 00098 /** 00099 * Insert the method's description here. 00100 * Creation date: (5/12/00 12:51:38 PM) 00101 * @return int 00102 */ 00103 public int getChildCount() { 00104 return children.size(); 00105 } 00106 /** 00107 * Insert the method's description here. 00108 * Creation date: (5/12/00 12:53:49 PM) 00109 * @return int 00110 * @param node javax.swing.tree.TreeNode 00111 */ 00112 public int getIndex(TreeNode node) { 00113 return children.indexOf(node); 00114 } 00115 /** 00116 * Insert the method's description here. 00117 * Creation date: (5/12/00 1:34:59 PM) 00118 * @return javax.swing.tree.TreeNode 00119 */ 00120 public javax.swing.tree.TreeNode getParent() { 00121 return parent; 00122 } 00123 /** 00124 * Insert the method's description here. 00125 * Creation date: (5/12/00 12:52:12 PM) 00126 * @return boolean 00127 */ 00128 public boolean isLeaf() { 00129 return (getChildCount() == 0); 00130 } 00131 /** 00132 * Insert the method's description here. 00133 * Creation date: (5/12/00 1:34:59 PM) 00134 * @param newParent javax.swing.tree.TreeNode 00135 */ 00136 public void setParent(javax.swing.tree.TreeNode newParent) { 00137 parent = newParent; 00138 } 00139 }