Class AttentionAlert

java.lang.Object
java.util.Observable
org.ka2ddo.yaac.gui.AttentionAlert
All Implemented Interfaces:
ActionListener, Serializable, EventListener

public class AttentionAlert extends Observable implements ActionListener, Serializable
This class displays a flashing set of pointers on the map, indicating some location deserves special attention. It can be used for emergency messages, identifying the position of a station on the map, or other purposes.

The flashing is on a 75% duty cycle (75% on, 25% off) until the alert times out. Then the flasher is dequeued.

Author:
Andrew Pavlin, KA2DDO
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    This constant specifies the flash interval in milliseconds.
    static final Color
    This constant specifies the color used to identify stations sending emergency traffic.
    static final Color
    This constant specifies the color used for locate pointer arrows.
    static final Color
    This constant specifies the color used to identify stations sending priority traffic.
    static final Color
    This constant specifies the color used to identify stations sending special traffic.
    static final Color
    This constant specifies the color used for weather alert arrows.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AttentionAlert(double lat, double lon, Color fillColor)
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows with a lifespan of 10 flashes.
    AttentionAlert(double lat, double lon, Color fillColor, int numFlashes)
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
    AttentionAlert(double lat, double lon, Color fillColor, int numFlashes, int flashIntervalMsec)
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows with a lifespan of 10 flashes.
    AttentionAlert(StationState ss, Color fillColor, int numFlashes)
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
    AttentionAlert(StationState ss, Color fillColor, int numFlashes, int flashIntervalMsec)
    Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    DO NOT CALL: callback for timer events on AttentionAlert.
    void
    Stop displaying an AttentionAlert on the map.
    boolean
    Test if this AttentionAlert is the same as some other object.
    get(double lat, double lon, AX25Message.Precedence precedence)
    If the precedence level reports location flashers, create an AttentionAlert flasher at the specified map coordinates using the default color for the specified precedence to render the arrows with a lifespan of 30 flashes at double speed.
    Get the precedence (if known) for this AttentionAlert.
    static Color
    Get the color that should be used to identify messages or stations of the specified precedence.
    int
    Returns a hash code value for the object.
    boolean
    Indicate whether this AttentionAlert is still active (i.e., not timed out).
    boolean
    Indicate whether the AttentionAlert is in the "on" part of its flashing cycle.
    void
    setWasAutoCenter(boolean wasAutoCenter)
    Specify what the Auto-Center Map option setting was before this AttentionAlert was activated.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_FLASH_INTERVAL

      public static final int DEFAULT_FLASH_INTERVAL
      This constant specifies the flash interval in milliseconds.
      See Also:
    • LOCATE_COLOR

      public static final Color LOCATE_COLOR
      This constant specifies the color used for locate pointer arrows.
    • WEATHER_COLOR

      public static final Color WEATHER_COLOR
      This constant specifies the color used for weather alert arrows.
    • SPECIAL_COLOR

      public static final Color SPECIAL_COLOR
      This constant specifies the color used to identify stations sending special traffic.
    • PRIORITY_COLOR

      public static final Color PRIORITY_COLOR
      This constant specifies the color used to identify stations sending priority traffic.
    • EMERGENCY_COLOR

      public static final Color EMERGENCY_COLOR
      This constant specifies the color used to identify stations sending emergency traffic.
  • Constructor Details

    • AttentionAlert

      public AttentionAlert(double lat, double lon, Color fillColor)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows with a lifespan of 10 flashes.
      Parameters:
      lat - latitude in degrees North
      lon - longitude in degrees East
      fillColor - java.awt.Color used to fill the flashing arrow symbols
    • AttentionAlert

      public AttentionAlert(double lat, double lon, Color fillColor, int numFlashes)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
      Parameters:
      lat - latitude in degrees North
      lon - longitude in degrees East
      fillColor - java.awt.Paint used to fill the flashing arrow symbols
      numFlashes - the number of times the arrows should flash before the alert is taken down
    • AttentionAlert

      public AttentionAlert(double lat, double lon, Color fillColor, int numFlashes, int flashIntervalMsec)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
      Parameters:
      lat - latitude in degrees North
      lon - longitude in degrees East
      fillColor - java.awt.Color used to fill the flashing arrow symbols
      numFlashes - the number of times the arrows should flash before the alert is taken down
      flashIntervalMsec - the time period between flashes in milliseconds
    • AttentionAlert

      public AttentionAlert(StationState ss, Color fillColor)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows with a lifespan of 10 flashes.
      Parameters:
      ss - the StationState providing the rendering position
      fillColor - java.awt.Color used to fill the flashing arrow symbols
    • AttentionAlert

      public AttentionAlert(StationState ss, Color fillColor, int numFlashes)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
      Parameters:
      ss - the StationState providing the rendering position
      fillColor - java.awt.Color used to fill the flashing arrow symbols
      numFlashes - the number of times the arrows should flash before the alert is taken down
    • AttentionAlert

      public AttentionAlert(StationState ss, Color fillColor, int numFlashes, int flashIntervalMsec)
      Establish an AttentionAlert flasher at the specified map coordinates using the specified paint pattern to render the arrows.
      Parameters:
      ss - the StationState providing the rendering position
      fillColor - java.awt.Color used to fill the flashing arrow symbols
      numFlashes - the number of times the arrows should flash before the alert is taken down
      flashIntervalMsec - the time period between flashes in milliseconds
  • Method Details

    • get

      public static AttentionAlert get(double lat, double lon, AX25Message.Precedence precedence)
      If the precedence level reports location flashers, create an AttentionAlert flasher at the specified map coordinates using the default color for the specified precedence to render the arrows with a lifespan of 30 flashes at double speed.
      Parameters:
      lat - latitude in degrees North
      lon - longitude in degrees East
      precedence - AX25Message.Precedence to specify coloring
      Returns:
      AttentionAlert if one should be created, or null if this precedence level doesn't get alarms
    • setWasAutoCenter

      public void setWasAutoCenter(boolean wasAutoCenter)
      Specify what the Auto-Center Map option setting was before this AttentionAlert was activated.
      Parameters:
      wasAutoCenter - boolean true if Auto-Center Map was set
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      DO NOT CALL: callback for timer events on AttentionAlert.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      e - ActionEvent identifying the caller
    • isShown

      public boolean isShown()
      Indicate whether the AttentionAlert is in the "on" part of its flashing cycle.
      Returns:
      boolean true if alert should be painted
    • isActive

      public boolean isActive()
      Indicate whether this AttentionAlert is still active (i.e., not timed out).
      Returns:
      boolean true if alert is still active
    • getPrecedence

      public AX25Message.Precedence getPrecedence()
      Get the precedence (if known) for this AttentionAlert.
      Returns:
      Precedence if known, or null if not
    • cancelAlert

      public void cancelAlert()
      Stop displaying an AttentionAlert on the map.
    • equals

      public boolean equals(Object obj)
      Test if this AttentionAlert is the same as some other object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object to compare
      Returns:
      boolean true if obj is a duplicate AttentionAlert
    • hashCode

      public int hashCode()
      Returns a hash code value for the object.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object.
      See Also:
    • getPrecedenceColor

      public static Color getPrecedenceColor(AX25Message.Precedence precedence)
      Get the color that should be used to identify messages or stations of the specified precedence.
      Parameters:
      precedence - Precedence
      Returns:
      Color corresponding to the Precedence