com.bbn.openmap.graphicLoader
Class AbstractGraphicLoader

java.lang.Object
  extended by com.bbn.openmap.MapHandlerChild
      extended by com.bbn.openmap.OMComponent
          extended by com.bbn.openmap.graphicLoader.AbstractGraphicLoader
All Implemented Interfaces:
GraphicLoader, LightMapHandlerChild, PropertyConsumer, java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener
Direct Known Subclasses:
MMLGraphicLoader

public abstract class AbstractGraphicLoader
extends OMComponent
implements GraphicLoader, java.awt.event.ActionListener

The abstract AbstractGraphicLoader class is an OMGraphic managing object. It can talk to any source it wants to for configuring its OMGraphicList, and then notifies its OMGraphicHandler with the changes. The AbstractGraphicLoader comes with a built-in timer, in case you want to check back with the graphic source within certain intervals in order to update the graphics in an animated fashion. This class also extends MapHandlerChild so if you want to add it to the MapHandler to find other objects, you can override the findAndInit() method.

This object is really intended to be used with the GraphicLoaderPlugIn, but it doesn't really have to be. If you have a GraphicLoaderConnector in the MapHandler and then add a GraphicLoader to the MapHandler, the GraphicLoaderConnector will check to see if the GraphicLoader has a receiver. If there isn't a receiver, the GraphicLoaderConnetor will create a GraphicLoaderPlugIn for you, connect the GraphicLoader to it, and then add the GraphicLoaderPlugIn to the LayerHandler. Then, the GraphicLoader will have its graphics on the map.


Field Summary
protected  int DO_NOT_UPDATE_TIMER
           
protected  java.lang.String name
           
static java.lang.String NameProperty
           
protected  Projection proj
           
protected  OMGraphicHandler receiver
           
protected  javax.swing.Timer timer
           
static java.lang.String TimerCmd
           
protected  int updateInterval
          The delay between timer pulses, in milliseconds.
 
Fields inherited from class com.bbn.openmap.OMComponent
i18n, propertyPrefix
 
Fields inherited from class com.bbn.openmap.MapHandlerChild
beanContextChildSupport, isolated
 
Fields inherited from interface com.bbn.openmap.PropertyConsumer
EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty
 
Constructor Summary
AbstractGraphicLoader()
           
AbstractGraphicLoader(OMGraphicHandler receiver)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          Method gets called by the timer if it's running.
 void createTimer()
          Creates a timer with the current updateInterval and calls setTimer().
 java.awt.Component getGUI()
          Provide a GUI for controlling the GraphicLoader.
 java.lang.String getName()
          Return a pretty name for the GUI to let folks know what the loader does.
 Projection getProjection()
           
 java.util.Properties getProperties(java.util.Properties props)
          PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent.
 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.
 OMGraphicHandler getReceiver()
          Get the OMGraphicHandler that will receive OMGraphic updates from the GraphicLoader.
 javax.swing.Timer getTimer()
          Get the timer being used for automatic updates.
 int getUpdateInterval()
           
abstract  void manageGraphics()
          The method where the AbstractGraphicLoader is expected to tell the receiver what the OMGraphics are.
 void setName(java.lang.String name)
           
 void setProjection(Projection p)
          Calls manageGraphics() if projection is different().
 void setProperties(java.lang.String prefix, java.util.Properties props)
          Sets the properties for the OMComponent.
 void setReceiver(OMGraphicHandler r)
          Set the OMGraphicHandler that will receive OMGraphic updates from the GraphicLoader.
 void setTimer(javax.swing.Timer t)
          If you want the layer to update itself at certain intervals, you can set the timer to do that.
 void setUpdateInterval(int delay)
           
 
Methods inherited from class com.bbn.openmap.OMComponent
getPropertyPrefix, setProperties, setPropertyPrefix
 
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
 

Field Detail

timer

protected javax.swing.Timer timer

DO_NOT_UPDATE_TIMER

protected int DO_NOT_UPDATE_TIMER

receiver

protected OMGraphicHandler receiver

proj

protected Projection proj

name

protected java.lang.String name

TimerCmd

public static final java.lang.String TimerCmd
See Also:
Constant Field Values

NameProperty

public static final java.lang.String NameProperty
See Also:
Constant Field Values

updateInterval

protected int updateInterval
The delay between timer pulses, in milliseconds.

Constructor Detail

AbstractGraphicLoader

public AbstractGraphicLoader()

AbstractGraphicLoader

public AbstractGraphicLoader(OMGraphicHandler receiver)
Method Detail

manageGraphics

public abstract void manageGraphics()
The method where the AbstractGraphicLoader is expected to tell the receiver what the OMGraphics are. This gets called by default by the actionPerformed() method, which is called by default by the built-in timer when it is running.

See Also:
OMGraphicHandler.setList(OMGraphicList)

getGUI

public java.awt.Component getGUI()
Provide a GUI for controlling the GraphicLoader. It's OK if it's null.

Specified by:
getGUI in interface GraphicLoader

setProjection

public void setProjection(Projection p)
Calls manageGraphics() if projection is different().

Specified by:
setProjection in interface GraphicLoader

getProjection

public Projection getProjection()

setReceiver

public void setReceiver(OMGraphicHandler r)
Description copied from interface: GraphicLoader
Set the OMGraphicHandler that will receive OMGraphic updates from the GraphicLoader.

Specified by:
setReceiver in interface GraphicLoader

getReceiver

public OMGraphicHandler getReceiver()
Description copied from interface: GraphicLoader
Get the OMGraphicHandler that will receive OMGraphic updates from the GraphicLoader.

Specified by:
getReceiver in interface GraphicLoader

getTimer

public javax.swing.Timer getTimer()
Get the timer being used for automatic updates. May be null if a timer is not set.


setTimer

public void setTimer(javax.swing.Timer t)
If you want the layer to update itself at certain intervals, you can set the timer to do that. Set it to null to disable it. If the current timer is not null, the graphic loader is removed as an ActionListener. If the new one is not null, the graphic loader is added as an ActionListener.


createTimer

public void createTimer()
Creates a timer with the current updateInterval and calls setTimer().


setUpdateInterval

public void setUpdateInterval(int delay)

getUpdateInterval

public int getUpdateInterval()

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
Method gets called by the timer if it's running. Will also get called if any other component is using this class as an ActionListener. By default, calls manageGraphics();

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

getName

public java.lang.String getName()
Return a pretty name for the GUI to let folks know what the loader does.

Specified by:
getName in interface GraphicLoader

setName

public void setName(java.lang.String name)

setProperties

public void setProperties(java.lang.String prefix,
                          java.util.Properties props)
Description copied from class: OMComponent
Sets the properties for the OMComponent.

Specified by:
setProperties in interface PropertyConsumer
Overrides:
setProperties in class OMComponent
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: OMComponent
PropertyConsumer method, to fill in a Properties object, reflecting the current values of the OMComponent. If the component has a propertyPrefix set, the property keys should have that prefix plus a separating '.' prepended to each property key it uses for configuration.

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)
Description copied from class: OMComponent
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.). For Layer, this method should at least return the 'prettyName' property.

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.


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