Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

FieldTreeNode.java

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  * Modifications by Robby (robby@cis.ksu.edu) are                    *
00009  * Copyright (C) 2000 Robby.  All rights reserved.                   *
00010  *                                                                   *
00011  * This work was done as a project in the SAnToS Laboratory,         *
00012  * Department of Computing and Information Sciences, Kansas State    *
00013  * University, USA (http://www.cis.ksu.edu/santos).                  *
00014  * It is understood that any modification not identified as such is  *
00015  * not covered by the preceding statement.                           *
00016  *                                                                   *
00017  * This work is free software; you can redistribute it and/or        *
00018  * modify it under the terms of the GNU Library General Public       *
00019  * License as published by the Free Software Foundation; either      *
00020  * version 2 of the License, or (at your option) any later version.  *
00021  *                                                                   *
00022  * This work is distributed in the hope that it will be useful,      *
00023  * but WITHOUT ANY WARRANTY; without even the implied warranty of    *
00024  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU *
00025  * Library General Public License for more details.                  *
00026  *                                                                   *
00027  * You should have received a copy of the GNU Library General Public *
00028  * License along with this toolkit; if not, write to the             *
00029  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,      *
00030  * Boston, MA  02111-1307, USA.                                      *
00031  *                                                                   *
00032  * Java is a trademark of Sun Microsystems, Inc.                     *
00033  *                                                                   *
00034  * To submit a bug report, send a comment, or get the latest news on *
00035  * this project and other SAnToS projects, please visit the web-site *
00036  *                http://www.cis.ksu.edu/santos                      *
00037  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
00038 import java.util.*;
00039 import java.util.Vector;
00040 import javax.swing.table.*;
00041 import javax.swing.JComboBox;
00042 import ca.mcgill.sable.soot.*;
00043 import javax.swing.tree.TreeNode;
00044 import javax.swing.DefaultCellEditor;
00045 import edu.ksu.cis.bandera.abstraction.*;
00046 public class FieldTreeNode extends TypeTreeNode implements VarTreeNode {
00047     static Vector fields;
00048     protected SootField field;
00049     protected Abstraction abstraction;
00050     protected javax.swing.JComboBox comboBox;
00051 /**
00052  * FieldTreeNode constructor comment.
00053  */
00054 public FieldTreeNode(SootField field) {
00055     super(field.getName());
00056     this.field = field;
00057     fields.add(this);
00058     if (JTreeTable.absTable.get(field.getType()) != null) {
00059         comboBox = new JComboBox((Vector) JTreeTable.absTable.get(field.getType()));
00060         comboBox.setSelectedItem(ConcreteIntegralAbstraction.v());
00061     } else
00062         if (field.getType() instanceof RefType) {
00063             comboBox = new JComboBox();
00064             comboBox.addItem("No Selection");
00065             comboBox.addItem(ClassAbstraction.v(((RefType) field.getType()).className));
00066         } else {
00067             comboBox = new JComboBox();
00068             comboBox.addItem("No Selection");
00069         }
00070         /*else
00071             if (field.getType().getClass() == AbstractRefType.class) {
00072                 comboBox = new JComboBox();
00073                 comboBox.addItem(ObjectAbstraction.v((AbstractRefType) field.getType()).getType());
00074             } else
00075                 if (field.getType().getClass() == IntType.class) {
00076                     comboBox = new JComboBox();
00077                     comboBox.addItem("4");
00078                     comboBox.addItem(new Integer(3));
00079                     comboBox.addItem("");
00080                     comboBox.addItem("None");
00081                 }*/
00082 }
00083         public Abstraction getAbstraction() {
00084                 return abstraction;
00085         }
00086 /**
00087  * Insert the method's description here.
00088  * Creation date: (5/12/00 12:56:45 PM)
00089  * @return boolean
00090  */
00091 public boolean getAllowsChildren() {
00092     return false;
00093 }
00094 /**
00095  * Insert the method's description here.
00096  * Creation date: (3/24/00 12:20:36 AM)
00097  * @return javax.swing.table.TableCellRenderer
00098  * @param row int
00099  * @param column int
00100  */
00101 public TableCellEditor getCellEditor(int column) {
00102     if (column == 2)
00103         return new DefaultCellEditor(comboBox);
00104     else
00105         return null;
00106 }
00107 /**
00108  * Insert the method's description here.
00109  * Creation date: (3/24/00 12:20:36 AM)
00110  * @return javax.swing.table.TableCellRenderer
00111  * @param row int
00112  * @param column int
00113  */
00114 public TableCellRenderer getCellRenderer(int column) {
00115     return null;
00116 }
00117 /**
00118  * 
00119  * @return javax.swing.JComboBox
00120  */
00121 public javax.swing.JComboBox getComboBox() {
00122     return comboBox;
00123 }
00124 /**
00125  * Insert the method's description here.
00126  * Creation date: (5/12/00 11:01:52 AM)
00127  * @return ca.mcgill.sable.soot.SootField
00128  */
00129 public SootField getField() {
00130     return field;
00131 }
00132 /**
00133  * Insert the method's description here.
00134  * Creation date: (5/12/00 11:18:27 AM)
00135  * @return edu.ksu.cis.bandera.abps.options.FieldOptions
00136  */
00137 public void getOption(Hashtable result) {
00138     if (abstraction != null) {
00139         ((HashSet) result.get(field.getDeclaringClass())).add(field);
00140         result.put(field, abstraction);
00141     }
00142 }
00143         /**
00144          * Insert the method's description here.
00145          * Creation date: (3/23/00 11:50:00 PM)
00146          * @return ca.mcgill.sable.soot.Type
00147          */
00148         public Type getType() {
00149                 return field.getType();
00150         }
00151 /**
00152  * Insert the method's description here.
00153  * Creation date: (5/19/00 2:31:39 PM)
00154  * @return java.lang.Object
00155  */
00156 public Object getVar() {
00157     return field;
00158 }
00159 public void setAbstraction(Abstraction type) {
00160     abstraction = type;
00161 }
00162         /**
00163          * size method comment.
00164          */
00165         public int size() {
00166                 return 0;
00167         }
00168         /**
00169          * Insert the method's description here.
00170          * Creation date: (3/23/00 11:30:08 PM)
00171          * @return java.lang.String
00172          */
00173         public String toString() {
00174                 return getName().toString();
00175         }
00176 }

Generated at Thu Feb 7 06:45:43 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001