org.pfsw.joi
Class BasicInspector

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.pfsw.joi.Inspector
          extended by org.pfsw.joi.BasicInspector
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener, javax.swing.event.TreeSelectionListener
Direct Known Subclasses:
AssociationListInspector, DynamicProxyInspector, KeyValueInspector, ListInspector, StringInspector

public class BasicInspector
extends Inspector
implements java.awt.event.ActionListener, javax.swing.event.TreeSelectionListener

This is the default inspector, which can display all normal java objects. Currently it opens a window on the object to inspect and displays all of its fields that are not static and not final, which means no class variables and no constants, but all instance variables (including inherited attributes).
For arrays it lists up all elements from 0 to n.
For deeper inspection it is possible to open a new inspector on each attribute.

Here is an example how to use the inspector:

Since:
JDK 1.2

Field Summary
protected static java.lang.String actResetModifiedValue
           
protected static java.lang.String actSaveModifiedValue
           
protected static java.lang.String actSetValueToNull
           
protected static java.io.PrintStream errorDevice
           
protected static int MIN_INFO_WIDTH
           
protected static int MIN_TREE_HEIGHT
           
protected static int MIN_TREE_WIDTH
           
 
Fields inherited from class org.pfsw.joi.Inspector
ActionSeparator, EXPORTER_MAPPING_FILENAME, EXPORTER_MAPPING_FILENAME_ALL, EXPORTER_MAPPING_FILENAME_CLASSLOADER, ExportPrefix, ImportPrefix, INSPECTOR_MAPPING_FILENAME, INSPECTOR_MAPPING_FILENAME_ALL, INSPECTOR_MAPPING_FILENAME_CLASSLOADER, PROG_COPYRIGHT, PROG_FULL_SIGNATURE, PROG_ID, PROG_NAME, PROG_SIGNATURE, PROG_VERSION
 
Constructor Summary
BasicInspector()
          Initialize the new instance with default values.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Is called whenever a user action event occured.
protected  void basicInspectCurrentElement(int where)
           
protected  InspectionView buildInspectionView()
           
protected  javax.swing.JPopupMenu createElementPopupMenu()
           
protected  javax.swing.JMenu createMenu(java.lang.String text)
           
protected  javax.swing.JMenuItem createMenuItem(java.lang.String text, java.lang.String command)
           
protected  ObjectSpyTreeNode createTreeNodes()
           
protected  javax.swing.JComponent createTreePanel()
           
protected  void displayCurrentEditableValue()
           
protected  void displayValueModificationError(java.lang.Exception ex)
          Display an error that occured during an attempt to modify an element's value.
protected  ElementFilter elementFilter()
           
protected  javax.swing.JTextField getActualTypeField()
           
protected  InspectionView getAssociatedView()
           
protected  ObjectValuePanel getContentArea()
           
protected  InspectionWindowController getController()
           
protected  Spy getCurrentElement()
           
protected  javax.swing.JTextField getDeclaredTypeField()
           
protected  java.awt.Container getDialogOwner()
           
protected  javax.swing.JTree getElementTree()
           
protected  InspectionView getInspectionView()
           
protected  java.lang.String getInspectorId()
           
protected  java.lang.String getObjectDisplayName()
           
protected  java.lang.String getTypeStringOf(Spy spy)
           
protected  java.awt.Component getValueComponentOf(Spy spy)
           
protected  java.lang.Object getValueOf(Spy spy)
           
protected  java.lang.String getValueStringOf(Spy spy)
           
protected  java.lang.String getValueTypeStringOf(Spy spy)
           
protected  void inspectCurrentElement(int where)
           
protected  void inspectObject(java.lang.String name, java.lang.Object obj)
          Inspect the given object.
protected  boolean isEditableElement(Spy spy)
           
protected  boolean isVisualComponent(java.lang.Object obj)
           
 void mouseClicked(java.awt.event.MouseEvent e)
          This method is called for every mouse click in the tree component.
protected  java.lang.Boolean parseToBoolean(java.lang.String str)
           
protected  java.lang.Byte parseToByte(java.lang.String text)
           
protected  java.lang.Character parseToCharacter(java.lang.String str)
           
protected  java.lang.Double parseToDouble(java.lang.String text)
           
protected  java.lang.Float parseToFloat(java.lang.String text)
           
protected  java.lang.Integer parseToInteger(java.lang.String text)
           
protected  java.lang.Long parseToLong(java.lang.String text)
           
protected  java.lang.Short parseToShort(java.lang.String text)
           
protected  Preferences prefs()
           
protected  void resetModifiedValue()
           
protected  void saveModifiedValue()
           
protected  void setActualTypeField(javax.swing.JTextField aValue)
           
protected  void setAssociatedView(InspectionView newValue)
           
protected  void setContentArea(ObjectValuePanel newValue)
           
protected  void setController(InspectionWindowController newValue)
           
protected  void setCurrentElement(Spy aValue)
           
protected  void setCurrentValueToNull()
           
protected  void setDeclaredTypeField(javax.swing.JTextField aValue)
           
protected  void setElementTree(javax.swing.JTree aValue)
           
protected  void setFilter(ElementFilter filter)
          Set the filter flags specified by the given filter in the inspected object
protected  void sortElements()
           
protected  org.pfsw.text.StringUtil str()
           
protected  void updateDisplay()
           
protected  void updateInformation(Spy spy)
          Is called whenever the selection in the element tree changed.
 void valueChanged(javax.swing.event.TreeSelectionEvent event)
          Is called whenever the selection in the element tree changed.
 
Methods inherited from class org.pfsw.joi.Inspector
anyInspectorActive, basicBindInspector, basicInspect, basicInspect, basicInspectIn, basicInspectWait, basicInspectWait, bindInspector, closeAllControllers, deactivateHalt, exportProviderRegistry, findExporterNamed, findInspectorClassInfoFor, fullIdentification, getAboutInfoText, getBasicObjectSpy, getBasicObjectSpy, getControllerRegistry, getExportProviderRegistry, getHaltCurrentProccess, getInspectedObject, getInspectorBinding, getInspectorFor, getObjectSpy, getObjectSpy, getProgSignature, halt, initializeExportProviderRegistry, initializeInspectorBinding, inspect, inspect, inspectIn, inspectorBinding, inspectWait, inspectWait, isHaltActive, launchInspectorOn, main, objectSpyFor, objectSpyFor, openInspectorIn, registerController, setControllerRegistry, setExportProviderRegistry, setHaltCurrentProccess, setInspectedObject, setInspectorBinding, shortIdentification, unregisterController, waitWhileHaltActive
 
Methods inherited from class java.awt.event.MouseAdapter
mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MIN_TREE_WIDTH

protected static final int MIN_TREE_WIDTH
See Also:
Constant Field Values

MIN_TREE_HEIGHT

protected static final int MIN_TREE_HEIGHT
See Also:
Constant Field Values

MIN_INFO_WIDTH

protected static final int MIN_INFO_WIDTH
See Also:
Constant Field Values

errorDevice

protected static final java.io.PrintStream errorDevice

actSaveModifiedValue

protected static final java.lang.String actSaveModifiedValue
See Also:
Constant Field Values

actResetModifiedValue

protected static final java.lang.String actResetModifiedValue
See Also:
Constant Field Values

actSetValueToNull

protected static final java.lang.String actSetValueToNull
See Also:
Constant Field Values
Constructor Detail

BasicInspector

public BasicInspector()
Initialize the new instance with default values.

Method Detail

getController

protected InspectionWindowController getController()

setController

protected void setController(InspectionWindowController newValue)

getAssociatedView

protected InspectionView getAssociatedView()

setAssociatedView

protected void setAssociatedView(InspectionView newValue)

getContentArea

protected ObjectValuePanel getContentArea()

setContentArea

protected void setContentArea(ObjectValuePanel newValue)

getDeclaredTypeField

protected javax.swing.JTextField getDeclaredTypeField()

setDeclaredTypeField

protected void setDeclaredTypeField(javax.swing.JTextField aValue)

getActualTypeField

protected javax.swing.JTextField getActualTypeField()

setActualTypeField

protected void setActualTypeField(javax.swing.JTextField aValue)

getCurrentElement

protected Spy getCurrentElement()

setCurrentElement

protected void setCurrentElement(Spy aValue)

getElementTree

protected javax.swing.JTree getElementTree()

setElementTree

protected void setElementTree(javax.swing.JTree aValue)

valueChanged

public void valueChanged(javax.swing.event.TreeSelectionEvent event)
Is called whenever the selection in the element tree changed.
It updates the information in the right section of the inspector window.

Specified by:
valueChanged in interface javax.swing.event.TreeSelectionListener
See Also:
TreeSelectionListener

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Is called whenever a user action event occured.
This method is actually performing all actions, triggered by buttons, keystrokes or menu items.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The action event holding further information on what happened.

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
This method is called for every mouse click in the tree component.
It brings up the popup menu for context specific actions.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class java.awt.event.MouseAdapter

inspectCurrentElement

protected void inspectCurrentElement(int where)

basicInspectCurrentElement

protected void basicInspectCurrentElement(int where)

inspectObject

protected void inspectObject(java.lang.String name,
                             java.lang.Object obj)
Inspect the given object.
That means to display the internal state of the given object's attributes.

Overrides:
inspectObject in class Inspector
Parameters:
obj - The object to look inside

getObjectDisplayName

protected java.lang.String getObjectDisplayName()

getInspectionView

protected InspectionView getInspectionView()

buildInspectionView

protected InspectionView buildInspectionView()

createMenuItem

protected javax.swing.JMenuItem createMenuItem(java.lang.String text,
                                               java.lang.String command)

createMenu

protected javax.swing.JMenu createMenu(java.lang.String text)

createElementPopupMenu

protected javax.swing.JPopupMenu createElementPopupMenu()

createTreePanel

protected javax.swing.JComponent createTreePanel()

getTypeStringOf

protected java.lang.String getTypeStringOf(Spy spy)

getValueTypeStringOf

protected java.lang.String getValueTypeStringOf(Spy spy)

getValueStringOf

protected java.lang.String getValueStringOf(Spy spy)

getValueComponentOf

protected java.awt.Component getValueComponentOf(Spy spy)

getValueOf

protected java.lang.Object getValueOf(Spy spy)

updateInformation

protected void updateInformation(Spy spy)
Is called whenever the selection in the element tree changed.

See Also:
TreeSelectionListener

isEditableElement

protected boolean isEditableElement(Spy spy)

isVisualComponent

protected boolean isVisualComponent(java.lang.Object obj)

setFilter

protected void setFilter(ElementFilter filter)
Set the filter flags specified by the given filter in the inspected object


updateDisplay

protected void updateDisplay()

displayValueModificationError

protected void displayValueModificationError(java.lang.Exception ex)
Display an error that occured during an attempt to modify an element's value.


displayCurrentEditableValue

protected void displayCurrentEditableValue()

resetModifiedValue

protected void resetModifiedValue()

setCurrentValueToNull

protected void setCurrentValueToNull()

saveModifiedValue

protected void saveModifiedValue()

parseToInteger

protected java.lang.Integer parseToInteger(java.lang.String text)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

parseToBoolean

protected java.lang.Boolean parseToBoolean(java.lang.String str)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

parseToCharacter

protected java.lang.Character parseToCharacter(java.lang.String str)
                                        throws java.lang.Exception
Throws:
java.lang.Exception

parseToLong

protected java.lang.Long parseToLong(java.lang.String text)
                              throws java.lang.Exception
Throws:
java.lang.Exception

parseToShort

protected java.lang.Short parseToShort(java.lang.String text)
                                throws java.lang.Exception
Throws:
java.lang.Exception

parseToByte

protected java.lang.Byte parseToByte(java.lang.String text)
                              throws java.lang.Exception
Throws:
java.lang.Exception

parseToDouble

protected java.lang.Double parseToDouble(java.lang.String text)
                                  throws java.lang.Exception
Throws:
java.lang.Exception

parseToFloat

protected java.lang.Float parseToFloat(java.lang.String text)
                                throws java.lang.Exception
Throws:
java.lang.Exception

createTreeNodes

protected ObjectSpyTreeNode createTreeNodes()

sortElements

protected void sortElements()

elementFilter

protected ElementFilter elementFilter()

getDialogOwner

protected java.awt.Container getDialogOwner()

getInspectorId

protected java.lang.String getInspectorId()

prefs

protected Preferences prefs()

str

protected org.pfsw.text.StringUtil str()