public abstract class AbstractPlugIn extends java.lang.Object implements PlugIn, PropertyConsumer, MapMouseListener
PlugInLayer
,
PlugIn
Modifier and Type | Field and Description |
---|---|
protected boolean |
addToBeanContext
Flag to denote whether the plugin should be added to the bean context
(MapHandler).
|
protected java.awt.Component |
component
The parent component, usually the PlugInLayer.
|
I18n |
i18n
Internationalization
|
protected MapMouseListener |
mml
The object handling mouse events for the plugin.
|
protected java.lang.String |
name
The pretty name for a plugin, if it was set in the properties.
|
protected java.lang.String |
prefix
The prefix for the plugin's properties.
|
protected boolean |
removable
Flag to designate the layer as removable or not.
|
static java.lang.String |
RemovableProperty
Property 'removable' to designate this layer as removable from the
application, or able to be deleted.
|
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
Constructor and Description |
---|
AbstractPlugIn() |
AbstractPlugIn(java.awt.Component comp) |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Notification to the PlugIn that it has been removed from the application,
so it can disconnect from all other objects that may be holding a
reference to it.
|
void |
doPrepare()
Checks to see if the parent component is a PlugInLayer, and calls
doPrepare() on it if it is.
|
boolean |
getAddToBeanContext() |
java.awt.Component |
getComponent()
Get the component that this plugin uses as a grip to the map.
|
java.awt.Component |
getGUI()
Gives the PlugIn a chance to present components that control its
attributes.
|
MapMouseListener |
getMapMouseListener()
Returns the MapMouseListener that the plugin thinks should be used.
|
java.lang.String[] |
getMouseModeServiceList()
Return a list of the modes that are interesting to the MapMouseListener.
|
java.lang.String |
getName()
Get the pretty name of the plugin, which is really the pretty name of the
parent component if it's set.
|
java.util.Properties |
getProperties(java.util.Properties getList)
Method to fill in a Properties object, reflecting the current values of
the PropertyConsumer.
|
java.util.Properties |
getPropertyInfo(java.util.Properties list)
Method to fill in a Properties object with values reflecting the
properties able to be set on this PropertyConsumer.
|
java.lang.String |
getPropertyPrefix()
Get the property key prefix that is being used to prepend to the property
keys for Properties lookups.
|
abstract OMGraphicList |
getRectangle(Projection p)
The getRectangle call is the main call into the PlugIn module.
|
boolean |
isRemovable()
Check to see if the plugin (and layer) is marked as one that can be
removed from an application.
|
boolean |
mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a component.
|
boolean |
mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a component and then dragged.
|
void |
mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a component.
|
void |
mouseExited(java.awt.event.MouseEvent e)
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 e)
Invoked when the mouse button has been moved on a component (with no
buttons down).
|
boolean |
mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a component.
|
boolean |
mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a component.
|
void |
removed()
Method that gets called when the PlugInLayer has been removed from the
map, so the PlugIn can free up resources.
|
void |
repaint()
Call repaint on the parent component.
|
void |
setAddToBeanContext(boolean value) |
void |
setComponent(java.awt.Component comp)
Set the component that this PlugIn uses as a grip to the map.
|
void |
setMapMouseListener(MapMouseListener mml)
Set the MapMouseListener for this PlugIn.
|
void |
setName(java.lang.String name)
Set the name of the plugin.
|
void |
setProperties(java.util.Properties setList)
Method to set the properties in the PropertyConsumer.
|
void |
setProperties(java.lang.String prefix,
java.util.Properties setList)
Method to set the properties in the PropertyConsumer.
|
void |
setPropertyPrefix(java.lang.String prefix)
Set the property key prefix that should be used by the PropertyConsumer.
|
void |
setRemovable(boolean set)
Mark the plugin (and layer) as removable, or one that can be deleted from
the application.
|
public static final java.lang.String RemovableProperty
protected boolean removable
protected java.awt.Component component
protected java.lang.String prefix
protected java.lang.String name
protected MapMouseListener mml
protected boolean addToBeanContext
public I18n i18n
public AbstractPlugIn()
public AbstractPlugIn(java.awt.Component comp)
public void setName(java.lang.String name)
public java.lang.String getName()
public void setComponent(java.awt.Component comp)
setComponent
in interface PlugIn
public java.awt.Component getComponent()
getComponent
in interface PlugIn
public void repaint()
public void doPrepare()
public void setMapMouseListener(MapMouseListener mml)
setMapMouseListener
in interface PlugIn
mml
- MapMouseListener.MapMouseListener
public MapMouseListener getMapMouseListener()
getMapMouseListener
in interface PlugIn
MapMouseListener
public abstract OMGraphicList getRectangle(Projection p)
getRectangle
in interface PlugIn
p
- projection of the screen, holding scale, center coords, height,
width. May be null if the parent component hasn't been given a
projection.Projection
,
OMGraphicList
public java.awt.Component getGUI()
PlugIn
public void setAddToBeanContext(boolean value)
public boolean getAddToBeanContext()
public void setRemovable(boolean set)
public boolean isRemovable()
public void setProperties(java.util.Properties setList)
setProperties
in interface PropertyConsumer
setList
- a properties object that the PropertyConsumer can use to
retrieve expected properties it can use for configuration.public void setProperties(java.lang.String prefix, java.util.Properties setList)
setProperties
in interface PropertyConsumer
prefix
- a String used by the PropertyConsumer to prepend to each
property value it wants to look up -
setList.getProperty(prefix.propertyKey). If the prefix had already
been set, then the prefix passed in should replace that previous
value.setList
- a Properties object that the PropertyConsumer can use to
retrieve expected properties it can use for configuration.public java.util.Properties getProperties(java.util.Properties getList)
getProperties
in interface PropertyConsumer
getList
- a Properties object to load the PropertyConsumer
properties into. If getList equals null, then a new Properties
object should be created.public java.util.Properties getPropertyInfo(java.util.Properties list)
getPropertyInfo
in interface PropertyConsumer
list
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.public void setPropertyPrefix(java.lang.String prefix)
setPropertyPrefix
in interface PropertyConsumer
prefix
- the prefix String.public java.lang.String getPropertyPrefix()
getPropertyPrefix
in interface PropertyConsumer
public java.lang.String[] getMouseModeServiceList()
return new String[] { SelectMouseMode.modeID };
getMouseModeServiceList
in interface MapMouseListener
NavMouseMode.modeID
,
SelectMouseMode.modeID
,
NullMouseMode.modeID
public boolean mousePressed(java.awt.event.MouseEvent e)
mousePressed
in interface MapMouseListener
e
- MouseEventpublic boolean mouseReleased(java.awt.event.MouseEvent e)
mouseReleased
in interface MapMouseListener
e
- MouseEventpublic boolean mouseClicked(java.awt.event.MouseEvent e)
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.
mouseClicked
in interface MapMouseListener
e
- MouseEventpublic void mouseEntered(java.awt.event.MouseEvent e)
mouseEntered
in interface MapMouseListener
e
- MouseEventpublic void mouseExited(java.awt.event.MouseEvent e)
mouseExited
in interface MapMouseListener
e
- MouseEventpublic boolean mouseDragged(java.awt.event.MouseEvent e)
mouseDragged
in interface MapMouseListener
e
- MouseEventpublic boolean mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface MapMouseListener
e
- MouseEventpublic void mouseMoved()
mouseMoved
in interface MapMouseListener
public void removed()
Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details