Class TextTab
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAssignment operator.voiddebug()booleanEquality comparison with measurement.booleanEquality comparison.booleangreaterThan(TextTab oCompare) Greater than comparison.booleangreaterThanOrEqual(TextTab oCompare) Greater than or equal to comparison.booleanGreater than comparison with measurement.booleanGreater than or equal to comparison with measurement.inthashCode()booleanLess than comparison.booleanlessThanOrEqual(TextTab oCompare) Less than or equal to comparison.booleanLess than comparison with measurement.booleanLess than or equal to comparison with measurement.booleanInequality comparison.booleanInequality comparison with measurement.static intresolveType(int eSource, boolean bRTL, boolean bLayout) Resolve the tab type, based on text direction.tabStop()Obtain the tab stop offset.voidChange the tab stop's offset.inttabType()Optain the tab stop's current type.voidtabType(int eNewType) Change the tab stop's type.intvalue()Obtain the numeric offset value.
-
Field Details
-
TYPE_LEFT
public static final int TYPE_LEFT- See Also:
-
TYPE_CENTRE
public static final int TYPE_CENTRE- See Also:
-
TYPE_RIGHT
public static final int TYPE_RIGHT- See Also:
-
TYPE_DECIMAL
public static final int TYPE_DECIMAL- See Also:
-
TYPE_ALIGN_AFTER
public static final int TYPE_ALIGN_AFTER- See Also:
-
TYPE_ALIGN_BEFORE
public static final int TYPE_ALIGN_BEFORE- See Also:
-
DEFAULT_TAB
-
ZERO_TAB
-
-
Constructor Details
-
TextTab
public TextTab()Default constructor.The offset is initialized to zero and the tab has an initial type of left.
-
TextTab
Copy constructor.Copy both the offset and the type from the source tab stop object.
- Parameters:
oSource- - Source tab stop to copy.
-
TextTab
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 Details
-
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
Obtain the tab stop offset.- Returns:
- Current offset value for the tab stop.
-
tabStop
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
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
Equality comparison.Two tab stops are considered equal if their offsets compare as equal and they have the same type.
-
hashCode
public int hashCode() -
notEqual
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
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
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
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
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
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
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
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
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
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
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()
-