## com.bbn.openmap.tools.beanbox
Class BeanPanel

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  javax.swing.JPanel
                      com.bbn.openmap.gui.OMComponentPanel
                          com.bbn.openmap.gui.OMToolComponent
                              com.bbn.openmap.tools.beanbox.BeanPanel

All Implemented Interfaces:
  javax.accessibility.Accessible, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, java.awt.image.ImageObserver, LightMapHandlerChild, java.awt.MenuContainer, PropertyConsumer, java.io.Serializable, Tool

public class BeanPanel
extends OMToolComponent
implements java.io.Serializable

The BeanPanel class is an openmap component that loads a set of java bean classes upon startup and organizes them into one or more tabbed panes. The organization of the tabs is specified in the openmap properties file (see below). A bean loaded by the BeanPanel is represented using information available in the BeanInfo. The BeanPanel tries to represent the bean as an icon followed by the bean's pretty name. It gets the (32 x 32 pixels size) color icon from the BeanInfo and it gets the bean's pretty name from the BeanDescriptor defined in the BeanInfo. If no icon is available, the default bluebean.gif icon included in this package is used. If no pretty name is available, the last portion of the bean's fully qualified class name is used to represent the bean's name.

The BeanPanel uses Java Drag-And-Drop and is registered as the DragSource for Drag-And-Drop events. A user can drag and drop a bean from one of the tabs in the BeanPanel onto the map where the `BeanBoxDnDCatcher`catches the bean.

The following are the properties that the BeanPanel reads from the openmap properties file:

      #------------------------------
      # Properties for BeanPanel
      #------------------------------
      # This property should reflect the paths to the directories
      # containing the bean jars, separated by a space.
      beanpanel.beans.path=g:/path-one/jars h:/path-two/lib

      # This property should reflect the logical names of tabs in the BeanPanel,
      # separated by a space. The order in which the tabs are specified in this
      property is the order in which they appear in the BeanPanel
      beanpanel.tabs=tab1 tab2

      # for each tab specified in the beanpabel.tabs property, the following
      # two properties should respectively reflect the pretty name of the tab and
      # the class names of the beans that should appear in the tab. Class names should
      # be separated by spaces.
      beanpanel.tab1.name=tab1-pretty-name
      beanpanel.tab1.beans=fully-qualified-bean-class-name fully-qualified-bean-class-name ...
      beanpanel.tab2.name=tab2-pretty-name
      beanpanel.tab2.beans=fully-qualified-bean-class-name fully-qualified-bean-class-name ...

      #-------------------------------------
      # End of properties for BeanPanel
      #-------------------------------------

      The BeanPanel looks for beanInfos in the same package as the associated
      bean as well as in the Introspector's search path. The Introspector's
      search path can be augmented by specifying a comma separated list of
      package names in the bean.infos.path system (-D) property.

      A BeanPanel can also be created and used as a standalone class, i.e. independent
      of the openmap components architecture by using the BeanPanel constructor that
      takes a Properties object as an argument. This constructor creates and initializes
      a BeanPanel object from properties in the Properties object. The format of the
      properties is the same as the one specified in the openmap properties file.

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JPanel
`javax.swing.JPanel.AccessibleJPanel`

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`static javax.swing.ImageIcon` `defaultBeanIcon` Default icon for representating a bean
`static java.lang.String` `defaultKey` Default key for the BeanPanel Tool.

Fields inherited from class com.bbn.openmap.gui.OMToolComponent
`c, gridbag, key, useAsTool, UseAsToolProperty`

Fields inherited from class com.bbn.openmap.gui.OMComponentPanel
`beanContextChildSupport, i18n, propertyPrefix, windowSupport`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`BeanPanel()` Constructs the BeanPanel component, creates a DragSource and DragSourceListener objects and registers itself as the source of Java drag events.
`BeanPanel(java.util.Properties props)` This constructor does everything that the default constructor does and in addition initializes the BeanPanel's properties from the Properties object and initializes the BeanPanel GUI.

Method Summary
`void` `findAndInit(java.lang.Object someObj)` Called when the BeanPanel is added the BeanContext, or when another object is added to the BeanContext after the LayerHandler has been added.
`void` `findAndUndo(java.lang.Object someObj)` Called when things are removed from the MapHandler.
`static java.beans.BeanInfo` `findBeanInfo(java.lang.String beanClassName)` Utility method for finding the BeanInfo associated with a bean class name.
`java.awt.Container` `getFace()` Tool interface method.
`static void` `main(java.lang.String[] args)`

Methods inherited from class com.bbn.openmap.gui.OMToolComponent
`add, createLayout, getGridBagConstraints, getKey, getProperties, getPropertyInfo, getUseAsTool, setKey, setProperties, setUseAsTool`

Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
`addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, fireVetoableChange, getBeanContext, getPropertyPrefix, getWindowSupport, removeVetoableChangeListener, setBeanContext, setProperties, setPropertyPrefix, setWindowSupport`

Methods inherited from class javax.swing.JPanel
`getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

Methods inherited from class java.awt.Container

`add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

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

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### defaultBeanIcon

    public static javax.swing.ImageIcon defaultBeanIcon

  Default icon for representating a bean

### defaultKey

    public static final java.lang.String defaultKey

  Default key for the BeanPanel Tool.

  See Also:
    Constant Field Values

Constructor Detail

### BeanPanel

    public BeanPanel()

  Constructs the BeanPanel component, creates a DragSource and DragSourceListener objects and registers itself as the source of Java drag events. Note that this constructor does not initialize the BeanPanel GUI. Instead the GUI is initialized lazily when the user clicks on the 'Face' of this object on the openmap components bar. Thus, this constructor should not be used to create a standalone BeanPanel. Use the parameterized constructor to create a standalone BeanPanel.

### BeanPanel

    public BeanPanel(java.util.Properties props)

  This constructor does everything that the default constructor does and in addition initializes the BeanPanel's properties from the Properties object and initializes the BeanPanel GUI. Use this constructor to create a standalone BeanPanel.

Method Detail

### getFace

    public java.awt.Container getFace()

  Tool interface method. The retrieval tool's interface. This method creates a button that will bring up the BeanPanel.

  Specified by:
    `getFace` in interface `Tool`
  Overrides:
    `getFace` in class `OMToolComponent`
  Returns:
    A container that will contain the 'face' of this panel on the OpenMap ToolPanel.

### findAndUndo

    public void findAndUndo(java.lang.Object someObj)

  Called when things are removed from the MapHandler.

  Specified by:
    `findAndUndo` in interface `LightMapHandlerChild`
  Overrides:
    `findAndUndo` in class `OMComponentPanel`

### findBeanInfo

    public static java.beans.BeanInfo findBeanInfo(java.lang.String beanClassName)

  Utility method for finding the BeanInfo associated with a bean class name. This method first attaches the String "BeanInfo" to the end of the class name and then searches the package of the specified class for the BeanInfo class. If the BeanInfo is not found in the bean class's package, then the method searches for the BeanInfo in the Introspector search path.

  Parameters:
    `beanClassName` - the fully qualified name of the bean class
  Returns:
    an instance of the BeanInfo class for the specified class, if one is found, otherwise null.

### findAndInit

    public void findAndInit(java.lang.Object someObj)

  Called when the BeanPanel is added the BeanContext, or when another object is added to the BeanContext after the LayerHandler has been added. This allows the BeanPanel to keep up-to-date with any objects that it may be interested in, namely, the LayerHandler. If a LayerHandler has already been added, the new LayerHandler will replace it.

  Specified by:
    `findAndInit` in interface `LightMapHandlerChild`
  Overrides:
    `findAndInit` in class `OMComponentPanel`
  Parameters:
    `someObj` - the object being added to the BeanContext.

### main

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

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