## com.bbn.openmap.layer.location
Class TimerLocationLayer

    java.lang.Object
      java.awt.Component
          java.awt.Container
              javax.swing.JComponent
                  com.bbn.openmap.Layer
                      com.bbn.openmap.layer.location.LocationLayer
                          com.bbn.openmap.layer.location.TimerLocationLayer

All Implemented Interfaces:
  java.awt.event.ActionListener, java.beans.beancontext.BeanContextChild, java.beans.beancontext.BeanContextMembershipListener, java.util.EventListener, java.awt.image.ImageObserver, MapMouseListener, java.awt.MenuContainer, ProjectionListener, ProjectionPainter, PropertyConsumer, java.io.Serializable

public class TimerLocationLayer
extends LocationLayer

The TimerLocationLayer is a LocationLayer that has a timer to automatically relod data at specified interval. The properties for this layer are the same as a LocationLayer, with the addition of two:

      # Specify the interval (milliseconds) for the timer. Default is 10 seconds.
      layer.updateTimerInterval=10000
      # Auto-start/stop the timer when the layer is part of the Default
      # is true.  There is a control to start/stop the timer on the
      # palette.
      layer.automaticTimer=true;

See Also:
  Serialized Form

Nested Class Summary

Nested classes inherited from class javax.swing.JComponent
`javax.swing.JComponent.AccessibleJComponent`

Nested classes inherited from class java.awt.Container
`java.awt.Container.AccessibleAWTContainer`

Nested classes inherited from class java.awt.Component
`java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy`

Field Summary
`protected boolean` `autoTimer` Flag to note whether file reloading should only happen when the layer is visible.
`protected javax.swing.JCheckBox` `autoTimerButton`
`static java.lang.String` `AutoTimerProperty` automaticTimer
`protected javax.swing.Timer` `timer` Reloading timer.
`protected javax.swing.JCheckBox` `timerButton`
`protected int` `updateInterval` The delay between timer pulses, in milliseconds.
`static java.lang.String` `UpdateTimerIntervalProperty` updateTimerInterval

Fields inherited from class com.bbn.openmap.layer.location.LocationLayer
`allowPartials, AllowPartialsProperty, backgroundMenu, box, cancel, cancelled, currentWorker, dataHandlerNames, dataHandlers, declutterMatrix, DeclutterMatrixClassProperty, LocationHandlerListProperty, locMenu, map, omGraphics, recenter, useDeclutterMatrix, UseDeclutterMatrixProperty`

Fields inherited from class com.bbn.openmap.Layer

`addAsBackground, AddAsBackgroundProperty, addToBeanContext, AddToBeanContextProperty, attributes, autoPalette, AutoPaletteProperty, beanContextChildSupport, DisplayPaletteCmd, DisplayPropertiesCmd, doHack, HidePaletteCmd, i18n, IDListeners, localHackList, lsListeners, maxScale, MaxScaleProperty, minScale, MinScaleProperty, palette, paletteListener, PrettyNameProperty, propertyPrefix, RedrawCmd, removable, RemovableProperty, SWING_PACKAGE, windowSupport`

Fields inherited from class javax.swing.JComponent
`accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

Fields inherited from class java.awt.Component
`BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

Fields inherited from interface com.bbn.openmap.PropertyConsumer
`EditorProperty, initPropertiesProperty, LabelEditorProperty, ScopedEditorProperty`

Fields inherited from interface java.awt.image.ImageObserver
`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

Constructor Summary
`TimerLocationLayer()` The default constructor for the Layer.

Method Summary
`void` `createTimer()` Creates a timer with the current updateInterval and calls setTimer().
`boolean` `getAutoTimer()`
`java.awt.Component` `getGUI()` Provides the palette widgets to control the options of showing maps, or attribute text.
`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.
`javax.swing.Timer` `getTimer()` Get the timer being used for automatic updates.
`int` `getUpdateInterval()`
`void` `projectionChanged(ProjectionEvent e)` The projectionListener interface method that lets the Layer know when the projection has changes, and therefore new graphics have to created /supplied for the screen.
`void` `removed(java.awt.Container cont)` This method is called after the layer is removed from the MapBean and when the projection changes.
`void` `setAutoTimer(boolean value)` Sets whether the timer should automatically be turned on and off when the layer is added and removed from the map.
`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 LocationLayer.
`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)` Set how often the timer calls timerPing.
`void` `timerPing()` What to do when the timer goes off.
`protected void` `updateTimerButton()` Enable the timer button if there is a timer, check it on if the timer is running.

Methods inherited from class com.bbn.openmap.layer.location.LocationLayer

`createWindowSupport, doPrepare, findClosestLocation, getDeclutterMatrix, getGraphicList, getLocationHandlerNames, getLocationHandlers, getMapMouseListener, getMouseModeServiceList, getUseDeclutterMatrix, isCancelled, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseMoved, mousePressed, mouseReleased, paint, prepare, reloadData, renderDataForProjection, resetPalette, setCancelled, setDeclutterMatrix, setGraphicList, setLocationHandlerNames, setLocationHandlers, setLocationHandlers, setUseDeclutterMatrix, showLocationPopup, showMapPopup, workerComplete`

Methods inherited from class com.bbn.openmap.Layer

`actionPerformed, addComponentListener, added, addInfoDisplayListener, addLayerStatusListener, addMouseListener, addVetoableChangeListener, childrenAdded, childrenRemoved, clearListeners, connectToBeanContext, finalize, findAndInit, findAndInit, findAndUndo, fireHideToolTip, firePaletteEvent, fireRequestBrowserContent, fireRequestBrowserContent, fireRequestCursor, fireRequestInfoLine, fireRequestInfoLine, fireRequestInfoLine, fireRequestMessage, fireRequestMessage, fireRequestToolTip, fireRequestToolTip, fireRequestURL, fireRequestURL, fireStatusUpdate, fireStatusUpdate, fireVetoableChange, getAddAsBackground, getAddToBeanContext, getAttribute, getBeanContext, getIcon, getMaxScale, getMinScale, getPackage, getPalette, getProjection, getPropertyPrefix, getWindowSupport, hasGUI, hidePalette, isAutoPalette, isProjectionOK, isRemovable, notifyHideHack, putAttribute, removeComponentListener, removeConfirmed, removeInfoDisplayListener, removeLayerStatusListener, removeVetoableChangeListener, repaint, setAddAsBackground, setAddToBeanContext, setAutoPalette, setBeanContext, setIcon, setMaxScale, setMinScale, setName, setPaletteVisible, setProjection, setProjection, setProperties, setPropertyPrefix, setRemovable, setVisible, setWindowSupport, showPalette`

Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update, updateUI`

Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree`

Methods inherited from class java.awt.Component

`action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle`

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.beans.beancontext.BeanContextChild
`addPropertyChangeListener, removePropertyChangeListener`

Field Detail

### timer

    protected javax.swing.Timer timer

  Reloading timer.

### UpdateTimerIntervalProperty

    public static final java.lang.String UpdateTimerIntervalProperty

  updateTimerInterval

  See Also:
    Constant Field Values

### AutoTimerProperty

    public static final java.lang.String AutoTimerProperty

  automaticTimer

  See Also:
    Constant Field Values

### autoTimer

    protected boolean autoTimer

  Flag to note whether file reloading should only happen when the layer is visible. True by default.

### timerButton

    protected javax.swing.JCheckBox timerButton

### autoTimerButton

    protected javax.swing.JCheckBox autoTimerButton

### updateInterval

    protected int updateInterval

  The delay between timer pulses, in milliseconds. Default is 10 seconds.

Constructor Detail

### TimerLocationLayer

    public TimerLocationLayer()

  The default constructor for the Layer. All of the attributes are set to their default values.

Method Detail

### projectionChanged

    public void projectionChanged(ProjectionEvent e)

  Description copied from class: `LocationLayer`
  The projectionListener interface method that lets the Layer know when the projection has changes, and therefore new graphics have to created /supplied for the screen.

  Specified by:
    `projectionChanged` in interface `ProjectionListener`
  Overrides:
    `projectionChanged` in class `LocationLayer`
  Parameters:
    `e` - The projection event, most likely fired from a map bean.

### removed

    public void removed(java.awt.Container cont)

  This method is called after the layer is removed from the MapBean and when the projection changes. If the autoTimer is set, the timer is stopped.

  Overrides:
    `removed` in class `LocationLayer`

### getGUI

    public java.awt.Component getGUI()

  Provides the palette widgets to control the options of showing maps, or attribute text.

  Overrides:
    `getGUI` in class `LocationLayer`
  Returns:
    Component object representing the palette widgets.

### setProperties

    public 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 LocationLayer.

  Specified by:
    `setProperties` in interface `PropertyConsumer`
  Overrides:
    `setProperties` in class `LocationLayer`
  Parameters:
    `prefix` - string prefix used in the properties file for this layer.
    `properties` - the properties set in the properties file.

### 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.

  Specified by:
    `getProperties` in interface `PropertyConsumer`
  Overrides:
    `getProperties` in class `LocationLayer`
  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.). For Layer, this method should at least return the 'prettyName' property.

  Specified by:
    `getPropertyInfo` in interface `PropertyConsumer`
  Overrides:
    `getPropertyInfo` in class `LocationLayer`
  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.

### setAutoTimer

    public void setAutoTimer(boolean value)

  Sets whether the timer should automatically be turned on and off when the layer is added and removed from the map.

  If the layer is not visible, the timer may be started or stopped when this method is called. If the autoTimer is turned off, and the layer has received a projection before, the timer is turned on. If the autoTimer is on, the timer will be stopped.

### getAutoTimer

    public boolean getAutoTimer()

### 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.

### timerPing

    public void timerPing()

  What to do when the timer goes off.

### createTimer

    public void createTimer()

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

### setUpdateInterval

    public void setUpdateInterval(int delay)

  Set how often the timer calls timerPing. If less than or equal to zero, the timer will be stopped, but the interval will not be affected.

### getUpdateInterval

    public int getUpdateInterval()

### updateTimerButton

    protected void updateTimerButton()

  Enable the timer button if there is a timer, check it on if the timer is running.

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