com.bbn.openmap.plugin
Class PlugInLayer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by com.bbn.openmap.Layer
                  extended by com.bbn.openmap.layer.OMGraphicHandlerLayer
                      extended by com.bbn.openmap.plugin.PlugInLayer
All Implemented Interfaces:
ProjectionListener, GestureResponsePolicy, OMGraphicHandler, ProjectionPainter, PropertyConsumer, java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.io.Serializable, java.util.EventListener

public class PlugInLayer
extends OMGraphicHandlerLayer

The PlugInLayer is a kind of layer that has a direct interface with the MapBean. The Layer contains a handle to a PlugIn object, which is, in effect, a module that knows how to respond to geographical requests for information, and can create graphics to be drawn.

The PlugInLayer has a standard interface to the PlugIn module object, and knows to call certain PlugIn methods to respond to Layer methods. It also knows about the OMGraphicsList that is part of the PlugIn, and when graphical objects are to be rendered, it tells the plugin's OMGraphicsList to render the object using a Graphics that the Layer provides.

 
 #Properties for basic PlugInLayer:
 pluginlayer.class=com.bbn.openmap.plugin.PlugInLayer
 pluginlayer.prettyName=PRETTY NAME
 pluginlayer.plugin=classname of plugin
 #.... followed by plugin properties with the "pluginlayer" prefix...
 
 

See Also:
Serialized Form

Nested Class Summary
 
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
protected  MapMouseListener mml
          The MapMouseListener for the layer/plugin combo that knows how to respond to mouse events.
protected  PlugIn plugin
          The handle to the PlugIn object.
protected  java.lang.String plugInClass
          This string is the deciding factor in how independent the PlugIn gets to be with respect to PropertyConsumer methods.
static java.lang.String PlugInProperty
          If the PlugInLayer creates the PlugIn, it will append ".plugin" to the properties prefix it will send to PlugIn.setProperties().
 
Fields inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
consumeEvents, ConsumeEventsProperty, filter, interruptable, InterruptableProperty, layerWorker, LAYERWORKER_LOCK, layerWorkerQueue, logger, mouseEventInterpreter, mouseModeIDs, MouseModesProperty, projectionChangePolicy, ProjectionChangePolicyProperty, renderPolicy, RenderPolicyProperty, selectedList, TransparencyProperty
 
Fields inherited from class com.bbn.openmap.Layer
addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, coordTransform, DataPathPrefixProperty, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, localHackList, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, readyToPaint, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, TransformProperty, 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
PlugInLayer()
          The default constructor for the Layer.
 
Method Summary
 void addPlugInToBeanContext(PlugIn pi)
          Gets the current BeanContext from itself, if it's been set and the provided PlugIn wants/can be added to the BeanContext, it will be added..
 void dispose()
          Overrides Layer.dispose(), makes sure the OMGraphicList is cleared.
 boolean getAddToBeanContext()
          Layer method, enhanced to check if the PlugIn is interested in being added to the BeanContext.
 OMGraphicList getGraphicList()
          Deprecated. call getList() instead.
 java.awt.Component getGUI()
          Checks the PlugIn to see if it has a GUI.
 MapMouseListener getMapMouseListener()
          Returns the MapMouseListener object that handles the mouse events.
 PlugIn getPlugIn()
          Returns the plugin module of the layer.
 java.util.Properties getProperties(java.util.Properties props)
          Overrides Layer getProperties method., also calls that method on Layer.
 java.util.Properties getPropertyInfo(java.util.Properties props)
          Overrides Layer getProperties method., also calls that method on Layer.
 OMGraphicList prepare()
          Prepares the graphics for the layer.
 void removed(java.awt.Container container)
          Layer method that gets called when the Layer gets removed from the map.
 void removePlugInFromBeanContext(PlugIn pi)
          Gets the current BeanContext from itself, if it's been set and the provided PlugIn wants/can be added to the BeanContext, it assumes it was and removes it from the BeanContext.
 void setBeanContext(java.beans.beancontext.BeanContext in_bc)
          Method for BeanContextChild interface.
 void setGraphicList(OMGraphicList aList)
          Deprecated. call setList() instead.
 void setMapMouseListener(MapMouseListener mmlIn)
          Set the MapMouseListener for the layer.
 void setPlugIn(PlugIn aPlugIn)
          Sets the plugin module of the layer.
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Set the properties for the PlugIn Layer.
 void setPropertyPrefix(java.lang.String prefix)
          Set the property key prefix that should be used by the PropertyConsumer.
 
Methods inherited from class com.bbn.openmap.layer.OMGraphicHandlerLayer
actionPerformed, canSetList, copy, createLayerWorker, cut, deselect, doAction, doPrepare, filter, filter, filter, getConsumeEvents, getDefaultSettingsPanel, getFilter, getInfoText, getItemsForMapMenu, getItemsForOMGraphicMenu, getLayerWorker, getList, getMouseEventInterpreter, getMouseModeIDsForEvents, getProjectionChangePolicy, getRedrawButton, getRenderPolicy, getSelected, getSettingsButton, getToolTipTextFor, getTransparency, getTransparencyAdjustmentPanel, highlight, isCancelled, isHighlightable, isInterruptable, isSelectable, isWorking, leftClick, mouseOver, paint, paste, projectionChanged, receivesMapEvents, renderDataForProjection, resetFiltering, select, setConsumeEvents, setFilter, setInterruptable, setLayerWorker, setList, setMouseEventInterpreter, setMouseModeIDsForEvents, setProjectionChangePolicy, setRenderPolicy, setTransparency, supportsSQL, unhighlight, workerComplete
 
Methods inherited from class com.bbn.openmap.Layer
addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, createWindowSupport, disconnectFromBeanContext, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAttribute, getBeanContext, getCoordTransform, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isReadyToPaint, isRemovable, notifyHideHack, prependDataPathPrefix, putAttribute, removeComponentListener, removeConfirmed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, resetPalette, setAddAsBackground, setAddToBeanContext, setAutoPalette, setCoordTransform, setIcon, setLayerProperties, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setReadyToPaint, setRemovable, setVisible, setWindowSupport, showPalette
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, 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, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, 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, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, 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, 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, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.beans.beancontext.BeanContextChild
addPropertyChangeListener, removePropertyChangeListener
 

Field Detail

PlugInProperty

public static final java.lang.String PlugInProperty
If the PlugInLayer creates the PlugIn, it will append ".plugin" to the properties prefix it will send to PlugIn.setProperties(). So, the PlugIn properties should look like layerPrefix.plugin.pluginPropertyName=value.

NOTE: This is different than when a PlugIn is created as a component by the ComponentFactory called by the PropertyHandler. If the PropertyHandler calls the ComponentFactory, then the properties should look like pluginComponentPrefix.pluginProperty=value.

See Also:
Constant Field Values

plugin

protected transient PlugIn plugin
The handle to the PlugIn object.


mml

protected MapMouseListener mml
The MapMouseListener for the layer/plugin combo that knows how to respond to mouse events.


plugInClass

protected java.lang.String plugInClass
This string is the deciding factor in how independent the PlugIn gets to be with respect to PropertyConsumer methods.

Constructor Detail

PlugInLayer

public PlugInLayer()
The default constructor for the Layer. All of the attributes are set to their default values.

Method Detail

removed

public void removed(java.awt.Container container)
Layer method that gets called when the Layer gets removed from the map.

Overrides:
removed in class Layer
Parameters:
container - Container

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Set the properties for the PlugIn Layer.

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

getProperties

public java.util.Properties getProperties(java.util.Properties props)
Description copied from class: OMGraphicHandlerLayer
Overrides Layer getProperties method., also calls that method on Layer. Sets the properties from the policy objects used by this OMGraphicHandler layer.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMGraphicHandlerLayer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If props equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

getPropertyInfo

public java.util.Properties getPropertyInfo(java.util.Properties props)
Description copied from class: OMGraphicHandlerLayer
Overrides Layer getProperties method., also calls that method on Layer. Sets the properties from the policy objects used by this OMGraphicHandler layer.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMGraphicHandlerLayer
Parameters:
props - a Properties object to load the PropertyConsumer properties into. If getList equals null, then a new Properties object should be created.
Returns:
Properties object containing PropertyConsumer property values. If getList was not null, this should equal getList. Otherwise, it should be the Properties object created by the PropertyConsumer.

setPropertyPrefix

public void setPropertyPrefix(java.lang.String prefix)
Set the property key prefix that should be used by the PropertyConsumer. The prefix, along with a '.', should be prepended to the property keys known by the PropertyConsumer.

Specified by:
setPropertyPrefix in interface PropertyConsumer
Overrides:
setPropertyPrefix in class Layer
Parameters:
prefix - the prefix String.

dispose

public void dispose()
Description copied from class: OMGraphicHandlerLayer
Overrides Layer.dispose(), makes sure the OMGraphicList is cleared.

Overrides:
dispose in class OMGraphicHandlerLayer

setGraphicList

public void setGraphicList(OMGraphicList aList)
Deprecated. call setList() instead.

Sets the current graphics list to the given list.

Parameters:
aList - a list of OMGraphics

getGraphicList

public OMGraphicList getGraphicList()
Deprecated. call getList() instead.

Retrieves the current graphics list.


getPlugIn

public PlugIn getPlugIn()
Returns the plugin module of the layer.


setPlugIn

public void setPlugIn(PlugIn aPlugIn)
Sets the plugin module of the layer. This method also calls setLayer on the plugin, and gets the MapMouseListener from the plugin, too.


getMapMouseListener

public MapMouseListener getMapMouseListener()
Returns the MapMouseListener object that handles the mouse events.

Overrides:
getMapMouseListener in class OMGraphicHandlerLayer
Returns:
the MapMouseListener for the layer, or null if none

setMapMouseListener

public void setMapMouseListener(MapMouseListener mmlIn)
Set the MapMouseListener for the layer.

Parameters:
mmlIn - the object that will handle the mouse events for the layer.

prepare

public OMGraphicList prepare()
Prepares the graphics for the layer. This is where the getRectangle() method call is made on the plugin. This is called by the PulgInWorker, or can be called from a different thread than the AWT thread. If you're not sure, call doPrepare() instead, and a separate thread will be launched to call this.

Overrides:
prepare in class OMGraphicHandlerLayer
Returns:
new OMGraphicList filled by plugin.

getGUI

public java.awt.Component getGUI()
Checks the PlugIn to see if it has a GUI. Returns null if the PlugIn doesn't exist.

Overrides:
getGUI in class Layer
Returns:
java.awt.Component or null, null by default.

getAddToBeanContext

public boolean getAddToBeanContext()
Layer method, enhanced to check if the PlugIn is interested in being added to the BeanContext.

Overrides:
getAddToBeanContext in class Layer

setBeanContext

public void setBeanContext(java.beans.beancontext.BeanContext in_bc)
                    throws java.beans.PropertyVetoException
Method for BeanContextChild interface.

Specified by:
setBeanContext in interface java.beans.beancontext.BeanContextChild
Overrides:
setBeanContext in class Layer
Throws:
java.beans.PropertyVetoException

addPlugInToBeanContext

public void addPlugInToBeanContext(PlugIn pi)
Gets the current BeanContext from itself, if it's been set and the provided PlugIn wants/can be added to the BeanContext, it will be added..


removePlugInFromBeanContext

public void removePlugInFromBeanContext(PlugIn pi)
Gets the current BeanContext from itself, if it's been set and the provided PlugIn wants/can be added to the BeanContext, it assumes it was and removes it from the BeanContext.



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