[Jarspy-commits] CVS: JarSpy/src/com/ociweb/jarspy/gui/tree JarSpyFieldTreeNode.java,NONE,1.1 JarSpy
Status: Beta
Brought to you by:
brown_j
From: Jeff B. <br...@us...> - 2003-01-25 23:14:07
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree In directory sc8-pr-cvs1:/tmp/cvs-serv8325/src/com/ociweb/jarspy/gui/tree Modified Files: JarSpyClassTreeNode.java JarSpyTreeCellRenderer.java Added Files: JarSpyFieldTreeNode.java JarSpyMethodTreeNode.java Log Message: added fields and methods to tree --- NEW FILE: JarSpyFieldTreeNode.java --- // JarSpy // Copyright (c) 2001, 2002 Jeff S. Brown // This file is part of JarSpy. // // JarSpy is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // JarSpy is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with JarSpy; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package com.ociweb.jarspy.gui.tree; import javax.swing.tree.DefaultMutableTreeNode; import com.ociweb.classinfo.CRField; public class JarSpyFieldTreeNode extends DefaultMutableTreeNode { public JarSpyFieldTreeNode(CRField field) { super(field); } public CRField getField() { return (CRField) getUserObject(); } public boolean isLeaf() { return true; } public String toString() { return getField().getFieldName(); } } --- NEW FILE: JarSpyMethodTreeNode.java --- // JarSpy // Copyright (c) 2001, 2002 Jeff S. Brown // This file is part of JarSpy. // // JarSpy is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // JarSpy is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with JarSpy; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA package com.ociweb.jarspy.gui.tree; import com.ociweb.classinfo.CRMethod; import javax.swing.tree.DefaultMutableTreeNode; public class JarSpyMethodTreeNode extends DefaultMutableTreeNode { public JarSpyMethodTreeNode(CRMethod field) { super(field); } public CRMethod getMethod() { return (CRMethod) getUserObject(); } public boolean isLeaf() { return true; } public String toString() { return getMethod().getMethodName(); } } Index: JarSpyClassTreeNode.java =================================================================== RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree/JarSpyClassTreeNode.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** JarSpyClassTreeNode.java 20 Jul 2002 18:12:23 -0000 1.1 --- JarSpyClassTreeNode.java 25 Jan 2003 23:14:04 -0000 1.2 *************** *** 20,25 **** --- 20,29 ---- import com.ociweb.jarspy.ClassInfo; + import com.ociweb.classinfo.CRField; + import com.ociweb.classinfo.CRMethod; import javax.swing.tree.DefaultMutableTreeNode; + import java.util.Set; + import java.util.Iterator; /** *************** *** 35,38 **** --- 39,56 ---- super(classInfo); simpleClassName = classInfo.getSimpleClassName(); + + Set set = classInfo.getFields(); + Iterator it = set.iterator(); + while (it.hasNext()) { + CRField crField = (CRField) it.next(); + add(new JarSpyFieldTreeNode(crField)); + } + + set = classInfo.getMethods(); + it = set.iterator(); + while (it.hasNext()) { + CRMethod crMethod = (CRMethod) it.next(); + add(new JarSpyMethodTreeNode(crMethod)); + } } Index: JarSpyTreeCellRenderer.java =================================================================== RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree/JarSpyTreeCellRenderer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** JarSpyTreeCellRenderer.java 25 Jan 2003 16:34:25 -0000 1.4 --- JarSpyTreeCellRenderer.java 25 Jan 2003 23:14:04 -0000 1.5 *************** *** 39,42 **** --- 39,44 ---- public static final String PACKAGE_OPENED_ICON_PROPERTY_KEY = "com.ociweb.jarspy.gui.tree.packageOpenedIcon"; public static final String ARCHIVE_ICON_PROPERTY_KEY = "com.ociweb.jarspy.gui.tree.archiveIcon"; + public static final String FIELD_ICON_PROPERTY_KEY = "com.ociweb.jarspy.gui.tree.fieldIcon"; + public static final String METHOD_ICON_PROPERTY_KEY = "com.ociweb.jarspy.gui.tree.methodIcon"; private ImageIcon classIcon = *************** *** 56,59 **** --- 58,69 ---- "/com/ociweb/jarspy/gui/images/Jar16.gif"))); + private ImageIcon fieldIcon = + new ImageIcon(JarSpyTreeCellRenderer.class.getResource(System.getProperty(FIELD_ICON_PROPERTY_KEY, + "/com/ociweb/jarspy/gui/images/field_default_obj.gif"))); + + private ImageIcon methodIcon = + new ImageIcon(JarSpyTreeCellRenderer.class.getResource(System.getProperty(METHOD_ICON_PROPERTY_KEY, + "/com/ociweb/jarspy/gui/images/methdef_obj.gif"))); + private TreeCellRenderer realRenderer; *************** *** 104,107 **** --- 114,121 ---- } else if (value instanceof JarSpyRootTreeNode) { label.setIcon(archiveIcon); + } else if (value instanceof JarSpyFieldTreeNode) { + label.setIcon(fieldIcon); + } else if(value instanceof JarSpyMethodTreeNode) { + label.setIcon(methodIcon); } } catch (Exception e) { |