com.bbn.openmap.layer.location
Class BasicLocationHandler

java.lang.Object
  extended bycom.bbn.openmap.layer.location.BasicLocationHandler
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, LocationHandler, PropertyConsumer

public class BasicLocationHandler
extends java.lang.Object
implements LocationHandler, java.awt.event.ActionListener

A basic location handler, that just returns simple testing locations.


Field Summary
protected  javax.swing.Box box
           
protected  java.awt.Color[] colors
           
protected  LocationLayer layer
          The parent layer.
protected  java.lang.String propertyPrefix
          PropertyConsumer propery prefix.
 
Fields inherited from interface com.bbn.openmap.layer.location.LocationHandler
defaultLocationColorString, defaultNameColorString, forceGlobalCommand, ForceGlobalProperty, LocationColorProperty, LocationPropertyPrefix, NameColorProperty, NamePropertyPrefix, readDataCommand, showdetails, showLocationsCommand, ShowLocationsProperty, showname, showNamesCommand, ShowNamesProperty
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
BasicLocationHandler()
          The default constructor for the Layer.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          The Action Listener method, that reacts to the palette widgets actions.
 void fillLocationPopUpMenu(LocationPopupMenu locMenu)
          The location layer passes a LocationPopupMenu to the handler when on of its locations has been clicked on.
 java.util.Vector get(float nwLat, float nwLon, float seLat, float seLon, java.util.Vector graphicList)
          Fill a vector of OMGraphics to represent the data from this handler.
 java.awt.Component getGUI()
          Provides the palette widgets to control the options of showing maps, or attribute text.
 LocationLayer getLayer()
          Get the layer the handler is serving.
 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 reloadData()
          A trigger function to tell the handler that new data is available.
 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 this handler is serving.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

layer

protected LocationLayer layer
The parent layer.


propertyPrefix

protected java.lang.String propertyPrefix
PropertyConsumer propery prefix.


colors

protected java.awt.Color[] colors

box

protected javax.swing.Box box
Constructor Detail

BasicLocationHandler

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

Method Detail

setLayer

public void setLayer(LocationLayer l)
Set the layer this handler is serving.

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

reloadData

public void reloadData()
Description copied from interface: LocationHandler
A trigger function to tell the handler that new data is available.

Specified by:
reloadData in interface LocationHandler

isShowNames

public boolean isShowNames()
Description copied from interface: LocationHandler
See if the handler is displaying labels at a global level.

Specified by:
isShowNames in interface LocationHandler

setShowNames

public void setShowNames(boolean set)
Description copied from interface: LocationHandler
Set the handler to show/hide labels at a global level.

Specified by:
setShowNames in interface LocationHandler

isShowLocations

public boolean isShowLocations()
Description copied from interface: LocationHandler
See if the handler is displaying location graphics at a global level.

Specified by:
isShowLocations in interface LocationHandler

setShowLocations

public void setShowLocations(boolean set)
Description copied from interface: LocationHandler
Set the handler to show/hide location graphics at a global level.

Specified by:
setShowLocations in interface LocationHandler

isForceGlobal

public boolean isForceGlobal()
Description copied from interface: LocationHandler
Find out whether global settings should override local ones.

Specified by:
isForceGlobal in interface LocationHandler

setForceGlobal

public void setForceGlobal(boolean set)
Description copied from interface: LocationHandler
Set whether global settings should override local ones.

Specified by:
setForceGlobal in interface LocationHandler

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.

get

public java.util.Vector get(float nwLat,
                            float nwLon,
                            float seLat,
                            float seLon,
                            java.util.Vector graphicList)
Description copied from interface: LocationHandler
Fill a vector of OMGraphics to represent the data from this handler.

Specified by:
get in interface LocationHandler
Parameters:
nwLat - NorthWest latitude of area of interest.
nwLon - NorthWest longitude of area of interest.
seLat - SouthEast latitude of area of interest.
seLon - SouthEast longitude of area of interest.
graphicList - Vector to add Locations to. If null, the LocationHandler should create a new Vector to place graphics into.
Returns:
Either the Vector passed in, or the new onw that was created.

fillLocationPopUpMenu

public void fillLocationPopUpMenu(LocationPopupMenu locMenu)
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:
fillLocationPopUpMenu in interface LocationHandler
Parameters:
locMenu - LocationPopupMenu to add buttons to.

getGUI

public java.awt.Component getGUI()
Provides the palette widgets to control the options of showing maps, or attribute text.

Specified by:
getGUI in interface LocationHandler
Returns:
Component object representing the palette widgets.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
The Action Listener method, that reacts to the palette widgets actions.

Specified by:
actionPerformed in interface java.awt.event.ActionListener

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
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
Parameters:
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.
properties - a Properties object that the PropertyConsumer can use to retrieve expected properties it can use for configuration.

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 propery 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
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
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
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
Returns:
thre property prefix


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