Class TextGfxAttr

  • Direct Known Subclasses:
    TextAttr

    public class TextGfxAttr
    extends java.lang.Object
    Describe graphic attributes that apply to text.

    The text graphic attribute object can represent any possible combination of graphic attributes that apply to text (e.g., foreground colour, underline). This object is conceptually similar to the graphic attribute object for text (GfxTextAttr), except that this object can represent a sparse set of attributes.

    Each graphic attribute calue can be set or queried independently. Additionally, each attribute can be flagged as enabled or disabled. When enabled, the corresponding attribute value has meaning. When disabled, the value can be thought of as unknown or irrelevant.

    This object has a large number of accessors, which appear in groups of four, one such group for each attribute. For example, consider the colour attribute. There are two overloads each of Colour() and ColourEnable(). In each overload pair, one sets the value and one retrieves it. In other words, one Colour() overload returns the current colour value and one sets it, and one ColourEnable() overload returns the enabled state and one sets it. Enabled flags are all Boolean, with TRUE indicating the value is enabled. Setting an attribute value in a TextGfxAttr object (e.g., by second Colour() overload) automatically enables it. Enabling a value (e.g., by second ColourEnable() overload) that has never been set usually sets it to a default value. In rare cases, the uninitialized value may be left disabled.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean anyGfxEnable()
      Query whether any graphic text attribute is enabled.
      GFXColour colour()
      Return the foreground colour value if enabled
      void colour​(GFXColour oNewColour)
      Set and enable the foreground colour value
      GFXColour colourBg()
      Return the background colour value if enabled
      void colourBg​(GFXColour oNewColourBg)
      Set and enable the background colour value
      boolean colourBgEnable()
      Query whether the background colour value is enabled
      void colourBgEnable​(boolean bNewEnable)
      Enable/disable the background colour value
      boolean colourEnable()
      Query whether the foreground colour value is enabled
      void colourEnable​(boolean bNewEnable)
      Enable/disable the foreground colour value
      void copyFrom​(TextGfxAttr oSource)
      Replace all attributes with those from the source object.
      boolean equals​(java.lang.Object object)
      Equality comparison operator.
      GFXTextAttr getGfxTextAttr()
      Query the collected graphic text attributes
      boolean gfxTextAttrEnable()
      Query whether the graphic text attributes are complete
      GFXGraphicContext graphicContext()
      Return the graphic context associated with this text attribute object.
      void graphicContext​(GFXGraphicContext poGraphicContext)
      Set a new graphic context for this text attribute object.
      boolean graphicContextEnable()
      Query whether the graphic context attribute is enabled.
      void graphicContextEnable​(boolean bNewEnable)
      Enable/disable graphic context for this text attribute object.
      int hashCode()  
      boolean notEqual​(TextGfxAttr oCompare)
      Inequality comparison operator.
      int overline()
      Return the overline value if enabled
      void overline​(int eNewOverline)
      Set and enable the overline value
      boolean overlineEnable()
      Query whether the overline value is enabled
      void overlineEnable​(boolean bNewEnable)
      Enable/disable the overline value
      void setGfxTextAttrDefault​(boolean bDefault)
      Fill the text graphic attribute holder with default values.
      int shade()
      Return the shade level if enabled
      void shade​(int lNewShade)
      Set and enable the shade level
      boolean shadeEnable()
      Query whether the shade level is enabled
      void shadeEnable​(boolean bNewEnable)
      Enable/disable the shade level
      int shadeScale()
      Return the shade scale value if enabled
      void shadeScale​(int lNewShadeScale)
      Set and enable the shade scale value
      boolean shadeScaleEnable()
      Query whether the shade scale value is enabled
      void shadeScaleEnable​(boolean bNewEnable)
      Enable/disable the shade scale value
      int strikeout()
      Return the strikeout value if enabled
      void strikeout​(int eNewStrikeout)
      Set and enable the strikeout value
      boolean strikeoutEnable()
      Query whether the strikeout value is enabled
      void strikeoutEnable​(boolean bNewEnable)
      Enable/disable the strikeout value
      int style()
      Return the style value if enabled
      void style​(int eNewStyle)
      Set and enable the style value
      boolean styleEnable()
      Query whether the style value is enabled
      void styleEnable​(boolean bNewEnable)
      Enable/disable the style value
      GFXTextContext textContext()
      Return the graphic text context associated with this text attribute object.
      void textContext​(GFXTextContext poTextContext)
      Set a new graphic text context for this text attribute object.
      boolean textContextEnable()
      Query whether the graphic text context attribute is enabled.
      void textContextEnable​(boolean bNewEnable)
      Enable/disable graphic text context for this text attribute object.
      int underline()
      Return the underline value if enabled
      void underline​(int eNewUnderline)
      Set and enable the underline value
      boolean underlineEnable()
      Query whether the underline value is enabled
      void underlineEnable​(boolean bNewEnable)
      Enable/disable the underline value
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextGfxAttr

        public TextGfxAttr()
        Default constructor.

        Populates the text graphic attribute object with all attributes disabled.

      • TextGfxAttr

        public TextGfxAttr​(TextGfxAttr oSource)
        Copy constructor.

        Copies all attributes and their enabled/disabled status.

        Parameters:
        oSource - - Source attribute object to copy.
    • Method Detail

      • getGfxTextAttr

        public GFXTextAttr getGfxTextAttr()
        Query the collected graphic text attributes
        Returns:
        - The collected graphic text attributes (GfxTextAttr) represented in this object.
      • gfxTextAttrEnable

        public boolean gfxTextAttrEnable()
        Query whether the graphic text attributes are complete
        Returns:
        TRUE if all graphic text attributes are enabled; FALSE if any isn't.
      • anyGfxEnable

        public boolean anyGfxEnable()
        Query whether any graphic text attribute is enabled.
        Returns:
        TRUE if any graphic text attribute is enabled; FALSE if all are disabled.
      • underline

        public int underline()
        Return the underline value if enabled
        Returns:
        Underline value.
      • underline

        public void underline​(int eNewUnderline)
        Set and enable the underline value
        Parameters:
        eNewUnderline - - New underline value.
      • underlineEnable

        public boolean underlineEnable()
        Query whether the underline value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • underlineEnable

        public void underlineEnable​(boolean bNewEnable)
        Enable/disable the underline value
        Parameters:
        bNewEnable - - TRUE if the underline value is to be enabled; FALSE if it is to be disabled.
      • overline

        public int overline()
        Return the overline value if enabled
        Returns:
        Overline value.
      • overline

        public void overline​(int eNewOverline)
        Set and enable the overline value
        Parameters:
        eNewOverline - - New overline value.
      • overlineEnable

        public boolean overlineEnable()
        Query whether the overline value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • overlineEnable

        public void overlineEnable​(boolean bNewEnable)
        Enable/disable the overline value
        Parameters:
        bNewEnable - - TRUE if the overline value is to be enabled; FALSE if it is to be disabled.
      • strikeout

        public int strikeout()
        Return the strikeout value if enabled
        Returns:
        Strikeout value.
      • strikeout

        public void strikeout​(int eNewStrikeout)
        Set and enable the strikeout value
        Parameters:
        eNewStrikeout - - New strikeout value.
      • strikeoutEnable

        public boolean strikeoutEnable()
        Query whether the strikeout value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • strikeoutEnable

        public void strikeoutEnable​(boolean bNewEnable)
        Enable/disable the strikeout value
        Parameters:
        bNewEnable - - TRUE if the strikeout value is to be enabled; FALSE if it is to be disabled.
      • textContext

        public GFXTextContext textContext()
        Return the graphic text context associated with this text attribute object.
        Returns:
        Pointer to the graphic text context. A null pointer is returned if the context has never been set.
      • textContext

        public void textContext​(GFXTextContext poTextContext)
        Set a new graphic text context for this text attribute object.
        Parameters:
        poTextContext - - Pointer to new graphic text context to associate with this text attribute object.
      • textContextEnable

        public boolean textContextEnable()
        Query whether the graphic text context attribute is enabled.
        Returns:
        True if the graphic text context is enabled; false if not. Note that it can be enabled but have a null value.
      • textContextEnable

        public void textContextEnable​(boolean bNewEnable)
        Enable/disable graphic text context for this text attribute object.
        Parameters:
        bNewEnable - - True if the graphic text context is to be enabled; false if it is to be disabled.
      • graphicContext

        public GFXGraphicContext graphicContext()
        Return the graphic context associated with this text attribute object.
        Returns:
        Pointer to the graphic context. A null pointer is returned if the context has never been set.
      • graphicContext

        public void graphicContext​(GFXGraphicContext poGraphicContext)
        Set a new graphic context for this text attribute object.
        Parameters:
        poGraphicContext - - Pointer to new graphic context to associate with this text attribute object.
      • graphicContextEnable

        public boolean graphicContextEnable()
        Query whether the graphic context attribute is enabled.
        Returns:
        True if the graphic context is enabled; false if not. Note that it can be enabled but have a null value.
      • graphicContextEnable

        public void graphicContextEnable​(boolean bNewEnable)
        Enable/disable graphic context for this text attribute object.
        Parameters:
        bNewEnable - - True if the graphic context is to be enabled; false if it is to be disabled.
      • colour

        public GFXColour colour()
        Return the foreground colour value if enabled
        Returns:
        Foreground colour value.
      • colour

        public void colour​(GFXColour oNewColour)
        Set and enable the foreground colour value
        Parameters:
        oNewColour - - New foreground colour value.
      • colourEnable

        public boolean colourEnable()
        Query whether the foreground colour value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • colourEnable

        public void colourEnable​(boolean bNewEnable)
        Enable/disable the foreground colour value
        Parameters:
        bNewEnable - - TRUE if the colour value is to be enabled; FALSE if it is to be disabled.
      • colourBg

        public GFXColour colourBg()
        Return the background colour value if enabled
        Returns:
        Background colour value.
      • colourBg

        public void colourBg​(GFXColour oNewColourBg)
        Set and enable the background colour value
        Parameters:
        oNewColourBg - - New background colour value.
      • colourBgEnable

        public boolean colourBgEnable()
        Query whether the background colour value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • colourBgEnable

        public void colourBgEnable​(boolean bNewEnable)
        Enable/disable the background colour value
        Parameters:
        bNewEnable - - TRUE if the background colour value is to be enabled; FALSE if it is to be disabled.
      • style

        public int style()
        Return the style value if enabled
        Returns:
        Style value.
      • style

        public void style​(int eNewStyle)
        Set and enable the style value
        Parameters:
        eNewStyle - - New style value.
      • styleEnable

        public boolean styleEnable()
        Query whether the style value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • styleEnable

        public void styleEnable​(boolean bNewEnable)
        Enable/disable the style value
        Parameters:
        bNewEnable - - TRUE if the style value is to be enabled; FALSE if it is to be disabled.
      • shade

        public int shade()
        Return the shade level if enabled
        Returns:
        Shade level.
      • shade

        public void shade​(int lNewShade)
        Set and enable the shade level
        Parameters:
        lNewShade - - New shade level.
      • shadeEnable

        public boolean shadeEnable()
        Query whether the shade level is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • shadeEnable

        public void shadeEnable​(boolean bNewEnable)
        Enable/disable the shade level
        Parameters:
        bNewEnable - - TRUE if the shade level is to be enabled; FALSE if it is to be disabled.
      • shadeScale

        public int shadeScale()
        Return the shade scale value if enabled
        Returns:
        Shade scale value.
      • shadeScale

        public void shadeScale​(int lNewShadeScale)
        Set and enable the shade scale value
        Parameters:
        lNewShadeScale - - New shade scale value.
      • shadeScaleEnable

        public boolean shadeScaleEnable()
        Query whether the shade scale value is enabled
        Returns:
        TRUE if enabled; FALSE if not.
      • shadeScaleEnable

        public void shadeScaleEnable​(boolean bNewEnable)
        Enable/disable the shade scale value
        Parameters:
        bNewEnable - - TRUE if the shade scale value is to be enabled; FALSE if it is to be disabled.
      • setGfxTextAttrDefault

        public void setGfxTextAttrDefault​(boolean bDefault)
        Fill the text graphic attribute holder with default values.

        This method behaves like a Clear() or Reset() method might. It replaces all values in the text attribute object with defaults.

        Parameters:
        bDefault - - FALSE if all attributes are to be disabled; TRUE if they are to be enabled with default values.
      • copyFrom

        public void copyFrom​(TextGfxAttr oSource)
        Replace all attributes with those from the source object.

        The standard assignment copies everything, including enabled and disabled status.

        Parameters:
        oSource - - Source attribute object to copy.
      • equals

        public boolean equals​(java.lang.Object object)
        Equality comparison operator.

        Compares on an attribute by attribute basis. Two attributes are considered equal if they are both disabled, or they are both enabled and their values compare for equality.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        object - - Text attribute object to compare against.
        Returns:
        TRUE if the text attribute objects are considered equal; FALSE otherwise.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • notEqual

        public boolean notEqual​(TextGfxAttr oCompare)
        Inequality comparison operator.

        Compares on an attribute by attribute basis. Two attributes are considered unequal if their enabled/disabled settings don't match, or if they are both enabled and their values are unequal.

        Parameters:
        oCompare - - Text attribute object to compare against.
        Returns:
        TRUE if the text attribute objects are considered not equal; FALSE otherwise.