Class HotSpot

java.lang.Object
com.iizigo.term.internal.HotSpot
Direct Known Subclasses:
Hyperlink, KeyHotSpot

public abstract class HotSpot extends Object
Abstract class that is used to parse data of a line on the screen to create hot spots such as function keys (or other send keys) and links. Extending classes provides a way to parse a line on the screen and if a hot spot is found, call "addHotSpot" to create a new hot spot. This will create a new instance of the same class as the extending class.

This abstract class handles both parsing and identifying hot spots of a certain type as well as the actual drawing of them on screen and when they are activated (performing a function).

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
    Is this hot spot active?
    The text of the hot spot, null if not yet set.
    int
    The width of the hot spot in characters.
    int
    The X position of the line where this hot spot is located in character count.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    Called when the hot spot is activated.
    protected char[]
    addHotSpot(HotSpot hs, char[] line, List<HotSpot> hotSpots, int x, int width)
    Adds a new hot spot of this same class (but a new instance) to the list.
    abstract int
    check(char[] line, List<HotSpot> hotSpots, int begin, int end)
    Checks if a hot spot is found.
    abstract boolean
    continueChecking(char[] line, char ch, int begin, int end)
    Checks if it is OK to keep on checking.
    boolean
    Checks if one hot spot is equal to another.
    void
    fillCharBackground(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
    Gets the background for drawing on the screen of the hot spot.
    int
    Gets the hash code.
    abstract void
    initialize(String setup, boolean active)
    Performs initialization from the setup data.
    final boolean
    isInside(int xPos)
    Checks if a position is inside the hot spot.
    void
    onCreate(HotSpot parent)
    Called when a new hot spot has been instantiated.
    final List<HotSpot>
    parse(char[] line, List<HotSpot> hotSpots)
    Performs parsing of the line just updated on the host screen.
    void
    postPaint(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
    Post-painting the character of the hot spot.
    void
    setTextColor(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
    Sets the color to use for the text (character) using g.setColor(nnn).

    Methods inherited from class java.lang.Object

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

    • x

      public int x
      The X position of the line where this hot spot is located in character count.
    • width

      public int width
      The width of the hot spot in characters.
    • text

      public String text
      The text of the hot spot, null if not yet set.
    • active

      protected boolean active
      Is this hot spot active?
  • Constructor Details

    • HotSpot

      public HotSpot()
  • Method Details

    • equals

      public boolean equals(Object o)
      Checks if one hot spot is equal to another.
      Overrides:
      equals in class Object
      Returns:
      The equality flag not taking into account the active sstate.
    • hashCode

      public int hashCode()
      Gets the hash code.
      Overrides:
      hashCode in class Object
      Returns:
      The hash code.
    • initialize

      public abstract void initialize(String setup, boolean active)
      Performs initialization from the setup data.
    • parse

      public final List<HotSpot> parse(char[] line, List<HotSpot> hotSpots)
      Performs parsing of the line just updated on the host screen. If this hot spot is successful, it should clear the data with the zero character. This method returns the same "hostSpots" list if there is no change, otherwise a new list.
    • continueChecking

      public abstract boolean continueChecking(char[] line, char ch, int begin, int end)
      Checks if it is OK to keep on checking.
    • check

      public abstract int check(char[] line, List<HotSpot> hotSpots, int begin, int end)
      Checks if a hot spot is found. If it is, the position returned should be directly after the new hot spot.
    • onCreate

      public void onCreate(HotSpot parent)
      Called when a new hot spot has been instantiated.
    • addHotSpot

      protected char[] addHotSpot(HotSpot hs, char[] line, List<HotSpot> hotSpots, int x, int width)
      Adds a new hot spot of this same class (but a new instance) to the list.
    • isInside

      public final boolean isInside(int xPos)
      Checks if a position is inside the hot spot.
    • fillCharBackground

      public void fillCharBackground(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
      Gets the background for drawing on the screen of the hot spot.
    • setTextColor

      public void setTextColor(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
      Sets the color to use for the text (character) using g.setColor(nnn).
    • postPaint

      public void postPaint(Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
      Post-painting the character of the hot spot.
    • activate

      public abstract void activate(TerminalWindow tw)
      Called when the hot spot is activated.