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.examples.beanbox
Class SimpleBeanBox

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

All Implemented Interfaces:
  MapMouseListener

public class SimpleBeanBox
extends BeanBox
implements MapMouseListener

SimpleBeanBox is a sample implementation of the `BeanBox`class. SimpleBeanBox manages beans of type SimpleBeanObject.

Constructor Summary
`SimpleBeanBox(SimpleBeanLayer l)`

Method Summary
`void` | `addBean(java.lang.Object bean)` adds the specified bean to SimpleBeanLayer.
`void` | `beanChanged(java.lang.Object bean, java.lang.String changedPropertyName)` this method is a callback method that is called by a `com.bbn.openmap.tools.beanbox.GenericPropertySheet` when the user closes the property sheet.
`boolean` | `containsBean(java.lang.Object bean)` checks if the specified bean is present in SimpleBeanLayer.
`SimpleBeanContainer` | `findEnclosingContainer(LatLonPoint llp)` returns a SimpleBeanContainer bean that contains the specified `LatLonPoint` on the map.
`BeanContainer` | `findEnclosingContainer(java.lang.Object bean)` returns a `BeanContainer` bean that contains the specified bean object.
`java.lang.Object` | `getBeanAtLocation(java.awt.Point pointOnMap)` return bean at specified location giving preference to non-container beans over container beans.
`static SimpleBeanBox` | `getBeanBox()`
`protected java.awt.Image` | `getDragImage(java.lang.Object bean)` returns the image that the cursor is set to when the specified bean is dragged on the map.
`java.lang.String[]` | `getMouseModeServiceList()` Return a list of the modes that are interesting to the MapMouseListener.
`boolean` | `mouseClicked(java.awt.event.MouseEvent evt)` Invoked when the mouse has been clicked on a component.
`boolean` | `mouseDragged(java.awt.event.MouseEvent evt)` Invoked when a mouse button is pressed on a component and then dragged.
`void` | `mouseEntered(java.awt.event.MouseEvent evt)` Invoked when the mouse enters a component.
`void` | `mouseExited(java.awt.event.MouseEvent evt)` Invoked when the mouse exits a component.
`void` | `mouseMoved()` Handle a mouse cursor moving without the button being pressed.
`boolean` | `mouseMoved(java.awt.event.MouseEvent evt)` Invoked when the mouse button has been moved on a component (with no buttons down).
`boolean` | `mousePressed(java.awt.event.MouseEvent evt)` Invoked when a mouse button has been pressed on a component.
`boolean` | `mouseReleased(java.awt.event.MouseEvent evt)` Invoked when a mouse button has been released on a component.
`void` | `relocateBean(java.lang.Object bean, java.beans.BeanInfo beanInfo, java.awt.Point newLocation)` relocates the specified bean to the new location.
`void` | `removeBean(java.lang.Object bean)` removes the specified bean from SimpleBeanLayer.
`void` | `setBeanProperties(java.lang.Object bean, java.beans.BeanInfo beanInfo, java.awt.Point location)` Sets the image associated with the bean using the image present in the BeanInfo.

Methods inherited from class com.bbn.openmap.tools.beanbox.BeanBox
`createPropertySheet, doSpecialHandling, getBeanInfoForBean, prepareForAddition, showCut, showSelected, showUnCut`

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

Constructor Detail

### SimpleBeanBox

    public SimpleBeanBox(SimpleBeanLayer l)

Method Detail

### getBeanBox

    public static SimpleBeanBox getBeanBox()

### getMouseModeServiceList

    public java.lang.String[] getMouseModeServiceList()

  Description copied from interface: `MapMouseListener`
  Return a list of the modes that are interesting to the MapMouseListener. The source MouseEvents will only get sent to the MapMouseListener if the mode is set to one that the listener is interested in. Layers interested in receiving events should register for receiving events in "select" mode: `

       return new String[] { SelectMouseMode.modeID };

  `

  ``
  Specified by:
    `getMouseModeServiceList` in interface `MapMouseListener`
  Returns:
    String[] of modeID's
  See Also:
    `NavMouseMode.modeID`, `SelectMouseMode.modeID`, `NullMouseMode.modeID`

### mousePressed

    public boolean mousePressed(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button has been pressed on a component.

  Specified by:
    `mousePressed` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseReleased

    public boolean mouseReleased(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button has been released on a component.

  Specified by:
    `mouseReleased` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseClicked

    public boolean mouseClicked(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse has been clicked on a component. The listener will receive this event if it successfully processed `mousePressed()`, or if no other listener processes the event. If the listener successfully processes `mouseClicked()`, then it will receive the next `mouseClicked()` notifications that have a click count greater than one.

  NOTE: We have noticed that this method can sometimes be erroneously invoked. It seems to occur when a light-weight AWT component (like an internal window or menu) closes (removes itself from the window hierarchy). A specific OpenMap example is when you make a menu selection when the MenuItem you select is above the MapBean canvas. After making the selection, the mouseClicked() gets invoked on the MouseDelegator, which passes it to the appropriate listeners depending on the MouseMode. The best way to avoid this problem is to not implement anything crucial in this method. Use a combination of `mousePressed()` and `mouseReleased()` instead.

  Specified by:
    `mouseClicked` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseEntered

    public void mouseEntered(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse enters a component.

  Specified by:
    `mouseEntered` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent

### mouseExited

    public void mouseExited(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse exits a component.

  Specified by:
    `mouseExited` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent

### mouseDragged

    public boolean mouseDragged(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when a mouse button is pressed on a component and then dragged. The listener will receive these events if it successfully processes mousePressed(), or if no other listener processes the event.

  Specified by:
    `mouseDragged` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public boolean mouseMoved(java.awt.event.MouseEvent evt)

  Description copied from interface: `MapMouseListener`
  Invoked when the mouse button has been moved on a component (with no buttons down).

  Specified by:
    `mouseMoved` in interface `MapMouseListener`
  Parameters:
    `evt` - MouseEvent
  Returns:
    true if the listener was able to process the event.

### mouseMoved

    public void mouseMoved()

  Description copied from interface: `MapMouseListener`
  Handle a mouse cursor moving without the button being pressed. This event is intended to tell the listener that there was a mouse movement, but that the event was consumed by another layer. This will allow a mouse listener to clean up actions that might have happened because of another motion event response.

  Specified by:
    `mouseMoved` in interface `MapMouseListener`

### addBean

    public void addBean(java.lang.Object bean)

  adds the specified bean to SimpleBeanLayer. This method is called by the `com.bbn.openmap.tools.beanbox.BeanBoxDnDCatcher` class to add the specified bean to a openmap layer.

  Specified by:
    `addBean` in class `BeanBox`
  Throws:
    `an` - IllegalArgumentException if bean is not of type SimpleBeanObject

### removeBean

    public void removeBean(java.lang.Object bean)

  removes the specified bean from SimpleBeanLayer. This method is called by the `com.bbn.openmap.tools.beanbox.BeanBoxDnDCatcher` class to remove the specified bean from a openmap layer.

  Specified by:
    `removeBean` in class `BeanBox`
  Throws:
    `an` - IllegalArgumentException if bean is not of type SimpleBeanObject

### containsBean

    public boolean containsBean(java.lang.Object bean)

  checks if the specified bean is present in SimpleBeanLayer. returns true if present, false otherwise.

  Specified by:
    `containsBean` in class `BeanBox`
  Throws:
    `an` - IllegalArgumentException if bean is not of type SimpleBeanObject

### setBeanProperties

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

  Sets the image associated with the bean using the image present in the BeanInfo. Also sets the bean's location. This method is called by the `com.bbn.openmap.tools.beanbox.BeanBoxDnDCatcher` class to set the bean's properties before it is displayed in a property sheet prior to adding to an openmap layer.

  Specified by:
    `setBeanProperties` in class `BeanBox`
  Throws:
    `an` - IllegalArgumentException if bean is not of type SimpleBeanObject

### findEnclosingContainer

    public BeanContainer findEnclosingContainer(java.lang.Object bean)

  returns a `BeanContainer` bean that contains the specified bean object.

  Specified by:
    `findEnclosingContainer` in class `BeanBox`
  Returns:
    a BeanContainer object or null if no such container bean is found.
  Throws:
    `an` - IllegalArgumentException if bean is not of type SimpleBeanObject

### findEnclosingContainer

    public SimpleBeanContainer findEnclosingContainer(LatLonPoint llp)

  returns a SimpleBeanContainer bean that contains the specified `LatLonPoint` on the map.

### getBeanAtLocation

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

  return bean at specified location giving preference to non-container beans over container beans. If neither type of bean is found to be close enough to the specified location, a null is returned.

  Specified by:
    `getBeanAtLocation` in class `BeanBox`
  Returns:
    a bean Object or null if no bean is found at the location.

### relocateBean

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

  relocates the specified bean to the new location. This method is called by the `com.bbn.openmap.tools.beanbox.BeanBoxDnDCatcher` whenever the user moves a bean on the map within the same openmap layer.

  Specified by:
    `relocateBean` in class `BeanBox`
  Throws:
    `java.lang.IllegalArgumentException` - is specified bean is not of type SimpleBeanObject.

### beanChanged

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

  this method is a callback method that is called by a `com.bbn.openmap.tools.beanbox.GenericPropertySheet` when the user closes the property sheet.

  Specified by:
    `beanChanged` in class `BeanBox`

### getDragImage

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

  returns the image that the cursor is set to when the specified bean is dragged on the map.

  Overrides:
    `getDragImage` in class `BeanBox`

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