Class TextTabList


  • public class TextTabList
    extends Object
    Class TextTabList represents a set of tab stops (see class TextTab). Its API is designed to simplify working with the list for layout operations.

    A tab list consists of a set of zero or more individual tab stops, as well as an optional uniform tab stop definition.

    Individual tab stops are ultimately set by the user. They may have different types, and their offsets are chosen for visual layout, not typically by algorithmic rule. Irrespective of the order individual tab stops are added to a tab list, AXTE can infer a graphic order from the tab stops' offset values, starting with the smallest and ending with the largest.

    Uniform tab stops kick in after the last individual tab, and are offset at regular intervals, theoretically up to infinity. The uniform tab stop definition defines that interval through its offset and it also defines the tab type for all uniform tabs. Note that uniform tab stops are gridded relative to the start of the line, not the last individual tab stop.

    Because the uniform tab stop definition, the application may enable or disable it. When enabled, the tab list object effectively presents an infinit set of tab stops, starting with the ordered individual tab stops, and followed by an ongoing sequence of manufactured uniform tab stops. When disabled, the last tab stop in the list is the last individual stop.

    For more information, please see the external documentation.

    • Field Detail

      • DEFAULT_TAB_LIST

        public static final TextTabList DEFAULT_TAB_LIST
    • Constructor Detail

      • TextTabList

        public TextTabList()
        Default constructor.

        Construct a tab list object with an initially empty set of individual tabs and a uniform tab definition of 0.5", left aligned.

      • TextTabList

        public TextTabList​(TextTabList oSource)
        Copy constructor.

        Copy the source tab list, including the complete set of individual tab stops and the uniform tab stop definition.

        Parameters:
        oSource - - Source tab list to copy.
    • Method Detail

      • uniform

        public TextTab uniform()
        Obtain the uniform tab stop definition.
        Returns:
        Current uniform tab stop definition.
      • uniform

        public void uniform​(TextTab oNewUniform)
        Change the uniform tab stop definition.
        Parameters:
        oNewUniform - - New uniform tab stop definition. The call is ignored if this has a zero or negative value.
      • noUniform

        public boolean noUniform()
        Query whether the uniform tab stop definition is disabled.
        Returns:
        TRUE if the uniform tab stop definition is disabled; FALSE if enabled.
      • noUniform

        public void noUniform​(boolean bNoUniform)
        Enable/disable the uniform tab stop definition.
        Parameters:
        bNoUniform - - TRUE if the uniform tab stop definition is to be disabled; FALSE to enable it.
      • set

        public void set​(TextTab oSet)
        Set a new tab stop.

        This method adds a new tab stop to the set of individual tabs. The new tab stop can then be retrieved in correct sequence with the Next() and Prev() methods. Note that there may not be two tab stops at the same offset. If the list already contains a tab stop at the new tab's offset, the existing tab is replaced.

        Parameters:
        oSet - - New individual tab to add to the set.
      • clear

        public void clear​(TextTab oClear)
        Clear one tab stop.

        If the list contains an individual tab at the offset of the parameter passed in, remove it from the list. Otherwise, the call is ignored. One cannot clear uniform tab stop instances.

        Parameters:
        oClear - - Tab stop to clear. Only the offset is examined; the type is ignored.
      • clearAll

        public void clearAll()
        Clear all tabs.

        Remove all individual tabs and set the uniform tab stop back to its initial definition (0.5" left).

      • size

        public int size()
        Obtain the number of individual tab stops.
        Returns:
        Number of individual tab stops currently in the list. Not influenced by the state of the uniform tab stop definition.
      • next

        public TextTab next​(UnitSpan oPosition)
        Obtain the next tab.

        Given an offset measurement, this method returns the next tab from the list. Note that a tab exactly at the given offset is not a suitable candidate. If uniform tabs are enabled and the offset is beyond the last individual tab stop, the appropriate uniform tab stop is returned. If the offset is beyond the last individual tab stop and uniform tabs are disabled, a tab with a zero offset is returned.

        Parameters:
        oPosition - - Offset to start the search from.
        Returns:
        Resulting tab stop. Note: This is currently a const reference to static storage ans is not thread safe. Must change to return by value as part of the HATV effort.
      • prev

        public TextTab prev​(UnitSpan oPosition)
        Obtain the previous tab.

        Given an offset measurement, this method returns the previous tab from the list. Note that a tab exactly at the given offset is not a suitable candidate. If uniform tabs are enabled and the offset is far enough beyond the last individual tab stop, the appropriate uniform tab stop is returned. If the offset is beyond the last individual tab stop and uniform tabs are disabled, the last individual tab stop is returned.

        Parameters:
        oPosition - - Offset to start the search from.
        Returns:
        Resulting tab stop. Note: This is currently a const reference to static storage ans is not thread safe. Must change to return by value as part of the HATV effort.
      • copyFrom

        public void copyFrom​(TextTabList oSource)
        Assignment operator.

        Copy the source tab list, including the complete set of individual tab stops and the uniform tab stop definition.

        Parameters:
        oSource - - Source tab list to copy.
      • equals

        public boolean equals​(Object object)
        Equality comparison.

        Two tab lists are considered equal if they have the same sets of tab stops and the same uniform tab stop definition. Tab stops are compared by both offset and type. The uniform tab stop definitions are equal if they are both disabled or they are both enabled and represent the same tab stop.

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

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

        public boolean notEqual​(TextTabList oCompare)
        Inequality comparison.

        Two tab lists are considered unequal if they have different sets of tab stops or different uniform tab stop definitions. Tab stops are compared by both offset and type. The uniform tab stop definitions are unequal if their enabled/disabled states don't match or they are both enabled and represent different tab stops.

        Parameters:
        oCompare - - Tab list to compare against.
        Returns:
        TRUE if the tab lists are not equal; FALSE otherwise.
      • tabAt

        public TextTab tabAt​(int nIndex)
        Tab stop indexing.

        Return one tab stop from the list, accessed by index number. This method treats the tab list as an ordered list of individual tab stops followed by an open-ended list of uniform tabs, if enabled. The caller can request any tab stop from this view.

        Parameters:
        nIndex - - Index number of desired tab stop.
        Returns:
        Resulting tab stop. Note: This is currently a const reference to static storage ans is not thread safe. Must change to return by value as part of the HATV effort.
      • debug

        public void debug()