Package jexer.bits

Class CellAttributes

  • Direct Known Subclasses:
    Cell

    public class CellAttributes
    extends java.lang.Object
    The 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
      boolean equals​(java.lang.Object rhs)
      Comparison check.
      int getAnimations()
      Getter for animation flags.
      Color getBackColor()
      Getter for backColor.
      int getBackColorRGB()
      Getter for backColor RGB.
      Color getForeColor()
      Getter for foreColor.
      int getForeColorPulseRGB​(Backend backend, long pulseTimeMillis)
      Get the current pulsed RGB value for foreColor.
      int getForeColorRGB()
      Getter for foreColor RGB.
      int getPulseColorRGB()
      Getter for pulse color RGB.
      int hashCode()
      Hashcode uses all fields in equals().
      boolean isBlink()
      Getter for blink.
      boolean isBold()
      Getter for bold.
      boolean isProtect()
      Getter for protect.
      boolean isPulse()
      Getter for animation pulse.
      boolean isReverse()
      Getter for reverse.
      boolean isRGB()
      See if this cell uses RGB or ANSI colors.
      boolean isUnderline()
      Getter for underline.
      void reset()
      Set to default: white foreground on black background, no bold/underline/blink/rever/protect.
      void setAnimations​(int animationFlags)
      Setter for animations.
      void setBackColor​(Color backColor)
      Setter for backColor.
      void setBackColorRGB​(int backColorRGB)
      Setter for backColor RGB.
      void setBlink​(boolean blink)
      Setter for blink.
      void setBold​(boolean bold)
      Setter for bold.
      void setForeColor​(Color foreColor)
      Setter for foreColor.
      void setForeColorRGB​(int foreColorRGB)
      Setter for foreColor RGB.
      void setProtect​(boolean protect)
      Setter for protect.
      void setPulse​(boolean pulse, boolean fast, int offset)
      Setter for animation pulse.
      void setPulseColorRGB​(int pulseColorRGB)
      Setter for pulse color RGB.
      void setReverse​(boolean reverse)
      Setter for reverse.
      void setTo​(java.lang.Object rhs)
      Set my field values to that's field.
      void setUnderline​(boolean underline)
      Setter for underline.
      java.lang.String toHtml()
      Convert these cell attributes into the style attributes of an HTML <font> tag.
      java.lang.String toString()
      Make human-readable description of this CellAttributes.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 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 color
        pulseTimeMillis - 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:
        equals in class java.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:
        hashCode in class java.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:
        toString in class java.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 value
        fast - if true, fast pulse
        offset - 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