Package com.iizigo.term.internal
Class HotSpot
java.lang.Object
com.iizigo.term.internal.HotSpot
- Direct Known Subclasses:
Hyperlink
,KeyHotSpot
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
Constructor Summary
Method Summary
Modifier and TypeMethodDescriptionabstract 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
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
hashCode()
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
Called when a new hot spot has been instantiated.Performs parsing of the line just updated on the host screen.void
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).
Field Details
x
public int xThe X position of the line where this hot spot is located in character count.width
public int widthThe width of the hot spot in characters.text
The text of the hot spot, null if not yet set.active
protected boolean activeIs this hot spot active?
Constructor Details
HotSpot
public HotSpot()
Method Details
equals
Checks if one hot spot is equal to another.hashCode
public int hashCode()Gets the hash code.initialize
Performs initialization from the setup data.parse
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
Checks if a hot spot is found. If it is, the position returned should be directly after the new hot spot.onCreate
Called when a new hot spot has been instantiated.addHotSpot
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
Gets the background for drawing on the screen of the hot spot.setTextColor
Sets the color to use for the text (character) using g.setColor(nnn).postPaint
Post-painting the character of the hot spot.activate
Called when the hot spot is activated.