|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bbn.openmap.MapHandlerChild com.bbn.openmap.OMComponent com.bbn.openmap.layer.location.AbstractLocationHandler com.bbn.openmap.layer.location.db.DBLocationHandler
public class DBLocationHandler
The DBLocationLayer is a LocationHandler designed to let you put data on the map based on information from a Database. The properties file lets you set defaults on whether to draw the locations and the names by default. For crowded layers, having all the names displayed might cause a cluttering problem. In gesture mode, OpenMap will display the name of each location as the mouse is passed over it. Pressing the left mouse button over a location brings up a popup menu that lets you show/hide the name label, and also to display attributes of the location in a Browser window that OpenMap launches.
If you want to extend the functionality of this LocationHandler, there are a couple of methods to focus your changes: The setProperties() method lets you add properties to set from the properties file. The createData() method, by default, is a one-time method that creates the graphic objects based on the data. By modifying these methods, and creating a different combination graphic other than the default LocationDataRecordSet, you can create different layer effects pretty easily.
In the openmap.properties file (for instance):
# In the section for the LocationLayer: locationLayer.locationHandlers=dblocationhandler dblocationhandler.class=com.bbn.openmap.layer.location.db.DBLocationHandler dblocationhandler.locationColor=FF0000 dblocationhandler.nameColor=008C54 dblocationhandler.showNames=false dblocationhandler.showLocations=true dblocationhandler.jdbcDriver=oracle.jdbc.driver.OracleDriver dblocationhandler.jdbcString=jdbc login string dblocationhandler.userName=username dblocationhandler.userPassword=password dblocationhandler.locationQueryString=select statement the data object needs. See each Data object (like LocationData) to see what kind of select statement it needs.In addition, this particular location handler is using the LocationData object to handle the results from the location.
Field Summary | |
---|---|
protected javax.swing.Box |
box
Box used for constructing the palette widgets |
protected java.lang.String |
jdbcDriver
This String would be used to load the driver. |
static java.lang.String |
jdbcDriverProperty
Property to specify jdbc driver to loaded. |
protected java.lang.String |
jdbcString
String that would be used for making a connection to Database |
static java.lang.String |
jdbcStringProperty
Property that should be specified for setting jdbc String |
protected java.lang.String |
locationQueryString
The string used to query the database for the location information. |
static java.lang.String |
locationQueryStringProperty
Property to specify the query string passed to the database. |
protected java.util.Properties |
props
A copy of properties used to construct this Layer |
protected QuadTree |
quadtree
The storage mechanism for the locations. |
protected java.lang.String |
userName
User name to be used for connecting to DB. |
static java.lang.String |
userNameProperty
Property to specify userName for connecting to Database |
protected java.lang.String |
userPassword
Password to be used with for connecting to DB. |
static java.lang.String |
userPasswordProperty
Property to specify password for connecting to Database |
Fields inherited from class com.bbn.openmap.layer.location.AbstractLocationHandler |
---|
i18n, logger, RenderAttributesListProperty, zLayer |
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 | |
---|---|
DBLocationHandler()
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. |
protected QuadTree |
createData()
Look in the database and create the QuadTree holding all the Locations. |
OMGraphicList |
get(double nwLat,
double nwLon,
double seLat,
double seLon,
OMGraphicList graphicList)
Prepares the graphics for the layer. |
java.awt.Component |
getGUI()
Provides the palette widgets to control the options of showing maps, or attribute text. |
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. |
java.lang.String |
getJdbcDriver()
|
java.lang.String |
getJdbcString()
|
java.util.Properties |
getLocationProperties()
|
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 |
getUserName()
|
java.lang.String |
getUserPassword()
|
void |
reloadData()
A trigger function to tell the handler that new data is available. |
void |
setProperties(java.lang.String prefix,
java.util.Properties properties)
The properties and prefix are managed and decoded here, for the standard uses of the DBLocationHandler. |
Methods inherited from class com.bbn.openmap.layer.location.AbstractLocationHandler |
---|
getLayer, getLocationColor, getLocationDrawingAttributes, getNameColor, getNameDrawingAttributes, getPrettyName, getPropertyPrefix, isForceGlobal, isShowLocations, isShowNames, removed, setForceGlobal, setLayer, setLocationColor, setLocationDrawingAttributes, setNameColor, setNameDrawingAttributes, setPrettyName, setProperties, setPropertyPrefix, setShowLocations, setShowNames |
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 |
---|
getLayer, getPrettyName, isForceGlobal, isShowLocations, isShowNames, removed, setForceGlobal, setLayer, setPrettyName, setShowLocations, setShowNames |
Methods inherited from interface com.bbn.openmap.PropertyConsumer |
---|
getPropertyPrefix, setProperties, setPropertyPrefix |
Field Detail |
---|
protected QuadTree quadtree
protected java.lang.String jdbcString
public static final java.lang.String jdbcStringProperty
protected java.lang.String jdbcDriver
public static final java.lang.String jdbcDriverProperty
protected java.lang.String userName
protected java.lang.String userPassword
public static final java.lang.String userNameProperty
public static final java.lang.String userPasswordProperty
public static final java.lang.String locationQueryStringProperty
protected java.lang.String locationQueryString
protected java.util.Properties props
protected javax.swing.Box box
Constructor Detail |
---|
public DBLocationHandler()
Method Detail |
---|
public void setProperties(java.lang.String prefix, java.util.Properties properties)
setProperties
in interface PropertyConsumer
setProperties
in class AbstractLocationHandler
prefix
- string prefix used in the properties file for this layer.properties
- the properties set in the properties file.public java.util.Properties getProperties(java.util.Properties props)
getProperties
in interface PropertyConsumer
getProperties
in class AbstractLocationHandler
props
- a Properties object to load the PropertyConsumer properties
into.
public java.util.Properties getPropertyInfo(java.util.Properties list)
getPropertyInfo
in interface PropertyConsumer
getPropertyInfo
in class AbstractLocationHandler
list
- a Properties object to load the PropertyConsumer properties
into. If getList equals null, then a new Properties object should
be created.
public void reloadData()
LocationHandler
reloadData
in interface LocationHandler
protected QuadTree createData()
public java.lang.String getJdbcString()
public java.lang.String getJdbcDriver()
public java.lang.String getUserName()
public java.lang.String getUserPassword()
public java.util.Properties getLocationProperties()
public OMGraphicList get(double nwLat, double nwLon, double seLat, double seLon, OMGraphicList graphicList)
Occasionally it is necessary to abort a prepare call. When this happens, the map will set the cancel bit in the LayerThread, (the thread that is running the prepare). If this Layer needs to do any cleanups during the abort, it should do so, but return out of the prepare asap.
get
in interface LocationHandler
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.
public java.util.List<java.awt.Component> getItemsForPopupMenu(Location loc)
LocationHandler
getItemsForPopupMenu
in interface LocationHandler
getItemsForPopupMenu
in class AbstractLocationHandler
loc
- Location that items should be provided for.public java.awt.Component getGUI()
getGUI
in interface LocationHandler
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |