## com.bbn.openmap.util.propertyEditor
Class Inspector

    java.lang.Object
      com.bbn.openmap.util.propertyEditor.Inspector

All Implemented Interfaces:
  java.awt.event.ActionListener, java.util.EventListener

public class Inspector
extends java.lang.Object
implements java.awt.event.ActionListener

Class to inspect a PropertyConsumer. Used by the LayerAddPanel class to interactively configure a Layer object before it gets added to the map. This class should suffice to "inspect" any PropertyConsumer on a very basic level, handling is more convinient if property editor classes are available. The behavior of the Inspector is configured through properties; the propertiesInfo object of a PropertyConsumer may contain a initPropertiesProperty which determines which properties are to be shown and in which order, in a space seperated list, i.e. `initPropertiesProperty=class prettyName shapeFile` If this property is not defined, then all the properties will be displayed, in alphabetical order. For each property there may be a editorProperty entry giving a PropertyEditor class to instanciate as an editor for the property, i.e. `shapeFile.editor=com.bbn.openmap.util.propertyEditor.FilePropertyEditor` .

Field Summary
`protected java.awt.event.ActionListener` `actionListener` Handle to call back the object that invokes this Inspector.
`static java.lang.String` `cancelCommand` Action command for the cancelButton.
`protected java.lang.String` `defaultEditorClass` A simple TextField as a String editor.
`static java.lang.String` `doneCommand` The action command for the doneButton.
`protected java.util.Hashtable` `editors` Hashtable containing property names, and their editors.
`protected boolean` `print` Flag to print out the properties.
`protected PropertyConsumer` `propertyConsumer` The PropertyConsumer being inspected.
`protected WindowSupport` `windowSupport` Handle to the GUI.

Constructor Summary
`Inspector()` Does nothing.
`Inspector(java.awt.event.ActionListener al)` Sets the actionListener.

Method Summary
`void` `actionPerformed(java.awt.event.ActionEvent e)` Implement the ActionListener interface.
`void` `addActionListener(java.awt.event.ActionListener al)` Set an Actionlistener for callbacks.
`void` `collectAndSetProperties()` Tells the Inspector to collect the properties from the editors and set them on its PropertyConsumer.
`java.util.Properties` `collectProperties()` Extracts properties from textfield[].
`javax.swing.JComponent` `createEmbeddedPropertyGUI(PropertyConsumer pc)` Creates a JComponent with the properties to be changed.
`javax.swing.JComponent` `createEmbeddedPropertyGUI(java.lang.String prefix, java.util.Properties props, java.util.Properties info)` Creates a JComponent with the properties to be changed.
`javax.swing.JComponent` `createPropertyGUI(PropertyConsumer pc)` Creates a JComponent with the properties to be changed.
`javax.swing.JComponent` `createPropertyGUI(java.lang.String prefix, java.util.Properties props, java.util.Properties info)` Creates a JComponent with the properties to be changed.
`boolean` `getPrint()`
`WindowSupport` `getWindowSupport()`
`void` `inspectPropertyConsumer(PropertyConsumer propertyConsumer)` Inspect and configure a PropertyConsumer object.
`static void` `main(java.lang.String[] args)` test cases.
`void` `setPrint(boolean p)`
`java.util.Vector` `sortKeys(java.util.Collection keySet)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### defaultEditorClass

    protected final java.lang.String defaultEditorClass

  A simple TextField as a String editor.

  See Also:
    Constant Field Values

### propertyConsumer

    protected PropertyConsumer propertyConsumer

  The PropertyConsumer being inspected. Set in inspectPropertyConsumer.

### windowSupport

    protected WindowSupport windowSupport

  Handle to the GUI. Used for setVisible(true/false).

### cancelCommand

    public static final java.lang.String cancelCommand

  Action command for the cancelButton.

  See Also:
    Constant Field Values

### doneCommand

    public static final java.lang.String doneCommand

  The action command for the doneButton.

  See Also:
    Constant Field Values

### editors

    protected java.util.Hashtable editors

  Hashtable containing property names, and their editors. Used to fetch user inputs for configuring a property consumer.

### actionListener

    protected java.awt.event.ActionListener actionListener

  Handle to call back the object that invokes this Inspector.

### print

    protected boolean print

  Flag to print out the properties. Used when the Inspector is in stand-alone mode, so that the properties are directed to stdout.

Constructor Detail

### Inspector

    public Inspector()

  Does nothing.

### Inspector

    public Inspector(java.awt.event.ActionListener al)

  Sets the actionListener.

Method Detail

### addActionListener

    public void addActionListener(java.awt.event.ActionListener al)

  Set an Actionlistener for callbacks. Once a Layer object is configured, ie the "Add" button has been clicked, an ActionListener that invoked this Inspector can register here to be notified.

### inspectPropertyConsumer

    public void inspectPropertyConsumer(PropertyConsumer propertyConsumer)

  Inspect and configure a PropertyConsumer object. Main method of this class. The argument PropertyConsumer is inspected through the ProperyConsumer interface, the properties are displayed to be edited.

### sortKeys

    public java.util.Vector sortKeys(java.util.Collection keySet)

### createEmbeddedPropertyGUI

    public javax.swing.JComponent createEmbeddedPropertyGUI(PropertyConsumer pc)

  Creates a JComponent with the properties to be changed. This component is suitable for inclusion into a GUI.

  Parameters:
    `pc` - The property consumer to create a gui for.
  Returns:
    JComponent, a panel holding the interface to set the properties.

### createEmbeddedPropertyGUI

    public javax.swing.JComponent createEmbeddedPropertyGUI(java.lang.String prefix,
                                                            java.util.Properties props,
                                                            java.util.Properties info)

  Creates a JComponent with the properties to be changed. This component is suitable for inclusion into a GUI. Don't use this method directly! Use the createPropertyGUI(PropertyConsumer) instead. You will get a NullPointerException if you use this method without setting the PropertyConsumer in the Inspector.

  Parameters:
    `prefix` - the property prefix for the property consumer. Received from the PropertyConsumer.getPropertyPrefix() method. Properties that start with this prefix will have the prefix removed from the display, so the GUI will only show the actual property name.
    `props` - the properties received from the PropertyConsumer.getProperties() method.
    `info` - the properties received from the PropertyConsumer.getPropertyInfo() method, containing descriptions and any specific PropertyEditors that should be used for a particular property named in the PropertyConsumer.getProperties() properties.
  Returns:
    JComponent, a panel holding the interface to set the properties.

### createPropertyGUI

    public javax.swing.JComponent createPropertyGUI(PropertyConsumer pc)

  Creates a JComponent with the properties to be changed. This component is suitable for inclusion into a GUI.

  Parameters:
    `pc` - The property consumer to create a gui for.
  Returns:
    JComponent, a panel holding the interface to set the properties.

### createPropertyGUI

    public javax.swing.JComponent createPropertyGUI(java.lang.String prefix,
                                                    java.util.Properties props,
                                                    java.util.Properties info)

  Creates a JComponent with the properties to be changed. This component is suitable for inclusion into a GUI. Don't use this method directly! Use the createPropertyGUI(PropertyConsumer) instead. You will get a NullPointerException if you use this method without setting the PropertyConsumer in the Inspector.

  Parameters:
    `prefix` - the property prefix for the property consumer. Received from the PropertyConsumer.getPropertyPrefix() method. Properties that start with this prefix will have the prefix removed from the display, so the GUI will only show the actual property name.
    `props` - the properties received from the PropertyConsumer.getProperties() method.
    `info` - the properties received from the PropertyConsumer.getPropertyInfo() method, containing descriptions and any specific PropertyEditors that should be used for a particular property named in the PropertyConsumer.getProperties() properties.
  Returns:
    JComponent, a panel holding the interface to set the properties.

### actionPerformed

    public void actionPerformed(java.awt.event.ActionEvent e)

  Implement the ActionListener interface. The actions registering here should be generated by the two buttons in the Inspector GUI.

  Specified by:
    `actionPerformed` in interface `java.awt.event.ActionListener`

### collectAndSetProperties

    public void collectAndSetProperties()

  Tells the Inspector to collect the properties from the editors and set them on its PropertyConsumer.

### collectProperties

    public java.util.Properties collectProperties()

  Extracts properties from textfield[].

### setPrint

    public void setPrint(boolean p)

### getPrint

    public boolean getPrint()

### getWindowSupport

    public WindowSupport getWindowSupport()

### main

    public static void main(java.lang.String[] args)

  test cases.

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details