jarspy-commits Mailing List for JarSpy- Java Archive Spying Utility (Page 12)
Status: Beta
Brought to you by:
brown_j
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(39) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(39) |
Feb
(12) |
Mar
|
Apr
(10) |
May
|
Jun
(24) |
Jul
(38) |
Aug
(9) |
Sep
(58) |
Oct
(34) |
Nov
|
Dec
(13) |
| 2003 |
Jan
(64) |
Feb
(3) |
Mar
(17) |
Apr
(20) |
May
(8) |
Jun
(3) |
Jul
|
Aug
(6) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
|
| 2005 |
Jan
(41) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jeff B. <br...@us...> - 2002-09-01 00:30:31
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails
In directory usw-pr-cvs1:/tmp/cvs-serv10972
Modified Files:
ClassDetailTabbedPane.java
Log Message:
reorder tabs
Index: ClassDetailTabbedPane.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/ClassDetailTabbedPane.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ClassDetailTabbedPane.java 21 Jul 2002 02:03:47 -0000 1.1
--- ClassDetailTabbedPane.java 1 Sep 2002 00:30:28 -0000 1.2
***************
*** 35,40 ****
new FieldsTab(),
new MethodsTab(),
! new ConstantPoolTab(),
! new DependencyTab()
};
--- 35,40 ----
new FieldsTab(),
new MethodsTab(),
! new DependencyTab(),
! new ConstantPoolTab()
};
|
|
From: Jeff B. <br...@us...> - 2002-08-27 03:02:41
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails
In directory usw-pr-cvs1:/tmp/cvs-serv20696
Modified Files:
DependencyTab.java
Log Message:
Index: DependencyTab.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/DependencyTab.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DependencyTab.java 25 Aug 2002 14:19:48 -0000 1.3
--- DependencyTab.java 27 Aug 2002 03:02:38 -0000 1.4
***************
*** 20,24 ****
import com.ociweb.jarspy.ClassInfo;
! import javax.swing.JLabel;
/**
--- 20,29 ----
import com.ociweb.jarspy.ClassInfo;
!
! import javax.swing.DefaultListModel;
! import javax.swing.JList;
! import java.awt.BorderLayout;
! import java.util.Vector;
! import java.util.Iterator;
/**
***************
*** 29,38 ****
public class DependencyTab extends AbstractClassDetailTab {
public DependencyTab() {
super("Dependencies");
! add(new JLabel("Not Implemented Yet."));
}
public void setClassInfo(ClassInfo classInfo) {
}
}
--- 34,54 ----
public class DependencyTab extends AbstractClassDetailTab {
+ private JList dependencyList = new JList();
+
public DependencyTab() {
super("Dependencies");
! setLayout(new BorderLayout());
! add(dependencyList);
}
public void setClassInfo(ClassInfo classInfo) {
+ DefaultListModel model = new DefaultListModel();
+ Vector deps = classInfo.getDependencies();
+ Iterator iter = deps.iterator();
+ while (iter.hasNext()) {
+ model.addElement(iter.next());
+ }
+
+ dependencyList.setModel(model);
}
}
|
|
From: Jeff B. <br...@us...> - 2002-08-27 02:55:04
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv18545
Modified Files:
DecompileGUI.java
Log Message:
adjust some layout parameters
Index: DecompileGUI.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/DecompileGUI.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DecompileGUI.java 23 Aug 2002 03:01:10 -0000 1.4
--- DecompileGUI.java 27 Aug 2002 02:55:01 -0000 1.5
***************
*** 46,53 ****
--- 46,57 ----
gbc.gridy = gbc.RELATIVE;
gbc.gridwidth = gbc.REMAINDER;
+ gbc.weightx = gbc.weighty = 1.0;
+ gbc.fill = gbc.BOTH;
gbc.anchor = gbc.CENTER;
cont.add(new DecompilePanel(className, pathToJarFile, jarInspector), gbc);
JButton btnOK = new JButton("OK");
+ gbc.fill = gbc.NONE;
+ gbc.weightx = gbc.weighty = 0.0;
cont.add(btnOK, gbc);
btnOK.addActionListener(new ActionListener() {
|
|
From: Jeff B. <br...@us...> - 2002-08-27 02:54:51
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv18495a
Modified Files:
StatusScreen.java
Log Message:
increase width to 525
Index: StatusScreen.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/StatusScreen.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** StatusScreen.java 20 Jul 2002 00:09:00 -0000 1.2
--- StatusScreen.java 27 Aug 2002 02:54:46 -0000 1.3
***************
*** 84,88 ****
pack();
Dimension windowSize = getSize();
! windowSize.width = 375;
setSize(windowSize);
--- 84,88 ----
pack();
Dimension windowSize = getSize();
! windowSize.width = 525;
setSize(windowSize);
|
|
From: Jeff B. <br...@us...> - 2002-08-27 02:45:17
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions
In directory usw-pr-cvs1:/tmp/cvs-serv16298
Modified Files:
DecompileAction.java
Log Message:
intialize className when new class is selected
Index: DecompileAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/DecompileAction.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DecompileAction.java 20 Jul 2002 18:12:23 -0000 1.4
--- DecompileAction.java 27 Aug 2002 02:45:14 -0000 1.5
***************
*** 80,83 ****
--- 80,86 ----
public void classSelected(ClassInfo classInfo) {
setEnabled(classInfo != null);
+ if(classInfo != null) {
+ className = classInfo.getClassName();
+ }
}
|
|
From: Jeff B. <br...@us...> - 2002-08-25 14:19:51
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails In directory usw-pr-cvs1:/tmp/cvs-serv28762/src/com/ociweb/jarspy/gui/classdetails Modified Files: AbstractClassDetailTab.java DependencyTab.java Log Message: Index: AbstractClassDetailTab.java =================================================================== RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/AbstractClassDetailTab.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AbstractClassDetailTab.java 21 Jul 2002 02:03:47 -0000 1.1 --- AbstractClassDetailTab.java 25 Aug 2002 14:19:48 -0000 1.2 *************** *** 20,24 **** import com.ociweb.jarspy.ClassInfo; - import javax.swing.BorderFactory; import javax.swing.JPanel; --- 20,23 ---- Index: DependencyTab.java =================================================================== RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/DependencyTab.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DependencyTab.java 23 Aug 2002 02:44:37 -0000 1.2 --- DependencyTab.java 25 Aug 2002 14:19:48 -0000 1.3 *************** *** 20,24 **** import com.ociweb.jarspy.ClassInfo; - import javax.swing.JLabel; --- 20,23 ---- |
|
From: Jeff B. <br...@us...> - 2002-08-23 03:01:14
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv2099
Modified Files:
DecompileGUI.java
Log Message:
make decompile gui resizable
Index: DecompileGUI.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/DecompileGUI.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DecompileGUI.java 17 Jul 2002 14:00:24 -0000 1.3
--- DecompileGUI.java 23 Aug 2002 03:01:10 -0000 1.4
***************
*** 57,61 ****
});
pack();
- setResizable(false);
setLocationRelativeTo(parent);
}
--- 57,60 ----
|
|
From: Jeff B. <br...@us...> - 2002-08-23 02:44:41
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails
In directory usw-pr-cvs1:/tmp/cvs-serv31173
Modified Files:
ConstantPoolTab.java DependencyTab.java
Log Message:
add no implement labels to dep and cp tabs
Index: ConstantPoolTab.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/ConstantPoolTab.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConstantPoolTab.java 21 Jul 2002 02:03:47 -0000 1.1
--- ConstantPoolTab.java 23 Aug 2002 02:44:37 -0000 1.2
***************
*** 21,24 ****
--- 21,26 ----
import com.ociweb.jarspy.ClassInfo;
+ import javax.swing.JLabel;
+
/**
* Panel to diplay the constant pool in a class
***************
*** 30,33 ****
--- 32,36 ----
public ConstantPoolTab() {
super("Constant Pool");
+ add(new JLabel("Not Implemented Yet."));
}
Index: DependencyTab.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails/DependencyTab.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** DependencyTab.java 21 Jul 2002 02:03:47 -0000 1.1
--- DependencyTab.java 23 Aug 2002 02:44:37 -0000 1.2
***************
*** 21,24 ****
--- 21,26 ----
import com.ociweb.jarspy.ClassInfo;
+ import javax.swing.JLabel;
+
/**
* A Panel to display dependency information about a class
***************
*** 30,33 ****
--- 32,36 ----
public DependencyTab() {
super("Dependencies");
+ add(new JLabel("Not Implemented Yet."));
}
|
|
From: Jeff B. <br...@us...> - 2002-08-22 23:09:15
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/preferences
In directory usw-pr-cvs1:/tmp/cvs-serv13160/src/com/ociweb/jarspy/preferences
Modified Files:
DefaultJarSpyPreferences.java J2SEJarSpyPreferences.java
JarSpyPreferences.java
Log Message:
flush preferences
Index: DefaultJarSpyPreferences.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/preferences/DefaultJarSpyPreferences.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** DefaultJarSpyPreferences.java 20 Jun 2002 02:09:15 -0000 1.4
--- DefaultJarSpyPreferences.java 22 Aug 2002 23:09:08 -0000 1.5
***************
*** 98,100 ****
--- 98,107 ----
}
+ /**
+ * flushes any pending preferences
+ */
+ public void flush() {
+ // do nothing
+ }
+
}
Index: J2SEJarSpyPreferences.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/preferences/J2SEJarSpyPreferences.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** J2SEJarSpyPreferences.java 20 Jun 2002 02:09:15 -0000 1.3
--- J2SEJarSpyPreferences.java 22 Aug 2002 23:09:09 -0000 1.4
***************
*** 21,24 ****
--- 21,25 ----
import java.awt.*;
import java.util.prefs.Preferences;
+ import java.util.prefs.BackingStoreException;
/**
***************
*** 168,171 ****
--- 169,182 ----
prefs.put(MOST_RECENT_JAR, pathToJarFile);
} catch (Exception e) {
+ }
+ }
+
+ /**
+ * flushes any pending preferences
+ */
+ public void flush() {
+ try {
+ prefs.flush();
+ } catch (BackingStoreException e) {
}
}
Index: JarSpyPreferences.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/preferences/JarSpyPreferences.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** JarSpyPreferences.java 20 Jun 2002 02:09:15 -0000 1.4
--- JarSpyPreferences.java 22 Aug 2002 23:09:09 -0000 1.5
***************
*** 72,74 ****
--- 72,79 ----
*/
public void saveMostRecentJarFile(String pathToJarFile);
+
+ /**
+ * flushes any pending preferences
+ */
+ public void flush();
}
|
|
From: Jeff B. <br...@us...> - 2002-08-22 23:09:15
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv13160/src/com/ociweb/jarspy/gui
Modified Files:
JarSpyGUI.java
Log Message:
flush preferences
Index: JarSpyGUI.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyGUI.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** JarSpyGUI.java 21 Jul 2002 02:03:47 -0000 1.34
--- JarSpyGUI.java 22 Aug 2002 23:09:07 -0000 1.35
***************
*** 370,373 ****
--- 370,374 ----
}
}
+ jarSpyPreferences.flush();
}
|
|
From: Jeff B. <br...@us...> - 2002-07-21 02:03:52
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv24046/src/com/ociweb/jarspy/gui
Modified Files:
JarSpyGUI.java
Removed Files:
ClassDetailPanel.java DetailPanel.java
Log Message:
initial set of code for new details panel
Index: JarSpyGUI.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyGUI.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -C2 -d -r1.33 -r1.34
*** JarSpyGUI.java 20 Jul 2002 18:12:23 -0000 1.33
--- JarSpyGUI.java 21 Jul 2002 02:03:47 -0000 1.34
***************
*** 77,81 ****
import java.util.Map;
import java.util.jar.JarFile;
!
/**
* @author Jeff Brown
--- 77,81 ----
import java.util.Map;
import java.util.jar.JarFile;
! import com.ociweb.jarspy.gui.classdetails.ClassDetailsPanel;
/**
* @author Jeff Brown
***************
*** 86,90 ****
private JarInspector jarInspector = new JarInspector();
! private ClassDetailPanel classDetailPanel;
private Map actions = new HashMap();
private JList classList;
--- 86,90 ----
private JarInspector jarInspector = new JarInspector();
! private ClassDetailsPanel classDetailPanel;
private Map actions = new HashMap();
private JList classList;
***************
*** 97,101 ****
public JarSpyGUI() {
super("JarSpy");
! classDetailPanel = new ClassDetailPanel(this);
classTree = new JarSpyClassTree(this, jarInspector);
classList = new JarSpyClassList(this, jarInspector);
--- 97,101 ----
public JarSpyGUI() {
super("JarSpy");
! classDetailPanel = new ClassDetailsPanel(this);
classTree = new JarSpyClassTree(this, jarInspector);
classList = new JarSpyClassList(this, jarInspector);
***************
*** 398,402 ****
JarSpyClassTreeNode jctn = (JarSpyClassTreeNode) o;
ClassInfo classInfo = jctn.getClassInfo();
! classDetailPanel.setClassInfo(classInfo);
notifyClassSelectionListeners(classInfo);
} else {
--- 398,402 ----
JarSpyClassTreeNode jctn = (JarSpyClassTreeNode) o;
ClassInfo classInfo = jctn.getClassInfo();
! // classDetailPanel.setClassInfo(classInfo);
notifyClassSelectionListeners(classInfo);
} else {
***************
*** 415,419 ****
if (o instanceof ClassInfo) {
ClassInfo classInfo = (ClassInfo) o;
! classDetailPanel.setClassInfo(classInfo);
notifyClassSelectionListeners(classInfo);
} else if (o == null) {
--- 415,419 ----
if (o instanceof ClassInfo) {
ClassInfo classInfo = (ClassInfo) o;
! // classDetailPanel.setClassInfo(classInfo);
notifyClassSelectionListeners(classInfo);
} else if (o == null) {
--- ClassDetailPanel.java DELETED ---
--- DetailPanel.java DELETED ---
|
|
From: Jeff B. <br...@us...> - 2002-07-21 02:03:51
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails
In directory usw-pr-cvs1:/tmp/cvs-serv24046/src/com/ociweb/jarspy/gui/classdetails
Added Files:
AbstractClassDetailTab.java ClassDetailTab.java
ClassDetailTabbedPane.java ClassDetailsPanel.java
ConstantPoolTab.java DependencyTab.java FieldsTab.java
GeneralTab.java MethodsTab.java NoClassSelectedPanel.java
Log Message:
initial set of code for new details panel
--- NEW FILE: AbstractClassDetailTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
/**
* An abstract implementation of ClassDetail tab for components to extend
*
* @version $Id: AbstractClassDetailTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public abstract class AbstractClassDetailTab extends JPanel
implements ClassDetailTab {
private String tabName;
public AbstractClassDetailTab(String tabName) {
this.tabName = tabName;
setBorder(BorderFactory.createRaisedBevelBorder());
}
public void setClassInfo(ClassInfo classInfo) {
}
public String getName() {
return tabName;
}
}
--- NEW FILE: ClassDetailTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
/**
* Any component to be displayed in a ClassDetailTabbedPane must implement
* this interface
*
* @version $Id: ClassDetailTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public interface ClassDetailTab {
public void setClassInfo(ClassInfo classInfo);
/**
* Used by JTabbedPane to retrieve the tab name to be used in the UI
*
* @return the label for this tab
*/
public String getName();
}
--- NEW FILE: ClassDetailTabbedPane.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;
/**
* Tabbed pane to display class details
*
* @version $Id: ClassDetailTabbedPane.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class ClassDetailTabbedPane extends JTabbedPane {
private AbstractClassDetailTab[] tabs = {
new GeneralTab(),
new FieldsTab(),
new MethodsTab(),
new ConstantPoolTab(),
new DependencyTab()
};
public ClassDetailTabbedPane() {
for (int i = 0; i < tabs.length; i++) {
AbstractClassDetailTab tab = tabs[i];
add(tab);
}
}
public void setClassInfo(final ClassInfo classInfo) {
// update all of the tabs
// use the event thread since these componenets will
// be changing their on screen state
SwingUtilities.invokeLater(new Runnable() {
public void run() {
for (int i = 0; i < tabs.length; i++) {
AbstractClassDetailTab tab = tabs[i];
try {
tab.setClassInfo(classInfo);
} catch (Exception e) {
}
}
}
});
}
}
--- NEW FILE: ClassDetailsPanel.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import com.ociweb.jarspy.gui.ClassSelectionListener;
import com.ociweb.jarspy.gui.JarFileSelectionListener;
import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import java.awt.CardLayout;
import java.io.File;
/**
* A Panel to display details about a class
*
* @version $Id: ClassDetailsPanel.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class ClassDetailsPanel extends JPanel
implements ClassSelectionListener, JarFileSelectionListener {
private CardLayout cardLayout = new CardLayout();
private static final String NO_CLASS_SELECTED = "NO_CLASS_SELECTED";
private static final String CLASS_DETAIL_PANEL = "CLASS_DETAIL_PANEL";
private ClassDetailTabbedPane tabbedPane = new ClassDetailTabbedPane();
public ClassDetailsPanel(JarSpyGUI gui) {
gui.addClassSelectionListener(this);
gui.addJarFileSelectionListener(this);
setLayout(cardLayout);
add(new JScrollPane(new NoClassSelectedPanel()), NO_CLASS_SELECTED);
add(new JScrollPane(tabbedPane), CLASS_DETAIL_PANEL);
cardLayout.show(this, NO_CLASS_SELECTED);
}
public void classSelected(ClassInfo classInfo) {
if (classInfo == null) {
cardLayout.show(this, NO_CLASS_SELECTED);
} else {
tabbedPane.setClassInfo(classInfo);
cardLayout.show(this, CLASS_DETAIL_PANEL);
}
}
public void jarFileSelectionChanged(File jarFile) {
if (jarFile == null) {
cardLayout.show(this, NO_CLASS_SELECTED);
}
}
}
--- NEW FILE: ConstantPoolTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
/**
* Panel to diplay the constant pool in a class
*
* @version $Id: ConstantPoolTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class ConstantPoolTab extends AbstractClassDetailTab {
public ConstantPoolTab() {
super("Constant Pool");
}
public void setClassInfo(ClassInfo classInfo) {
}
}
--- NEW FILE: DependencyTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
/**
* A Panel to display dependency information about a class
*
* @version $Id: DependencyTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class DependencyTab extends AbstractClassDetailTab {
public DependencyTab() {
super("Dependencies");
}
public void setClassInfo(ClassInfo classInfo) {
}
}
--- NEW FILE: FieldsTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import java.awt.BorderLayout;
/**
* Panel to display a list of fields in a class
*
* @version $Id: FieldsTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class FieldsTab extends AbstractClassDetailTab {
private JList fieldsList = new JList();
public FieldsTab() {
super("Fields");
setLayout(new BorderLayout());
add(fieldsList);
}
public void setClassInfo(ClassInfo classInfo) {
Object[] fields = classInfo.getFields();
DefaultListModel model = new DefaultListModel();
if (fields.length == 0) {
model.addElement("<none>");
} else {
for (int i = 0; i < fields.length; i++) {
model.addElement(fields[i]);
}
}
fieldsList.setModel(model);
}
}
--- NEW FILE: GeneralTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
/**
* Panel to display general details about a class
*
* @version $Id: GeneralTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class GeneralTab extends AbstractClassDetailTab {
private JLabel className = new JLabel("");
private JLabel classMajorVersion = new JLabel("");
private JLabel classMinorVersion = new JLabel("");
private JLabel type = new JLabel("");
private JLabel isFinal = new JLabel("");
private JLabel isAbstract = new JLabel("");
public GeneralTab() {
super("General");
setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = gbc.RELATIVE;
gbc.gridy = 0;
gbc.insets.top =
gbc.insets.bottom =
gbc.insets.left =
gbc.insets.right = 5;
JLabel[][] labelPairs = {
{new JLabel("Name:"), className},
{new JLabel("Type:"), type},
{new JLabel("Abstract:"), isAbstract},
{new JLabel("Major Version Number:"), classMajorVersion},
{new JLabel("Minor Version Number:"), classMinorVersion},
{new JLabel("Final?:"), isFinal}
};
for (int i = 0; i < labelPairs.length; i++) {
JLabel[] labelPair = labelPairs[i];
gbc.gridy++;
gbc.anchor = gbc.NORTHEAST;
gbc.weightx = 0;
Font font = labelPair[0].getFont();
labelPair[0].setFont(font.deriveFont(Font.BOLD));
add(labelPair[0], gbc);
gbc.anchor = gbc.NORTHWEST;
gbc.weightx = 1;
add(labelPair[1], gbc);
}
gbc.weighty = 1;
gbc.weightx = 0;
add(new JPanel(), gbc);
}
public void setClassInfo(ClassInfo classInfo) {
className.setText(classInfo.getClassName());
classMajorVersion.setText(String.valueOf(classInfo.getMajorVersion()));
classMinorVersion.setText(String.valueOf(classInfo.getMinorVersion()));
type.setText(classInfo.isAnInterface() ? "Interface" : "Class");
isFinal.setText(classInfo.isFinal() ? "Yes" : "No");
isAbstract.setText(classInfo.isAbstract() ? "Yes" : "No");
}
}
--- NEW FILE: MethodsTab.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.classdetails;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import java.awt.BorderLayout;
/**
* Panel to display a list of methods
*
* @version $Id: MethodsTab.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class MethodsTab extends AbstractClassDetailTab {
private JList methodsList = new JList();
public MethodsTab() {
super("Methods");
setLayout(new BorderLayout());
add(methodsList);
}
public void setClassInfo(ClassInfo classInfo) {
Object[] methods = classInfo.getMethods();
DefaultListModel model = new DefaultListModel();
for (int i = 0; i < methods.length; i++) {
model.addElement(methods[i]);
}
methodsList.setModel(model);
}
}
--- NEW FILE: NoClassSelectedPanel.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.classdetails;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
/**
* Panel to display when no class is selected
*
* @version $Id: NoClassSelectedPanel.java,v 1.1 2002/07/21 02:03:47 brown_j Exp $
*/
public class NoClassSelectedPanel extends JPanel {
private JLabel label = new JLabel("Select A Class", SwingConstants.CENTER);
public NoClassSelectedPanel() {
super(new BorderLayout());
add(BorderLayout.CENTER, label);
}
}
|
|
From: Jeff B. <br...@us...> - 2002-07-20 22:32:39
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails In directory usw-pr-cvs1:/tmp/cvs-serv14420/classdetails Log Message: Directory /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/classdetails added to the repository |
|
From: Jeff B. <br...@us...> - 2002-07-20 22:31:53
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv14255
Modified Files:
JarSpyInfoPanel.java
Log Message:
incremented version
Index: JarSpyInfoPanel.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyInfoPanel.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** JarSpyInfoPanel.java 20 Jul 2002 03:06:15 -0000 1.21
--- JarSpyInfoPanel.java 20 Jul 2002 22:31:50 -0000 1.22
***************
*** 46,50 ****
gbc.insets.top = gbc.insets.bottom = 0;
! add(new JLabel("JarSpy v0.6.1"), gbc);
add(new JLabel("http://www.jarspy.org/"), gbc);
add(new JLabel("Email: co...@ja..."), gbc);
--- 46,50 ----
gbc.insets.top = gbc.insets.bottom = 0;
! add(new JLabel("JarSpy v0.6.2"), gbc);
add(new JLabel("http://www.jarspy.org/"), gbc);
add(new JLabel("Email: co...@ja..."), gbc);
|
|
From: Jeff B. <br...@us...> - 2002-07-20 18:33:14
|
Update of /cvsroot/jarspy/JarSpy In directory usw-pr-cvs1:/tmp/cvs-serv16745 Modified Files: README Log Message: Index: README =================================================================== RCS file: /cvsroot/jarspy/JarSpy/README,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** README 19 Jul 2002 00:27:12 -0000 1.13 --- README 20 Jul 2002 18:33:10 -0000 1.14 *************** *** 1,3 **** ! JarSpy v0.6 http://www.jarspy.org/ ======================================= --- 1,3 ---- ! JarSpy v0.6.1 http://www.jarspy.org/ ======================================= |
|
From: Jeff B. <br...@us...> - 2002-07-20 18:13:11
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/images In directory usw-pr-cvs1:/tmp/cvs-serv12394 Added Files: package_obj.gif Log Message: --- NEW FILE: package_obj.gif --- GIF89a |
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy/gui/tree
Added Files:
JarSpyClassTree.java JarSpyClassTreeNode.java
JarSpyPackageTreeNode.java JarSpyRootTreeNode.java
JarSpyTreeCellRenderer.java JarSpyTreeModel.java
JarSpyTreeNode.java
Log Message:
added new tree view option
--- NEW FILE: JarSpyClassTree.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.jarspy.ClassInfo;
import com.ociweb.jarspy.JarInspector;
import com.ociweb.jarspy.JarInspectorListener;
import com.ociweb.jarspy.gui.JarFileSelectionListener;
import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JTree;
import javax.swing.tree.TreeCellRenderer;
import java.io.File;
/**
* A tree for displaying archive contents
*
* @version $Id: JarSpyClassTree.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class JarSpyClassTree extends JTree
implements JarInspectorListener, JarFileSelectionListener {
public JarSpyClassTree(JarSpyGUI jarSpyGUI,
JarInspector inspector) {
inspector.addJarInspectorListener(this);
jarSpyGUI.addJarFileSelectionListener(this);
setModel(new JarSpyTreeModel());
}
public void setCellRenderer(TreeCellRenderer renderer) {
// wrap the real renderer in our renderer proxy class
// to enforce interfaces being displayed in italics...
if (renderer == null) {
super.setCellRenderer(null);
} else {
super.setCellRenderer(new JarSpyTreeCellRenderer(renderer));
}
}
/**
* Notify listener that a JarInspector has been updated
* @param inspector the JarInspector which has been updated
*/
public void jarInspectorUpdated(JarInspector jarInspector) {
ClassInfo[] classInfo = jarInspector.getClassInfo();
JarSpyTreeModel treeModel = new JarSpyTreeModel(jarInspector.getJarFile().getName(), classInfo);
setModel(treeModel);
}
public void addNotify() {
super.addNotify();
try {
clearSelection();
} catch (Exception e) {
}
}
public void jarFileSelectionChanged(File jarFile) {
if (jarFile == null) {
setModel(new JarSpyTreeModel());
}
}
}
--- NEW FILE: JarSpyClassTreeNode.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.jarspy.ClassInfo;
import javax.swing.tree.DefaultMutableTreeNode;
/**
* A tree node representing a class or interface in an archive
*
* @version $Id: JarSpyClassTreeNode.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class JarSpyClassTreeNode extends DefaultMutableTreeNode {
private String simpleClassName;
public JarSpyClassTreeNode(ClassInfo classInfo) {
super(classInfo);
simpleClassName = classInfo.getSimpleClassName();
}
public ClassInfo getClassInfo() {
return (ClassInfo) getUserObject();
}
public String toString() {
return simpleClassName;
}
}
--- NEW FILE: JarSpyPackageTreeNode.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 java.util.HashMap;
import java.util.Map;
/**
* A tree node representing a package in an archive
*
* @version $Id: JarSpyPackageTreeNode.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class JarSpyPackageTreeNode extends DefaultMutableTreeNode {
private static final Map nodes = new HashMap();
private static final String DEFAULT_PACKAGE = "<default>";
private JarSpyPackageTreeNode(String name) {
super(name);
}
public boolean isLeaf() {
return false;
}
public String toString() {
return super.toString() + " (" + super.getLeafCount() + ")";
}
public static final JarSpyPackageTreeNode getPackageTreeNode(String packageName) {
if ("".equals(packageName)) {
packageName = DEFAULT_PACKAGE;
}
JarSpyPackageTreeNode packageNode = null;
synchronized (nodes) {
packageNode =
(JarSpyPackageTreeNode) nodes.get(packageName);
if (packageNode == null) {
packageNode = new JarSpyPackageTreeNode(packageName);
nodes.put(packageName, packageNode);
}
}
return packageNode;
}
public static void reset() {
synchronized (nodes) {
nodes.clear();
}
}
}
--- NEW FILE: JarSpyRootTreeNode.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.jarspy.ClassInfo;
import javax.swing.tree.TreeNode;
import java.util.Enumeration;
import java.util.Vector;
/**
* A node in a tree representing an archive
*
* @version $Id: JarSpyRootTreeNode.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class JarSpyRootTreeNode implements JarSpyTreeNode {
private Vector packageNodes = new Vector();
private String jarName;
public JarSpyRootTreeNode(String jarName, ClassInfo[] classInfo) {
this.jarName = jarName;
JarSpyPackageTreeNode.reset();
createNodes(classInfo);
}
private void createNodes(ClassInfo[] classInfo) {
for (int i = 0; i < classInfo.length; i++) {
ClassInfo info = classInfo[i];
String fullyQualifiedName = info.getClassName();
int index = fullyQualifiedName.lastIndexOf('.');
String className = fullyQualifiedName.substring(index + 1);
String packageName = "";
if (index != -1) {
packageName = fullyQualifiedName.substring(0, index);
}
JarSpyPackageTreeNode packageNode =
JarSpyPackageTreeNode.getPackageTreeNode(packageName);
if (!packageNodes.contains(packageNode)) {
packageNodes.add(packageNode);
}
packageNode.add(new JarSpyClassTreeNode(info));
}
}
/**
* Returns the child <code>TreeNode</code> at index
* <code>childIndex</code>.
*/
public TreeNode getChildAt(int childIndex) {
JarSpyPackageTreeNode node =
(JarSpyPackageTreeNode) packageNodes.elementAt(childIndex);
return node;
}
/**
* Returns the number of children <code>TreeNode</code>s the receiver
* contains.
*/
public int getChildCount() {
return packageNodes.size();
}
/**
* Returns the parent <code>TreeNode</code> of the receiver.
*/
public TreeNode getParent() {
return null;
}
/**
* Returns the index of <code>node</code> in the receivers children.
* If the receiver does not contain <code>node</code>, -1 will be
* returned.
*/
public int getIndex(TreeNode node) {
return packageNodes.indexOf(node);
}
/**
* Returns true if the receiver allows children.
*/
public boolean getAllowsChildren() {
return true;
}
/**
* Returns true if the receiver is a leaf.
*/
public boolean isLeaf() {
return false;
}
/**
* Returns the children of the receiver as an <code>Enumeration</code>.
*/
public Enumeration children() {
return packageNodes.elements();
}
public String toString() {
return jarName;
}
}
--- NEW FILE: JarSpyTreeCellRenderer.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.jarspy.ClassInfo;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.tree.TreeCellRenderer;
import java.awt.Component;
/**
* Renders cells in a JarSpyClassTree
*
* @verson $Id: JarSpyTreeCellRenderer.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
class JarSpyTreeCellRenderer implements TreeCellRenderer {
private ImageIcon classIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/class_obj.gif"));
private ImageIcon interfaceIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/int_obj.gif"));
private ImageIcon packageIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/package_obj.gif"));
private ImageIcon archiveIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/Jar16.gif"));
private TreeCellRenderer realRenderer;
JarSpyTreeCellRenderer(TreeCellRenderer renderer) {
realRenderer = renderer;
}
/**
* Sets the value of the current tree cell to <code>value</code>.
* If <code>selected</code> is true, the cell will be drawn as if
* selected. If <code>expanded</code> is true the node is currently
* expanded and if <code>leaf</code> is true the node represets a
* leaf and if <code>hasFocus</code> is true the node currently has
* focus. <code>tree</code> is the <code>JTree</code> the receiver is being
* configured for. Returns the <code>Component</code> that the renderer
* uses to draw the value.
*
* @return the <code>Component</code> that the renderer uses to draw the value
*/
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean selected,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
Component c = realRenderer.getTreeCellRendererComponent(tree,
value,
selected,
expanded,
leaf,
row,
hasFocus);
if (c instanceof JLabel) {
JLabel label = (JLabel) c;
try {
if (value instanceof JarSpyClassTreeNode) {
ClassInfo classInfo = ((JarSpyClassTreeNode) value).getClassInfo();
if (classInfo.isAnInterface()) {
label.setIcon(interfaceIcon);
} else {
label.setIcon(classIcon);
}
} else if (value instanceof JarSpyPackageTreeNode) {
label.setIcon(packageIcon);
} else if (value instanceof JarSpyRootTreeNode) {
label.setIcon(archiveIcon);
}
} catch (Exception e) {
}
}
return c;
}
}
--- NEW FILE: JarSpyTreeModel.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.jarspy.ClassInfo;
import javax.swing.tree.DefaultTreeModel;
/**
* The model for a JarSpyClassTree
*
* @version $Id: JarSpyTreeModel.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class JarSpyTreeModel extends DefaultTreeModel {
public JarSpyTreeModel() {
this("<none>", new ClassInfo[0]);
}
public JarSpyTreeModel(String jarName, ClassInfo[] classInfo) {
super(new JarSpyRootTreeNode(jarName, classInfo));
}
}
--- NEW FILE: JarSpyTreeNode.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.TreeNode;
/**
* A node in a JarSpyClassTree
*
* @version $Id: JarSpyTreeNode.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public interface JarSpyTreeNode extends TreeNode {
}
|
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy In directory usw-pr-cvs1:/tmp/cvs-serv12138 Modified Files: CHANGES Log Message: added new tree view option Index: CHANGES =================================================================== RCS file: /cvsroot/jarspy/JarSpy/CHANGES,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** CHANGES 19 Jul 2002 01:09:04 -0000 1.2 --- CHANGES 20 Jul 2002 18:12:23 -0000 1.3 *************** *** 1,2 **** --- 1,8 ---- + Changes in version 0.6.1 + + - added new Tree view option + - fixed action framework to allow actions without images + - modified menu structure + Changes in version 0.6 |
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/images In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy/gui/images Added Files: Jar16.gif class_obj.gif int_obj.gif list_mode.gif tree_mode.gif Log Message: added new tree view option --- NEW FILE: Jar16.gif --- GIF89a ~Wa!l- y:ÌÊÇN' S4P 0ÌAËm$a0#aRZ--ÎUÈ4¨²ñª¥K"rMt -}_B^- JLF GR Ver 1.0 --- NEW FILE: class_obj.gif --- GIF89a --- NEW FILE: int_obj.gif --- GIF89a --- NEW FILE: list_mode.gif --- GIF89a ÀG?^cu-aJ&+bd ±%¶'¦¬hÅd |ÒcÅVX^[ºr¨IºôÒãµ4!¥ZÔ! ²r»^µ¨t-Þ¶±1uiV¯H"f%Ö¯eË6 ªÝÌy)ÃÏ --- NEW FILE: tree_mode.gif --- GIF89a ´¢bì®Äè±#6Sf @#+ |
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/classinfo
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/classinfo
Modified Files:
ClassReader.java
Log Message:
added new tree view option
Index: ClassReader.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/classinfo/ClassReader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ClassReader.java 19 Jun 2002 01:19:10 -0000 1.4
--- ClassReader.java 20 Jul 2002 18:12:23 -0000 1.5
***************
*** 51,54 ****
--- 51,55 ----
private String className_;
+ private String simpleClassName_;
private String superClassName_;
***************
*** 254,257 ****
--- 255,261 ----
(constantPool[di.readShort()]).intValue()].replace('/', '.');
+ int lastDot = className_.lastIndexOf('.');
+ simpleClassName_ = className_.substring(lastDot + 1);
+
int i2 = di.readShort();
if (i2 > 0) {
***************
*** 329,332 ****
--- 333,343 ----
public String getClassName() {
return className_;
+ }
+
+ /**
+ * @return the simple class name, without package
+ */
+ public String getSimpleClassName() {
+ return simpleClassName_;
}
|
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy/gui/actions
Modified Files:
ActionNames.java DecompileAction.java JarSpyAction.java
Added Files:
ChangeJarViewerComponentAction.java
Log Message:
added new tree view option
--- NEW FILE: ChangeJarViewerComponentAction.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.actions;
import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JSplitPane;
import java.awt.Component;
import java.awt.event.ActionEvent;
/**
* An action for swithcing the component used to display primary archive
* contents
*
* @version $Id: ChangeJarViewerComponentAction.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public class ChangeJarViewerComponentAction extends JarSpyAction {
private Component viewComponent;
public ChangeJarViewerComponentAction(JarSpyGUI gui,
String name,
Component viewComponent,
String imagePath) {
super(gui,
name,
imagePath,
false);
this.viewComponent = viewComponent;
}
/**
* Invoked when an action occurs.
*/
public void actionPerformed(ActionEvent e) {
jarSpyGUI.setJarViewComponent(viewComponent);
}
}
Index: ActionNames.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/ActionNames.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ActionNames.java 17 Jul 2002 14:00:25 -0000 1.1
--- ActionNames.java 20 Jul 2002 18:12:23 -0000 1.2
***************
*** 31,33 ****
--- 31,35 ----
String DECOMPILE_ACTION = "Decompile Class";
String VIEW_JAR_CONTENTS_ACTION = "View Jar Contents";
+ String SHOW_JAR_LIST_VIEW = "List View";
+ String SHOW_JAR_TREE_VIEW = "Tree View";
}
Index: DecompileAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/DecompileAction.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DecompileAction.java 19 Jul 2002 00:46:43 -0000 1.3
--- DecompileAction.java 20 Jul 2002 18:12:23 -0000 1.4
***************
*** 21,32 ****
import com.ociweb.jarspy.ClassInfo;
import com.ociweb.jarspy.JarInspector;
! import com.ociweb.jarspy.gui.JarFileSelectionListener;
! import com.ociweb.jarspy.gui.JarSpyGUI;
import com.ociweb.jarspy.gui.DecompileGUI;
- import javax.swing.JList;
import javax.swing.JOptionPane;
! import javax.swing.event.ListSelectionEvent;
! import javax.swing.event.ListSelectionListener;
import java.awt.event.ActionEvent;
import java.io.File;
--- 21,30 ----
import com.ociweb.jarspy.ClassInfo;
import com.ociweb.jarspy.JarInspector;
! import com.ociweb.jarspy.gui.ClassSelectionListener;
import com.ociweb.jarspy.gui.DecompileGUI;
+ import com.ociweb.jarspy.gui.JarSpyGUI;
import javax.swing.JOptionPane;
! import javax.swing.JTree;
import java.awt.event.ActionEvent;
import java.io.File;
***************
*** 37,50 ****
*/
public class DecompileAction extends JarSpyAction
! implements JarFileSelectionListener, ListSelectionListener {
private String className;
! private JList classList;
private String pathToJarFile;
private JarInspector jarInspector;
public DecompileAction(JarSpyGUI gui,
! JList classList,
! JarInspector jarInspector) {
super(gui,
ActionNames.DECOMPILE_ACTION,
--- 35,48 ----
*/
public class DecompileAction extends JarSpyAction
! implements ClassSelectionListener {
private String className;
! private JTree classTree;
private String pathToJarFile;
private JarInspector jarInspector;
public DecompileAction(JarSpyGUI gui,
! JTree classTree,
! JarInspector jarInspector) {
super(gui,
ActionNames.DECOMPILE_ACTION,
***************
*** 53,58 ****
this.jarInspector = jarInspector;
setEnabled(false);
! this.classList = classList;
! classList.addListSelectionListener(this);
}
--- 51,56 ----
this.jarInspector = jarInspector;
setEnabled(false);
! this.classTree = classTree;
! jarSpyGUI.addClassSelectionListener(this);
}
***************
*** 66,72 ****
public void actionPerformed(ActionEvent ae) {
try {
- // dec.decompile(className,
- // new java.io.PrintWriter(System.out),
- // null);
DecompileGUI dg = new DecompileGUI(jarSpyGUI,
className,
--- 64,67 ----
***************
*** 83,97 ****
}
! public void valueChanged(ListSelectionEvent lse) {
! if (!lse.getValueIsAdjusting()) {
! className = null;
! Object o = classList.getSelectedValue();
! if (o instanceof ClassInfo) {
! setEnabled(true);
! className = ((ClassInfo) o).getClassName();
! } else {
! setEnabled(false);
! }
! }
}
}
--- 78,85 ----
}
! public void classSelected(ClassInfo classInfo) {
! setEnabled(classInfo != null);
}
+
}
+
Index: JarSpyAction.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/actions/JarSpyAction.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JarSpyAction.java 17 Jul 2002 14:00:25 -0000 1.1
--- JarSpyAction.java 20 Jul 2002 18:12:23 -0000 1.2
***************
*** 52,61 ****
*/
public JarSpyAction(JarSpyGUI gui,
! String actionName,
! String imagePath,
! boolean disabledWhenNoJarIsOpen) {
super(actionName);
! putValue(SMALL_ICON,
! new ImageIcon(getClass().getResource(imagePath)));
putValue(SHORT_DESCRIPTION, actionName);
gui.addJarFileSelectionListener(this);
--- 52,63 ----
*/
public JarSpyAction(JarSpyGUI gui,
! String actionName,
! String imagePath,
! boolean disabledWhenNoJarIsOpen) {
super(actionName);
! if (imagePath != null) {
! putValue(SMALL_ICON,
! new ImageIcon(getClass().getResource(imagePath)));
! }
putValue(SHORT_DESCRIPTION, actionName);
gui.addJarFileSelectionListener(this);
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy/gui
Modified Files:
ClassDetailPanel.java JarSpyClassList.java JarSpyGUI.java
Added Files:
ClassSelectionListener.java JarSpyListCellRenderer.java
Log Message:
added new tree view option
--- NEW FILE: ClassSelectionListener.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;
import com.ociweb.jarspy.ClassInfo;
/**
* ClassSelectionListeners are notified any time the class selection changes
* in the ui.
*
* @version $Id: ClassSelectionListener.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public interface ClassSelectionListener {
public void classSelected(ClassInfo classInfo);
}
--- NEW FILE: JarSpyListCellRenderer.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;
import com.ociweb.jarspy.ClassInfo;
import javax.swing.ListCellRenderer;
import javax.swing.ImageIcon;
import javax.swing.JList;
import javax.swing.JLabel;
import java.awt.Component;
import java.awt.Font;
/**
* This renderer delegates to another renderer. The other renderer
* is responsible for creating the render component. This wrapper
* modifies the font of the component generated by the real renderer
* to display interfaces in italic and classes in non italic.
*
* @version $Id: JarSpyListCellRenderer.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
class JarSpyListCellRenderer implements ListCellRenderer {
ImageIcon classIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/class_obj.gif"));
ImageIcon interfaceIcon =
new ImageIcon(getClass().getResource("/com/ociweb/jarspy/gui/images/int_obj.gif"));
private final ListCellRenderer realRenderer;
JarSpyListCellRenderer(ListCellRenderer realRenderer) {
this.realRenderer = realRenderer;
}
public Component getListCellRendererComponent(
JList list,
Object value,
int index,
boolean isSelected,
boolean cellHasFocus) {
Component c =
realRenderer.getListCellRendererComponent(list,
value,
index,
isSelected,
cellHasFocus);
if (c instanceof JLabel) {
JLabel label = (JLabel) c;
// this should always be true...
if (value instanceof ClassInfo) {
ClassInfo classInfo = (ClassInfo) value;
if (classInfo.isAnInterface()) {
// if this is an interface, then use italics...
Font font = label.getFont();
label.setFont(font.deriveFont(Font.ITALIC));
label.setIcon(interfaceIcon);
} else {
label.setIcon(classIcon);
}
}
}
return c;
}
}
Index: ClassDetailPanel.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/ClassDetailPanel.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ClassDetailPanel.java 19 Jun 2002 01:19:10 -0000 1.5
--- ClassDetailPanel.java 20 Jul 2002 18:12:23 -0000 1.6
***************
*** 23,26 ****
--- 23,27 ----
import javax.swing.*;
import java.awt.*;
+ import java.io.File;
/**
***************
*** 28,32 ****
* @version $Id$
*/
! class ClassDetailPanel extends JPanel {
DetailPanel fieldsPanel = new DetailPanel(" Fields:");
--- 29,34 ----
* @version $Id$
*/
! class ClassDetailPanel extends JPanel
! implements ClassSelectionListener, JarFileSelectionListener {
DetailPanel fieldsPanel = new DetailPanel(" Fields:");
***************
*** 34,42 ****
DetailPanel dependenciesPanel = new DetailPanel(" Dependencies:");
! public ClassDetailPanel() {
super(new GridLayout(0, 1, 0, 5));
add(fieldsPanel);
add(methodsPanel);
add(dependenciesPanel);
}
--- 36,47 ----
DetailPanel dependenciesPanel = new DetailPanel(" Dependencies:");
! public ClassDetailPanel(JarSpyGUI jarSpyGUI) {
super(new GridLayout(0, 1, 0, 5));
+ jarSpyGUI.addClassSelectionListener(this);
+ jarSpyGUI.addJarFileSelectionListener(this);
add(fieldsPanel);
add(methodsPanel);
add(dependenciesPanel);
+
}
***************
*** 51,54 ****
--- 56,72 ----
methodsPanel.update(classInfo.getMethods());
dependenciesPanel.update(classInfo.getDependencies());
+ }
+
+ public void classSelected(ClassInfo classInfo) {
+ clear();
+ if(classInfo != null) {
+ setClassInfo(classInfo);
+ }
+ }
+
+ public void jarFileSelectionChanged(File jarFile) {
+ if(jarFile == null) {
+ clear();
+ }
}
}
Index: JarSpyClassList.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyClassList.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** JarSpyClassList.java 15 Jul 2002 22:22:24 -0000 1.1
--- JarSpyClassList.java 20 Jul 2002 18:12:23 -0000 1.2
***************
*** 2,10 ****
--- 2,17 ----
import com.ociweb.jarspy.ClassInfo;
+ import com.ociweb.jarspy.JarInspector;
+ import com.ociweb.jarspy.JarInspectorListener;
+ import javax.swing.DefaultListModel;
+ import javax.swing.ImageIcon;
+ import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
+ import javax.swing.ListModel;
import java.awt.Component;
import java.awt.Font;
+ import java.io.File;
/**
***************
*** 12,61 ****
* of classes in JarSpy
*/
! public class JarSpyClassList extends JList {
! /**
! * This renderer delegates to another renderer. The other renderer
! * is responsible for creating the render component. This wrapper
! * modifies the font of the component generated by the real renderer
! * to display interfaces in italic and classes in non italic.
! */
! private class JarSpyListCellRenderer implements ListCellRenderer {
! private final ListCellRenderer realRenderer;
! JarSpyListCellRenderer(ListCellRenderer realRenderer) {
! this.realRenderer = realRenderer;
}
- public Component getListCellRendererComponent(
- JList list,
- Object value,
- int index,
- boolean isSelected,
- boolean cellHasFocus) {
- Component c =
- realRenderer.getListCellRendererComponent(list,
- value,
- index,
- isSelected,
- cellHasFocus);
! // this should always be true...
! if (value instanceof ClassInfo) {
! ClassInfo classInfo = (ClassInfo) value;
! // if this is an interface, then use italics...
! if (classInfo.isAnInterface()) {
! Font font = c.getFont();
! c.setFont(font.deriveFont(Font.ITALIC));
! }
! }
! return c;
}
}
! public void setCellRenderer(ListCellRenderer renderer) {
! // wrap the real renderer in our renderer proxy class
! // to enforce interfaces being displayed in italics...
! super.setCellRenderer(new JarSpyListCellRenderer(renderer));
}
}
--- 19,65 ----
* of classes in JarSpy
*/
! public class JarSpyClassList extends JList
! implements JarInspectorListener, JarFileSelectionListener {
! public JarSpyClassList(JarSpyGUI jarSpyGUI, JarInspector inspector) {
! inspector.addJarInspectorListener(this);
! jarSpyGUI.addJarFileSelectionListener(this);
! }
! public void setCellRenderer(ListCellRenderer renderer) {
! // wrap the real renderer in our renderer proxy class
! // to enforce interfaces being displayed in italics...
! super.setCellRenderer(new JarSpyListCellRenderer(renderer));
! }
! /**
! * Notify listener that a JarInspector has been updated
! * @param inspector the JarInspector which has been updated
! */
! public void jarInspectorUpdated(JarInspector jarInspector) {
! DefaultListModel listModel = new DefaultListModel();
! ClassInfo[] classInfo = jarInspector.getClassInfo();
! for (int i = 0; i < classInfo.length; i++) {
! listModel.addElement(classInfo[i]);
}
+ setModel(listModel);
+ }
! public void addNotify() {
! super.addNotify();
! try {
! clearSelection();
! } catch (Exception e) {
}
}
! public void jarFileSelectionChanged(File jarFile) {
! if (jarFile == null) {
! ListModel model = getModel();
! if (model instanceof DefaultListModel) {
! ((DefaultListModel) model).removeAllElements();
! }
! }
}
}
Index: JarSpyGUI.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyGUI.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** JarSpyGUI.java 20 Jul 2002 00:09:00 -0000 1.32
--- JarSpyGUI.java 20 Jul 2002 18:12:23 -0000 1.33
***************
*** 25,28 ****
--- 25,29 ----
import com.ociweb.jarspy.gui.actions.AboutAction;
import com.ociweb.jarspy.gui.actions.ActionNames;
+ import com.ociweb.jarspy.gui.actions.ChangeJarViewerComponentAction;
import com.ociweb.jarspy.gui.actions.DecompileAction;
import com.ociweb.jarspy.gui.actions.ExitAction;
***************
*** 31,34 ****
--- 32,37 ----
import com.ociweb.jarspy.gui.actions.ViewJarContentsAction;
import com.ociweb.jarspy.gui.actions.ViewManifestAction;
+ import com.ociweb.jarspy.gui.tree.JarSpyClassTree;
+ import com.ociweb.jarspy.gui.tree.JarSpyClassTreeNode;
import com.ociweb.jarspy.preferences.JarSpyPreferences;
import com.ociweb.jarspy.preferences.JarSpyPreferencesFactory;
***************
*** 36,40 ****
import javax.swing.Action;
import javax.swing.BorderFactory;
- import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JComponent;
--- 39,42 ----
***************
*** 50,54 ****
import javax.swing.JSplitPane;
import javax.swing.JToolBar;
! import javax.swing.ListModel;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
--- 52,56 ----
import javax.swing.JSplitPane;
import javax.swing.JToolBar;
! import javax.swing.JTree;
import javax.swing.ListSelectionModel;
import javax.swing.SwingUtilities;
***************
*** 56,60 ****
--- 58,66 ----
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+ import javax.swing.event.TreeSelectionEvent;
+ import javax.swing.event.TreeSelectionListener;
+ import javax.swing.tree.TreePath;
import java.awt.BorderLayout;
+ import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
***************
*** 65,68 ****
--- 71,75 ----
import java.io.File;
import java.io.IOException;
+ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.HashMap;
***************
*** 70,74 ****
import java.util.Map;
import java.util.jar.JarFile;
- import java.lang.reflect.InvocationTargetException;
/**
--- 77,80 ----
***************
*** 77,87 ****
*/
public class JarSpyGUI extends JFrame
! implements ListSelectionListener {
private JarInspector jarInspector = new JarInspector();
! private ClassDetailPanel classDetailPanel = new ClassDetailPanel();
private Map actions = new HashMap();
! private JList classList = new JarSpyClassList();
private List jarFileSelectionListeners = new ArrayList();
private JarSpyPreferences jarSpyPreferences = null;
private JSplitPane splitter = null;
--- 83,95 ----
*/
public class JarSpyGUI extends JFrame
! implements ListSelectionListener, TreeSelectionListener {
private JarInspector jarInspector = new JarInspector();
! private ClassDetailPanel classDetailPanel;
private Map actions = new HashMap();
! private JList classList;
! private JTree classTree;
private List jarFileSelectionListeners = new ArrayList();
+ private List classSelectionListeners = new ArrayList();
private JarSpyPreferences jarSpyPreferences = null;
private JSplitPane splitter = null;
***************
*** 89,92 ****
--- 97,103 ----
public JarSpyGUI() {
super("JarSpy");
+ classDetailPanel = new ClassDetailPanel(this);
+ classTree = new JarSpyClassTree(this, jarInspector);
+ classList = new JarSpyClassList(this, jarInspector);
classList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
try {
***************
*** 103,112 ****
cont.add(BorderLayout.NORTH, createToolBar());
cont.add(BorderLayout.CENTER, splitter);
- splitter.setLeftComponent(createClassListPanel());
splitter.setRightComponent(classDetailPanel);
!
addWindowListener((WindowListener)
actions.get(ActionNames.EXIT_ACTION));
classList.addListSelectionListener(this);
setJMenuBar(createJMenuBar());
--- 114,123 ----
cont.add(BorderLayout.NORTH, createToolBar());
cont.add(BorderLayout.CENTER, splitter);
splitter.setRightComponent(classDetailPanel);
! setJarViewComponent(classTree);
addWindowListener((WindowListener)
actions.get(ActionNames.EXIT_ACTION));
classList.addListSelectionListener(this);
+ classTree.addTreeSelectionListener(this);
setJMenuBar(createJMenuBar());
***************
*** 170,176 ****
new AboutAction(this));
actions.put(ActionNames.DECOMPILE_ACTION,
! new DecompileAction(this, classList, jarInspector));
actions.put(ActionNames.VIEW_JAR_CONTENTS_ACTION,
new ViewJarContentsAction(this));
}
--- 181,197 ----
new AboutAction(this));
actions.put(ActionNames.DECOMPILE_ACTION,
! new DecompileAction(this, classTree, jarInspector));
actions.put(ActionNames.VIEW_JAR_CONTENTS_ACTION,
new ViewJarContentsAction(this));
+ actions.put(ActionNames.SHOW_JAR_LIST_VIEW,
+ new ChangeJarViewerComponentAction(this,
+ ActionNames.SHOW_JAR_LIST_VIEW,
+ classList,
+ "/com/ociweb/jarspy/gui/images/list_mode.gif"));
+ actions.put(ActionNames.SHOW_JAR_TREE_VIEW,
+ new ChangeJarViewerComponentAction(this,
+ ActionNames.SHOW_JAR_TREE_VIEW,
+ classTree,
+ "/com/ociweb/jarspy/gui/images/tree_mode.gif"));
}
***************
*** 185,195 ****
menu.add(new JMenuItem
((Action) actions.get(ActionNames.EXTRACT_ARCHIVE_ACTION)));
- menu.add(new JMenuItem
- ((Action) actions.get(ActionNames.DECOMPILE_ACTION)));
menu.addSeparator();
menu.add(new JMenuItem
((Action) actions.get(ActionNames.EXIT_ACTION)));
! menu = new JMenu("View");
menuBar.add(menu);
menu.add(new JMenuItem
--- 206,214 ----
menu.add(new JMenuItem
((Action) actions.get(ActionNames.EXTRACT_ARCHIVE_ACTION)));
menu.addSeparator();
menu.add(new JMenuItem
((Action) actions.get(ActionNames.EXIT_ACTION)));
! menu = new JMenu("Inspect");
menuBar.add(menu);
menu.add(new JMenuItem
***************
*** 197,200 ****
--- 216,228 ----
menu.add(new JMenuItem
((Action) actions.get(ActionNames.VIEW_JAR_CONTENTS_ACTION)));
+ menu.add(new JMenuItem
+ ((Action) actions.get(ActionNames.DECOMPILE_ACTION)));
+
+ menu = new JMenu("View");
+ menuBar.add(menu);
+ menu.add(new JMenuItem
+ ((Action) actions.get(ActionNames.SHOW_JAR_LIST_VIEW)));
+ menu.add(new JMenuItem
+ ((Action) actions.get(ActionNames.SHOW_JAR_TREE_VIEW)));
menu = new JMenu("Look And Feel");
***************
*** 228,231 ****
--- 256,271 ----
}
+ public void addClassSelectionListener(ClassSelectionListener l) {
+ classSelectionListeners.add(l);
+ }
+
+ private void notifyClassSelectionListeners(ClassInfo classInfo) {
+ for (int i = 0; i < classSelectionListeners.size(); i++) {
+ ClassSelectionListener listener =
+ (ClassSelectionListener) classSelectionListeners.get(i);
+ listener.classSelected(classInfo);
+ }
+ }
+
public void setFile(File file) throws IOException {
notifyFileSelectionListeners(null);
***************
*** 235,239 ****
final StatusScreen ss = new StatusScreen(JarSpyGUI.this);
try {
- clearLists();
jarInspector.setProcessingListener(ss);
SwingUtilities.invokeAndWait(new Runnable() {
--- 275,278 ----
***************
*** 243,247 ****
});
jarInspector.setFile(file);
- refreshClassList();
notifyFileSelectionListeners(file);
setTitle("JarSpy - " + file.getName());
--- 282,285 ----
***************
*** 267,285 ****
}
! private void clearLists() {
! classDetailPanel.clear();
! ListModel model = classList.getModel();
! if (model instanceof DefaultListModel) {
! ((DefaultListModel) model).removeAllElements();
! }
! }
! private void refreshClassList() {
! DefaultListModel listModel = new DefaultListModel();
! ClassInfo[] classInfo = jarInspector.getClassInfo();
! for (int i = 0; i < classInfo.length; i++) {
! listModel.addElement(classInfo[i]);
! }
! classList.setModel(listModel);
}
--- 305,321 ----
}
! public void setJarViewComponent(Component viewComponent) {
! notifyClassSelectionListeners(null);
! int location = splitter.getDividerLocation();
! JComponent viewPanel = createClassViewPanel(viewComponent);
! // update the components UI in case the look and feel has
! // changed. if the look and feel changes while the component
! // is not in the container, the components ui will not have been
! // updated yet
! SwingUtilities.updateComponentTreeUI(viewPanel);
!
! splitter.setLeftComponent(viewPanel);
! splitter.setDividerLocation(location);
}
***************
*** 310,313 ****
--- 346,357 ----
toolBar.add(new JarSpyToolbarButton
+ ((Action)actions.get(ActionNames.SHOW_JAR_TREE_VIEW)));
+
+ toolBar.add(new JarSpyToolbarButton
+ ((Action)actions.get(ActionNames.SHOW_JAR_LIST_VIEW)));
+
+ toolBar.addSeparator();
+
+ toolBar.add(new JarSpyToolbarButton
((Action) actions.get(ActionNames.ABOUT_ACTION)));
***************
*** 328,333 ****
}
! private JComponent createClassListPanel() {
!
JPanel classListPanel = new JPanel(new BorderLayout(0, 1));
--- 372,376 ----
}
! private JComponent createClassViewPanel(Component viewComponent) {
JPanel classListPanel = new JPanel(new BorderLayout(0, 1));
***************
*** 337,341 ****
classList.setFont(new Font("Courier", Font.PLAIN, 14));
classListPanel.add(BorderLayout.NORTH, classesLabel);
! classListPanel.add(BorderLayout.CENTER, new JScrollPane(classList));
classListPanel.setBorder
(BorderFactory.createRaisedBevelBorder());
--- 380,384 ----
classList.setFont(new Font("Courier", Font.PLAIN, 14));
classListPanel.add(BorderLayout.NORTH, classesLabel);
! classListPanel.add(BorderLayout.CENTER, new JScrollPane(viewComponent));
classListPanel.setBorder
(BorderFactory.createRaisedBevelBorder());
***************
*** 343,352 ****
}
public void valueChanged(ListSelectionEvent lse) {
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
if (!lse.getValueIsAdjusting()) {
Object o = classList.getSelectedValue();
if (o instanceof ClassInfo) {
! classDetailPanel.setClassInfo((ClassInfo) o);
}
}
--- 386,422 ----
}
+ /**
+ * Called whenever the value of the selection changes.
+ * @param e the event that characterizes the change.
+ */
+ public void valueChanged(TreeSelectionEvent tse) {
+ setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ TreePath path = tse.getNewLeadSelectionPath();
+ if (path != null) {
+ Object o = path.getLastPathComponent();
+ if (o instanceof JarSpyClassTreeNode) {
+ JarSpyClassTreeNode jctn = (JarSpyClassTreeNode) o;
+ ClassInfo classInfo = jctn.getClassInfo();
+ classDetailPanel.setClassInfo(classInfo);
+ notifyClassSelectionListeners(classInfo);
+ } else {
+ notifyClassSelectionListeners(null);
+ }
+ }
+ setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+
public void valueChanged(ListSelectionEvent lse) {
+
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
if (!lse.getValueIsAdjusting()) {
Object o = classList.getSelectedValue();
if (o instanceof ClassInfo) {
! ClassInfo classInfo = (ClassInfo) o;
! classDetailPanel.setClassInfo(classInfo);
! notifyClassSelectionListeners(classInfo);
! } else if (o == null) {
! notifyClassSelectionListeners(null);
}
}
***************
*** 370,372 ****
--- 440,444 ----
JarSpyGUI jvg = new JarSpyGUI();
}
+
+
}
|
|
From: Jeff B. <br...@us...> - 2002-07-20 18:12:27
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy
In directory usw-pr-cvs1:/tmp/cvs-serv12138/src/com/ociweb/jarspy
Modified Files:
JarInspector.java
Added Files:
JarInspectorListener.java
Log Message:
added new tree view option
--- NEW FILE: JarInspectorListener.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;
/**
* JarInspectorListeners are notified any time the contents of a JarInspector
* are updated
*
* @version $Id: JarInspectorListener.java,v 1.1 2002/07/20 18:12:23 brown_j Exp $
*/
public interface JarInspectorListener {
/**
* Notify listener that a JarInspector has been updated
* @param inspector the JarInspector which has been updated
*/
public void jarInspectorUpdated(JarInspector inspector);
}
Index: JarInspector.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/JarInspector.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** JarInspector.java 19 Jul 2002 00:22:55 -0000 1.8
--- JarInspector.java 20 Jul 2002 18:12:23 -0000 1.9
***************
*** 26,29 ****
--- 26,31 ----
import java.util.Set;
import java.util.TreeSet;
+ import java.util.Vector;
+ import java.util.Iterator;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
***************
*** 41,44 ****
--- 43,47 ----
private Set classSet = new TreeSet();
private JarProcessingListener processingListener;
+ private Vector jarInspectorListeners = new Vector();
private void closeJar() {
***************
*** 63,66 ****
--- 66,83 ----
}
+ private synchronized void notifyJarInspectorListeners() {
+ Iterator iter = jarInspectorListeners.iterator();
+ while (iter.hasNext()) {
+ JarInspectorListener listener = (JarInspectorListener) iter.next();
+ listener.jarInspectorUpdated(this);
+ }
+ }
+
+ public synchronized void addJarInspectorListener(JarInspectorListener l) {
+ if(!jarInspectorListeners.contains(l)) {
+ jarInspectorListeners.add(l);
+ }
+ }
+
/**
* Register a processing listener. Right now, only one listener may
***************
*** 97,100 ****
--- 114,118 ----
processingListener.finishedProcessingJar();
}
+ notifyJarInspectorListeners();
}
|
|
From: Jeff B. <br...@us...> - 2002-07-20 18:04:21
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree In directory usw-pr-cvs1:/tmp/cvs-serv10361/tree Log Message: Directory /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/tree added to the repository |
|
From: Jeff B. <br...@us...> - 2002-07-20 03:06:19
|
Update of /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui
In directory usw-pr-cvs1:/tmp/cvs-serv10012
Modified Files:
JarSpyInfoPanel.java
Log Message:
incremented version number
Index: JarSpyInfoPanel.java
===================================================================
RCS file: /cvsroot/jarspy/JarSpy/src/com/ociweb/jarspy/gui/JarSpyInfoPanel.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** JarSpyInfoPanel.java 19 Jul 2002 00:17:20 -0000 1.20
--- JarSpyInfoPanel.java 20 Jul 2002 03:06:15 -0000 1.21
***************
*** 46,50 ****
gbc.insets.top = gbc.insets.bottom = 0;
! add(new JLabel("JarSpy v0.6"), gbc);
add(new JLabel("http://www.jarspy.org/"), gbc);
add(new JLabel("Email: co...@ja..."), gbc);
--- 46,50 ----
gbc.insets.top = gbc.insets.bottom = 0;
! add(new JLabel("JarSpy v0.6.1"), gbc);
add(new JLabel("http://www.jarspy.org/"), gbc);
add(new JLabel("Email: co...@ja..."), gbc);
|