Class ProgressIndicatorLayer

  • All Implemented Interfaces:
    Layer, PropertySupport
    Direct Known Subclasses:
    NFEProgressIndicatorLayer

    public class ProgressIndicatorLayer
    extends BasicLayer
    This layer displays a (indeterminate) progress indicator in the center of the map. The default indicator is a clock with spinning hour and minute hands. Typical usage is to call the taskStarted() method when a long running task just started. When the task is either completed or aborted make sure to call the taskCompleted() method. You can call taskStarted() as many times as the number of concurrent long-running tasks. The Progress indicator layer maintains an internal count of running tasks. The spinning clock will disappear only when all long running tasks have completed (or aborted).
    • Constructor Detail

      • ProgressIndicatorLayer

        public ProgressIndicatorLayer​(MapCanvas canvas)
    • Method Detail

      • taskStarted

        public void taskStarted()
        Call this method to display a progress indicator on the map. This is typically called when a long run task has just been started. You must call the corresponding taskCompleted() when the task is either completed or aborted. Failure to do so may result in the indicator being displayed indefinitely on the map.
      • taskCompleted

        public void taskCompleted()
        This method should be called when a task has either completed or aborted.
      • update

        public void update​(long elapsedTime)
        Description copied from interface: Layer
        updates the contents data model or structure.
        Specified by:
        update in interface Layer
        Overrides:
        update in class BasicLayer
        Parameters:
        elapsedTime - The elapsed time since last update.
      • handleEvent

        public boolean handleEvent​(java.util.EventObject evt)
        Description copied from interface: Layer
        The main method that performs event handling for this tool. Returns whether the event should be propagated to other layers down stream (further down the layer stack) after the event has been handled.
        Specified by:
        handleEvent in interface Layer
        Overrides:
        handleEvent in class BasicLayer
      • mapRegionChanged

        public void mapRegionChanged​(MapRegionEvent e)
        Description copied from interface: Layer
        When the associated canvas's map region is changed, this method is called to notify the layer of the change. Note that either a device window change (as a result of resizing the application window) or a data window change can cause this method to be invoked. Query the canvas' MapRegion object to get the changed values. Inside a mapRegionChanged() implementation, the layer typically needs to update its data contents accordingly.
        Specified by:
        mapRegionChanged in interface Layer
        Overrides:
        mapRegionChanged in class BasicLayer
      • render

        public long render​(java.awt.Graphics2D g)
        Description copied from interface: Layer
        Renders the layer contents to the given Graphics.
        Specified by:
        render in interface Layer
        Overrides:
        render in class BasicLayer
        Parameters:
        g - the graphics object
        Returns:
        the rendering time in milliseconds.
      • reset

        public void reset()
        Resets the internal task count to zero. This also makes the indicator disappear (until a new call to the taskStarted method).