com.bbn.openmap.tools.beanbox
Class BeanPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by com.bbn.openmap.gui.OMComponentPanel
                      extended by com.bbn.openmap.gui.OMToolComponent
                          extended by com.bbn.openmap.tools.beanbox.BeanPanel
All Implemented Interfaces:
Tool, LightMapHandlerChild, PropertyConsumer, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

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 BeanBoxDnDCatchercatches 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/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static javax.swing.ImageIcon defaultBeanIcon
          Default icon for representing 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, isolated, orientation, 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
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)
           
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 
Methods inherited from class com.bbn.openmap.gui.OMToolComponent
add, createLayout, getGridBagConstraints, getKey, getProperties, getPropertyInfo, getUseAsTool, setKey, setUseAsTool
 
Methods inherited from class com.bbn.openmap.gui.OMComponentPanel
addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, fireVetoableChange, getBeanContext, getOrientation, getPropertyPrefix, getWindowSupport, isIsolated, removeVetoableChangeListener, setBeanContext, setIsolated, setOrientation, 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, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, 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, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, 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 com.bbn.openmap.gui.Tool
getOrientation, setOrientation
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

defaultBeanIcon

public static javax.swing.ImageIcon defaultBeanIcon
Default icon for representing 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 stand-alone BeanPanel. Use the parameterized constructor to create a stand-alone 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 stand-alone 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.

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.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponentPanel
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMToolComponent
Parameters:
prefix - the token to prefix the property names
props - the Properties object

main

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


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