com.bbn.openmap.layer.location
Class AbstractLocationHandler

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.layer.location.AbstractLocationHandler
All Implemented Interfaces:
LocationHandler, LightMapHandlerChild, PropertyConsumer, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener
Direct Known Subclasses:
BasicLocationHandler, CSVLocationHandler, DBLocationHandler

public abstract class AbstractLocationHandler
extends OMComponent
implements LocationHandler

The AbstractLocationHandler class facilitates the implementation of a LocationHandler by implementing a number of methods. By extending this class, a developer need only implement get(), setProperties(), and reloadData().

 
     locationhandler.location.lineColor=FF0000
     locationhandler.name.lineColor=008C54
     locationhandler.showNames=false
     locationhandler.showLocations=true
     locationhandler.override=true
     
     # optional, can be used if you override createLocation and need access to varying rendering attributes.
     # ra1, ra2 and ra3 would be used as keys in renderAttributes map.  All GraphicAttributes properties are available, not
     # just lineColor.
     
     locationhandler.renderAttributesList=ra1 ra2 ra3
     locationhandler.ra1.lineColor=0xFFFF0000
     locationhandler.ra2.lineColor=0xFF00FF00
     locationhandler.ra3.lineColor=0xFF00FFFF
 
 

Version:
$Revision: 1.10 $ $Date: 2006/02/13 16:54:18 $
Author:
Michael E. Los D530/23448
See Also:
LocationHandler

Field Summary
protected  I18n i18n
          All LocationHandlers have access to an I18n object, which is provided by the Environment.
protected static java.util.logging.Logger logger
           
static java.lang.String RenderAttributesListProperty
          Property for properties to populate the renderAttributes HashMap.
protected  LocationLayer zLayer
          The parent layer.
 
Fields inherited from class com.bbn.openmap.OMComponent
propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.layer.location.LocationHandler
defaultLocationColorString, defaultNameColorString, forceGlobalCommand, ForceGlobalProperty, LocationPropertyPrefix, NamePropertyPrefix, readDataCommand, showdetails, showLocationsCommand, ShowLocationsProperty, showname, showNamesCommand, ShowNamesProperty
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
protected AbstractLocationHandler()
           
 
Method Summary
 java.util.List<java.awt.Component> getItemsForPopupMenu(Location loc)
          The location layer passes a LocationPopupMenu to the handler when on of its locations has been clicked on.
 LocationLayer getLayer()
          Get the layer the handler is serving.
 java.awt.Color getLocationColor()
          Get the color used for the location graphic.
 GraphicAttributes getLocationDrawingAttributes()
           
 java.awt.Color getNameColor()
          Get the color used for the name label.
 GraphicAttributes getNameDrawingAttributes()
           
 java.lang.String getPrettyName()
          Get the GUI pretty name for the data set retrieved by this LocationHandler.
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer.
 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.
 boolean isForceGlobal()
          Find out whether global settings should override local ones.
 boolean isShowLocations()
          See if the handler is displaying location graphics at a global level.
 boolean isShowNames()
          See if the handler is displaying labels at a global level.
 void removed(java.awt.Container cont)
          Called by the LocationLayer when the layer is removed from the map.
 void setForceGlobal(boolean set)
          Set whether global settings should override local ones.
 void setLayer(LocationLayer l)
          Set the layer the handler is responding to.
 void setLocationColor(java.awt.Color lColor)
          Set the color used for the location graphic.
 void setLocationDrawingAttributes(GraphicAttributes lda)
           
 void setNameColor(java.awt.Color nColor)
          Set the color used for the name label.
 void setNameDrawingAttributes(GraphicAttributes nda)
           
 void setPrettyName(java.lang.String prettyName)
          Set the name used in the GUI to represent this data set.
 void setProperties(java.util.Properties props)
          Sets the properties for the handler.
 void setProperties(java.lang.String prefix, java.util.Properties properties)
          Set up the properties of the handler.
 void setPropertyPrefix(java.lang.String prefix)
          Set the property key prefix that should be used by the PropertyConsumer.
 void setShowLocations(boolean set)
          Set the handler to show/hide location graphics at a global level.
 void setShowNames(boolean set)
          Set the handler to show/hide labels at a global level.
 
Methods inherited from class com.bbn.openmap.MapHandlerChild
addPropertyChangeListener, addVetoableChangeListener, childrenAdded, childrenRemoved, findAndInit, findAndInit, findAndUndo, firePropertyChange, fireVetoableChange, getBeanContext, isIsolated, removePropertyChangeListener, removeVetoableChangeListener, setBeanContext, setIsolated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.bbn.openmap.layer.location.LocationHandler
get, getGUI, reloadData
 

Field Detail

logger

protected static java.util.logging.Logger logger

zLayer

protected LocationLayer zLayer
The parent layer.


RenderAttributesListProperty

public static final java.lang.String RenderAttributesListProperty
Property for properties to populate the renderAttributes HashMap. The property should contain a space separated list of keys that will be then used as a prefix for the properties and key for the Map.

See Also:
Constant Field Values

i18n

protected transient I18n i18n
All LocationHandlers have access to an I18n object, which is provided by the Environment.

Constructor Detail

AbstractLocationHandler

protected AbstractLocationHandler()
Method Detail

setLayer

public void setLayer(LocationLayer l)
Set the layer the handler is responding to. This is needed in case the handler has updates that it wants to show, and needs to trigger a repaint. It can also be used to communicate with the information delegator.

Specified by:
setLayer in interface LocationHandler
Parameters:
l - a LocationLayer

getLayer

public LocationLayer getLayer()
Get the layer the handler is serving.

Specified by:
getLayer in interface LocationHandler

isShowNames

public boolean isShowNames()
See if the handler is displaying labels at a global level.

Specified by:
isShowNames in interface LocationHandler

setShowNames

public void setShowNames(boolean set)
Set the handler to show/hide labels at a global level.

Specified by:
setShowNames in interface LocationHandler

isShowLocations

public boolean isShowLocations()
See if the handler is displaying location graphics at a global level.

Specified by:
isShowLocations in interface LocationHandler

setShowLocations

public void setShowLocations(boolean set)
Set the handler to show/hide location graphics at a global level.

Specified by:
setShowLocations in interface LocationHandler

isForceGlobal

public boolean isForceGlobal()
Find out whether global settings should override local ones.

Specified by:
isForceGlobal in interface LocationHandler

setForceGlobal

public void setForceGlobal(boolean set)
Set whether global settings should override local ones.

Specified by:
setForceGlobal in interface LocationHandler

setNameColor

public void setNameColor(java.awt.Color nColor)
Set the color used for the name label.


getNameColor

public java.awt.Color getNameColor()
Get the color used for the name label.


setLocationColor

public void setLocationColor(java.awt.Color lColor)
Set the color used for the location graphic.


getLocationColor

public java.awt.Color getLocationColor()
Get the color used for the location graphic.


getItemsForPopupMenu

public java.util.List<java.awt.Component> getItemsForPopupMenu(Location loc)
Description copied from interface: LocationHandler
The location layer passes a LocationPopupMenu to the handler when on of its locations has been clicked on. This is an opportunity for the handler to add options to the menu that can bring up further information about the location, or to change the appearance of the location.

Specified by:
getItemsForPopupMenu in interface LocationHandler
Parameters:
loc - Location that items should be provided for.

removed

public void removed(java.awt.Container cont)
Called by the LocationLayer when the layer is removed from the map. The LocationHandler should release expensive resources if this is called.

Specified by:
removed in interface LocationHandler
Parameters:
cont - Container being removed from.

setProperties

public void setProperties(java.util.Properties props)
Sets the properties for the handler. This particular method assumes that the marker name is not needed, because all of the contents of this Properties object are to be used for this object, and scoping the properties with a prefix is unnecessary.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
Parameters:
props - the Properties object.

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties properties)
Set up the properties of the handler. Part of the PropertyConsumer interface. Supported properties include:

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

getProperties

public java.util.Properties getProperties(java.util.Properties props)
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the layer. If the layer has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration. This method takes care of the basic LocationHandler parameters, so any LocationHandlers that extend the AbstractLocationHandler should call this method, too, before adding any specific properties.

Specified by:
getProperties in interface PropertyConsumer
Overrides:
getProperties in class OMComponent
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 list)
Method to fill in a Properties object with values reflecting the properties able to be set on this PropertyConsumer. The key for each property should be the raw property name (without a prefix) with a value that is a String that describes what the property key represents, along with any other information about the property that would be helpful (range, default value, etc.). This method takes care of the basic LocationHandler parameters, so any LocationHandlers that extend the AbstractLocationHandler should call this method, too, before adding any specific properties.

Specified by:
getPropertyInfo in interface PropertyConsumer
Overrides:
getPropertyInfo in class OMComponent
Parameters:
list - 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 OMComponent
Parameters:
prefix - the prefix String.

getPropertyPrefix

public java.lang.String getPropertyPrefix()
Get the property key prefix that is being used to prepend to the property keys for Properties lookups.

Specified by:
getPropertyPrefix in interface PropertyConsumer
Overrides:
getPropertyPrefix in class OMComponent
Returns:
the property prefix

getLocationDrawingAttributes

public GraphicAttributes getLocationDrawingAttributes()

setLocationDrawingAttributes

public void setLocationDrawingAttributes(GraphicAttributes lda)

getNameDrawingAttributes

public GraphicAttributes getNameDrawingAttributes()

setNameDrawingAttributes

public void setNameDrawingAttributes(GraphicAttributes nda)

setPrettyName

public void setPrettyName(java.lang.String prettyName)
Set the name used in the GUI to represent this data set.

Specified by:
setPrettyName in interface LocationHandler
Parameters:
prettyName - A GUI pretty name.

getPrettyName

public java.lang.String getPrettyName()
Get the GUI pretty name for the data set retrieved by this LocationHandler.

Specified by:
getPrettyName in interface LocationHandler
Returns:
pretty name for location handler, for GUI use.


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