Package jexer.bits
Class CellAttributes
- java.lang.Object
-
- jexer.bits.CellAttributes
-
- Direct Known Subclasses:
Cell
public class CellAttributes extends java.lang.ObjectThe attributes used by a Cell: color, bold, blink, etc.
-
-
Constructor Summary
Constructors Constructor Description CellAttributes()Public constructor sets default values of the cell to white-on-black, no bold/blink/reverse/underline/protect.CellAttributes(CellAttributes that)Public constructor makes a copy from another instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object rhs)Comparison check.intgetAnimations()Getter for animation flags.ColorgetBackColor()Getter for backColor.intgetBackColorRGB()Getter for backColor RGB.ColorgetForeColor()Getter for foreColor.intgetForeColorPulseRGB(Backend backend, long pulseTimeMillis)Get the current pulsed RGB value for foreColor.intgetForeColorRGB()Getter for foreColor RGB.intgetPulseColorRGB()Getter for pulse color RGB.inthashCode()Hashcode uses all fields in equals().booleanisBlink()Getter for blink.booleanisBold()Getter for bold.booleanisProtect()Getter for protect.booleanisPulse()Getter for animation pulse.booleanisReverse()Getter for reverse.booleanisRGB()See if this cell uses RGB or ANSI colors.booleanisUnderline()Getter for underline.voidreset()Set to default: white foreground on black background, no bold/underline/blink/rever/protect.voidsetAnimations(int animationFlags)Setter for animations.voidsetBackColor(Color backColor)Setter for backColor.voidsetBackColorRGB(int backColorRGB)Setter for backColor RGB.voidsetBlink(boolean blink)Setter for blink.voidsetBold(boolean bold)Setter for bold.voidsetForeColor(Color foreColor)Setter for foreColor.voidsetForeColorRGB(int foreColorRGB)Setter for foreColor RGB.voidsetProtect(boolean protect)Setter for protect.voidsetPulse(boolean pulse, boolean fast, int offset)Setter for animation pulse.voidsetPulseColorRGB(int pulseColorRGB)Setter for pulse color RGB.voidsetReverse(boolean reverse)Setter for reverse.voidsetTo(java.lang.Object rhs)Set my field values to that's field.voidsetUnderline(boolean underline)Setter for underline.java.lang.StringtoHtml()Convert these cell attributes into the style attributes of an HTML <font> tag.java.lang.StringtoString()Make human-readable description of this CellAttributes.
-
-
-
Constructor Detail
-
CellAttributes
public CellAttributes()
Public constructor sets default values of the cell to white-on-black, no bold/blink/reverse/underline/protect.- See Also:
reset()
-
CellAttributes
public CellAttributes(CellAttributes that)
Public constructor makes a copy from another instance.- Parameters:
that- another CellAttributes instance- See Also:
reset()
-
-
Method Detail
-
isBold
public final boolean isBold()
Getter for bold.- Returns:
- bold value
-
setBold
public final void setBold(boolean bold)
Setter for bold.- Parameters:
bold- new bold value
-
isBlink
public final boolean isBlink()
Getter for blink.- Returns:
- blink value
-
setBlink
public final void setBlink(boolean blink)
Setter for blink.- Parameters:
blink- new blink value
-
isReverse
public final boolean isReverse()
Getter for reverse.- Returns:
- reverse value
-
setReverse
public final void setReverse(boolean reverse)
Setter for reverse.- Parameters:
reverse- new reverse value
-
isUnderline
public final boolean isUnderline()
Getter for underline.- Returns:
- underline value
-
setUnderline
public final void setUnderline(boolean underline)
Setter for underline.- Parameters:
underline- new underline value
-
isProtect
public final boolean isProtect()
Getter for protect.- Returns:
- protect value
-
setProtect
public final void setProtect(boolean protect)
Setter for protect.- Parameters:
protect- new protect value
-
getAnimations
public final int getAnimations()
Getter for animation flags.- Returns:
- animation flags.
-
setAnimations
public final void setAnimations(int animationFlags)
Setter for animations.- Parameters:
animationFlags- new animation flags
-
getForeColor
public final Color getForeColor()
Getter for foreColor.- Returns:
- foreColor value
-
setForeColor
public final void setForeColor(Color foreColor)
Setter for foreColor.- Parameters:
foreColor- new foreColor value
-
getBackColor
public final Color getBackColor()
Getter for backColor.- Returns:
- backColor value
-
setBackColor
public final void setBackColor(Color backColor)
Setter for backColor.- Parameters:
backColor- new backColor value
-
getForeColorPulseRGB
public final int getForeColorPulseRGB(Backend backend, long pulseTimeMillis)
Get the current pulsed RGB value for foreColor.- Parameters:
backend- the backend that can obtain the correct ANSI (palette-based) foreground colorpulseTimeMillis- the time to compute the pulse color for in millis- Returns:
- foreColor RGB value at this time slice.
-
getForeColorRGB
public final int getForeColorRGB()
Getter for foreColor RGB. Note that this is always a RGB value, i.e. alpha is 0.- Returns:
- foreColor value. Negative means unset.
-
setForeColorRGB
public final void setForeColorRGB(int foreColorRGB)
Setter for foreColor RGB.- Parameters:
foreColorRGB- new foreColor RGB value
-
getBackColorRGB
public final int getBackColorRGB()
Getter for backColor RGB. Note that this is always a RGB value, i.e. alpha is 0.- Returns:
- backColor value. Negative means unset.
-
setBackColorRGB
public final void setBackColorRGB(int backColorRGB)
Setter for backColor RGB.- Parameters:
backColorRGB- new backColor RGB value
-
isRGB
public final boolean isRGB()
See if this cell uses RGB or ANSI colors.- Returns:
- true if this cell has a RGB color
-
reset
public void reset()
Set to default: white foreground on black background, no bold/underline/blink/rever/protect.
-
equals
public boolean equals(java.lang.Object rhs)
Comparison check. All fields must match to return true.- Overrides:
equalsin classjava.lang.Object- Parameters:
rhs- another CellAttributes instance- Returns:
- true if all fields are equal
-
hashCode
public int hashCode()
Hashcode uses all fields in equals().- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hash
-
setTo
public void setTo(java.lang.Object rhs)
Set my field values to that's field.- Parameters:
rhs- another CellAttributes instance
-
toString
public java.lang.String toString()
Make human-readable description of this CellAttributes.- Overrides:
toStringin classjava.lang.Object- Returns:
- displayable String
-
toHtml
public java.lang.String toHtml()
Convert these cell attributes into the style attributes of an HTML <font> tag.- Returns:
- the HTML string
-
isPulse
public final boolean isPulse()
Getter for animation pulse.- Returns:
- pulse value
-
setPulse
public final void setPulse(boolean pulse, boolean fast, int offset)Setter for animation pulse.- Parameters:
pulse- new pulse valuefast- if true, fast pulseoffset- number of frames (up to 16 for slow, up to 32 for fast) to offset the pulse animation
-
getPulseColorRGB
public final int getPulseColorRGB()
Getter for pulse color RGB.- Returns:
- pulse color RGB value
-
setPulseColorRGB
public final void setPulseColorRGB(int pulseColorRGB)
Setter for pulse color RGB.- Parameters:
pulseColorRGB- new pulse color RGB value
-
-