Class TextTab


  • public class TextTab
    extends java.lang.Object
    This class represents a single tab stop. As such, it contains two pieces of information: an offset and an alignment (referred to as type in this interface). The offset is measured in form units and the type is one of left, centre, right or decimal (radix).

    In left-to-right (LTR) text, tab offsets measure from the left-hand side. In right-to-left (RTL) text, tab offsets measure from the right-hand side and the meanings of the left and right types are inverted.

    For more information, please see the extenral documentation.

    • Constructor Detail

      • TextTab

        public TextTab()
        Default constructor.

        The offset is initialized to zero and the tab has an initial type of left.

      • TextTab

        public TextTab​(TextTab oSource)
        Copy constructor.

        Copy both the offset and the type from the source tab stop object.

        Parameters:
        oSource - - Source tab stop to copy.
      • TextTab

        public TextTab​(UnitSpan oNewStop,
                       int eNewType)
        Constructor with offset and optional type.
        Parameters:
        oNewStop - - Offset value for the tab stop object.
        eNewType - - (optional) Initial tab type. Default is left.
      • TextTab

        public TextTab​(double fNewStop,
                       int eNewType)
    • Method Detail

      • tabType

        public int tabType()
        Optain the tab stop's current type.
        Returns:
        Current tab stop type (left, centre, right or decimal).
      • tabType

        public void tabType​(int eNewType)
        Change the tab stop's type.
        Parameters:
        eNewType - - New tab type.
      • tabStop

        public UnitSpan tabStop()
        Obtain the tab stop offset.
        Returns:
        Current offset value for the tab stop.
      • tabStop

        public void tabStop​(UnitSpan oNewStop)
        Change the tab stop's offset.
        Parameters:
        oNewStop - - New offset value for the tab stop.
      • value

        public int value()
        Obtain the numeric offset value.

        This method returns the value portion of the tab offset measurement. It is meant as a short-cut for sero comparisons only. For example, you can say oTab.Value() rather than oTab.TabStop().Value(). Big deal.

        Returns:
        Tab stop numeric value, unadorned by unit type.
      • resolveType

        public static int resolveType​(int eSource,
                                      boolean bRTL,
                                      boolean bLayout)
        Resolve the tab type, based on text direction.

        Given a tab type and text direction, this method returns a resolved type. The behaviour of the resolution also depends on whether it is occuring for layout.

        General (non-layout) resolution: For LTR text, TYPE_ALIGN_AFTER resolves to TYPE_LEFT and TYPE_ALIGN_BEFORE resolves to TYPE_RIGHT. For RTL text, TYPE_ALIGN_AFTER resolves to TYPE_RIGHT and TYPE_ALIGN_BEFORE resolves to TYPE_LEFT. All other types do not change.

        Layout resoultion: For LTR text, TYPE_LEFT resolves to TYPE_ALIGN_AFTER and TYPE_RIGHT resolves to TYPE_ALIGN_BEFORE. For RTL text, TYPE_LEFT resolves to TYPE_ALIGN_BEFORE and TYPE_RIGHT resolves to TYPE_ALIGN_AFTER.

        Parameters:
        eSource - - Source type code to resolve.
        bRTL - - True for RTL text; false for LTR text;
        bLayout - - (optional) True if this resolution is for layout; false (default) for general resolution.
        Returns:
        Resolved type.
      • copyFrom

        public TextTab copyFrom​(TextTab oSource)
        Assignment operator.

        Copies both the offset and type from the source tab stop object.

        Parameters:
        oSource - - Source tab stop object to copy.
        Returns:
        A reference to this object.
      • equals

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

        Two tab stops are considered equal if their offsets compare as equal and they have the same type.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        object - - Tab stop object to compare against.
        Returns:
        TRUE if the tab stops are equal; FALSE otherwise.
      • hashCode

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

        public boolean notEqual​(TextTab oCompare)
        Inequality comparison.

        Two tab stops are considered unequal if either their offsets are not equal or they have different types.

        Parameters:
        oCompare - - Tab stop object to compare against.
        Returns:
        TRUE if the tab stops are not equal; FALSE if equal.
      • lessThan

        public boolean lessThan​(TextTab oCompare)
        Less than comparison.

        Compare the offset values only; ignores the tab stops' types.

        Parameters:
        oCompare - - Tab stop object to compare against.
        Returns:
        TRUE if this tab stop is less than the given tab stop; FALSE otherwise.
      • lessThanOrEqual

        public boolean lessThanOrEqual​(TextTab oCompare)
        Less than or equal to comparison.

        Compare the offset values only; ignores the tab stops' types.

        Parameters:
        oCompare - - Tab stop object to compare against.
        Returns:
        TRUE if this tab stop is less than or equal to the given tab stop; FALSE otherwise.
      • greaterThan

        public boolean greaterThan​(TextTab oCompare)
        Greater than comparison.

        Compare the offset values only; ignores the tab stops' types.

        Parameters:
        oCompare - - Tab stop object to compare against.
        Returns:
        TRUE if this tab stop is greater than the given tab stop; FALSE otherwise.
      • greaterThanOrEqual

        public boolean greaterThanOrEqual​(TextTab oCompare)
        Greater than or equal to comparison.

        Compare the offset values only; ignores the tab stops' types.

        Parameters:
        oCompare - - Tab stop object to compare against.
        Returns:
        TRUE if this tab stop is greater than or equal to the given tab stop; FALSE otherwise.
      • equals

        public boolean equals​(UnitSpan oCompare)
        Equality comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan) for equality. The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is equal to the given measurement; FALSE otherwise.
      • notEqual

        public boolean notEqual​(UnitSpan oCompare)
        Inequality comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan) for inequality. The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is not equal to the given measurement; FALSE otherwise.
      • lt

        public boolean lt​(UnitSpan oCompare)
        Less than comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan). The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is less than the given measurement; FALSE otherwise.
      • lte

        public boolean lte​(UnitSpan oCompare)
        Less than or equal to comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan). The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is less than or equal to the given measurement; FALSE otherwise.
      • gt

        public boolean gt​(UnitSpan oCompare)
        Greater than comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan). The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is greater than the given measurement; FALSE otherwise.
      • gte

        public boolean gte​(UnitSpan oCompare)
        Greater than or equal to comparison with measurement.

        Compare the tab stop's offset against a measurement (jfUnitSpan). The tab stop type is ignored.

        Parameters:
        oCompare - - Measurement to compare against.
        Returns:
        TRUE if this tab stop's offset is greater than or equal to the given measurement; FALSE otherwise.
      • debug

        public void debug()