BeanBox (OpenMap API)
Date: 2016-12-09

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      com.bbn.openmap.tools.beanbox.BeanBox

Direct Known Subclasses:
  SimpleBeanBox

    public abstract class BeanBox

extends java.lang.Object

The BeanBox class manages a set of java beans that are delivered to it from the `BeanPanel`via the `BeanBoxDnDCatcher`. An implementation of this abstract class is expected to be associated with an openmap layer. The abstract BeanBox class performs functions such as adding and removing beans from the associated openmap layer and provides support for moving beans on the layer and cut/copy/paste functionality.

Layer developers wishing to make use of the BeanBox's bean management capabilities should:

- Implement a layer specific version of this abstract class.
- Implement the `BeanBoxHandler`interface in the layer associated with the BeanBox implementation.

An implementation of this class should provide layer specific versions of at least the following abstract base class methods:

- addBean
- removeBean
- containsBean
- setBeanProperties
- getBeanAtLocation
- findEnclosingContainer (should always return null if implementation does not support `BeanContainer`s)
- relocateBean
- beanChanged

Additionally, an implementation of this class can optionally provide layer specific versions of the following base class methods:

- showSelected
- showCut
- showUnCut

Constructor Summary
`BeanBox()` Default constructor initializes the BeanBox.

Method Summary
`abstract void` | `addBean(java.lang.Object bean)` This method is called when a bean is dropped on the layer associated with this BeanBox.
`abstract void` | `beanChanged(java.lang.Object bean, java.lang.String changedPropertyName)` This method is called by a propertysheet whenever a bean property changes.
`abstract boolean` | `containsBean(java.lang.Object bean)` This method is intended to check whether this BeanBox knows about the specified bean.
`protected void` | `createPropertySheet(java.lang.Object bean)` Utility method to create and display a property sheet to show the specified bean's properties.
`protected void` | `doSpecialHandling(java.lang.Object bean)` Checks if the specified bean should be added to a `BeanContainer`.
`abstract BeanContainer` | `findEnclosingContainer(java.lang.Object bean)` Returns a bean contained in the layer that implements the BeanContainer interface and which contains the specified bean.
`abstract java.lang.Object` | `getBeanAtLocation(java.awt.Point pointOnMap)` Returns a bean contained in the layer at the specified map location.
`java.beans.BeanInfo` | `getBeanInfoForBean(java.lang.String beanClassName)` Utility method to obtain the BeanInfo object associated with a bean class that the BeanBox knows about.
`protected java.awt.Image` | `getDragImage(java.lang.Object bean)` Returns the image that the cursor will be set to when the specified bean is dragged over the map.
`protected void` | `prepareForAddition(java.lang.Object bean, java.beans.BeanInfo beanInfo, java.awt.Point location)` This method is called to prepare the bean for addition to the beanbox.
`abstract void` | `relocateBean(java.lang.Object bean, java.beans.BeanInfo beanInfo, java.awt.Point newLocation)` This method is called when a bean is moved from its present location to the newlocation within the layer associated with this BeanBox.
`abstract void` | `removeBean(java.lang.Object bean)` This method is called when a bean is moved from the layer associated with this BeanBox to another layer.
`abstract void` | `setBeanProperties(java.lang.Object bean, java.beans.BeanInfo beanInfo, java.awt.Point location)` This method is called when a bean is dropped on the layer associated with this BeanBox.
`void` | `showCut(java.lang.Object bean)` This method is called when the user 'cuts' a bean, usually as a a result of the clicking on it in a layer and then pressing Ctrl-X.
`void` | `showSelected(java.lang.Object bean)` This method is called when the user selects a bean, usually as a a result of the clicking on it in a layer.
`void` | `showUnCut(java.lang.Object bean)` This method is called when the user cancels a 'cut' operation, usually as a a result of pressing the ESC key.

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

Constructor Detail

### BeanBox

    public BeanBox()

  Default constructor initializes the BeanBox.

Method Detail

### getBeanInfoForBean

    public java.beans.BeanInfo getBeanInfoForBean(java.lang.String beanClassName)

  Utility method to obtain the BeanInfo object associated with a bean class that the BeanBox knows about. Returns a null if none found.

### prepareForAddition

    protected void prepareForAddition(java.lang.Object bean,
                                      java.beans.BeanInfo beanInfo,
                                      java.awt.Point location)

  This method is called to prepare the bean for addition to the beanbox. In the base class implementation, this method calls the abstract setBeanProperties method. It then displays the property sheet for the bean, thereby giving the user a chance to edit the bean's properties before the bean is added to the beanbox.

### createPropertySheet

    protected void createPropertySheet(java.lang.Object bean)
                                throws java.lang.Exception

  Utility method to create and display a property sheet to show the specified bean's properties.

  Throws:
    `java.lang.Exception`

### doSpecialHandling

    protected void doSpecialHandling(java.lang.Object bean)

  Checks if the specified bean should be added to a `BeanContainer`.

### getDragImage

    protected java.awt.Image getDragImage(java.lang.Object bean)

  Returns the image that the cursor will be set to when the specified bean is dragged over the map. Default implementation returns the image contained in the BeanInfo for the bean, or the default BeanPanel image if no image is found in the BeanInfo.

### showSelected

    public void showSelected(java.lang.Object bean)

  This method is called when the user selects a bean, usually as a a result of the clicking on it in a layer. An implementation of this class can override this method to highlight the selected bean using a mechanism specific to the openmap layer associated with that BeanBox. Base class method does nothing.

### showCut

    public void showCut(java.lang.Object bean)

  This method is called when the user 'cuts' a bean, usually as a a result of the clicking on it in a layer and then pressing Ctrl-X. An implementation of this class can override this method to highlight the selected bean using a mechanism specific to the openmap layer associated with that BeanBox. Base class method does nothing.

### showUnCut

    public void showUnCut(java.lang.Object bean)

  This method is called when the user cancels a 'cut' operation, usually as a a result of pressing the ESC key. An implementation of this class can override this method to remove any highlights on the bean marked for cutting. Base class method does nothing.

### addBean

    public abstract void addBean(java.lang.Object bean)

  This method is called when a bean is dropped on the layer associated with this BeanBox.

### removeBean

    public abstract void removeBean(java.lang.Object bean)

  This method is called when a bean is moved from the layer associated with this BeanBox to another layer.

### containsBean

    public abstract boolean containsBean(java.lang.Object bean)

  This method is intended to check whether this BeanBox knows about the specified bean.

### setBeanProperties

    public abstract void setBeanProperties(java.lang.Object bean,
                                           java.beans.BeanInfo beanInfo,
                                           java.awt.Point location)

  This method is called when a bean is dropped on the layer associated with this BeanBox. This method gives a chance to set the dropped bean's properties based on the information in its BeanInfo and the drop location. The called to addBean follows this call in the drop sequence.

### getBeanAtLocation

    public abstract java.lang.Object getBeanAtLocation(java.awt.Point pointOnMap)

  Returns a bean contained in the layer at the specified map location.

  Returns:
    a bean Object or null if no bean is found at the location.

### findEnclosingContainer

    public abstract BeanContainer findEnclosingContainer(java.lang.Object bean)

  Returns a bean contained in the layer that implements the BeanContainer interface and which contains the specified bean.

  Returns:
    a BeanContainer object or null if no such container bean is found.

### relocateBean

    public abstract void relocateBean(java.lang.Object bean,
                                      java.beans.BeanInfo beanInfo,
                                      java.awt.Point newLocation)

  This method is called when a bean is moved from its present location to the newlocation within the layer associated with this BeanBox.

### beanChanged

    public abstract void beanChanged(java.lang.Object bean,
                                     java.lang.String changedPropertyName)

  This method is called by a propertysheet whenever a bean property changes. It is intended to provide a place for the layer developer to update the layer if required.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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