Package com.iizigo.term.internal
Class HotSpot
- java.lang.Object
- com.iizigo.term.internal.HotSpot
- Direct Known Subclasses:
Hyperlink
,KeyHotSpot
public abstract class HotSpot extends java.lang.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
Constructor Summary
Constructors Constructor Description HotSpot()
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
activate(TerminalWindow tw)
Called when the hot spot is activated.protected char[]
addHotSpot(HotSpot hs, char[] line, java.util.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, java.util.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
equals(java.lang.Object o)
Checks if one hot spot is equal to another.void
fillCharBackground(java.awt.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
hashCode()
Gets the hash code.abstract void
initialize(java.lang.String setup, boolean active)
Performs initialization from the setup data.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.java.util.List<HotSpot>
parse(char[] line, java.util.List<HotSpot> hotSpots)
Performs parsing of the line just updated on the host screen.void
postPaint(java.awt.Graphics g, int xPos, int yPos, int x, int y, int cx, int cy)
Post-painting the character of the hot spot.void
setTextColor(java.awt.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).
Method Detail
equals
public boolean equals(java.lang.Object o)
Checks if one hot spot is equal to another.- Overrides:
equals
in classjava.lang.Object
- Returns:
- The equality flag not taking into account the active sstate.
hashCode
public int hashCode()
Gets the hash code.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code.
initialize
public abstract void initialize(java.lang.String setup, boolean active)
Performs initialization from the setup data.
parse
public final java.util.List<HotSpot> parse(char[] line, java.util.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, java.util.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, java.util.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(java.awt.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(java.awt.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(java.awt.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.