Class ToolTipWrapUtil
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ToolTipWrapUtil
public ToolTipWrapUtil()
-
-
Method Details
-
wrapTip
Returns the appropriate HTML to display a preview ofvalue
in a tooltip, ifvalue
is multiline text or is too big to display in the cell that contains it. The tooltip will only display up toMAX_TOOLTIP_LINES
of text; if more lines would be required to display the text in its entirety, then the last line will read: "<Truncated N more lines>", where N is the number of lines omitted from the tooltip.This function will automatically wrap text by sequentially appending words from
value
to aStringBuilder
, inserting newlines before appending any word that would make the current line contain more than thanMAX_TOOLTIP_COLS
. However, it will not automatically wrap text when doing so would produce a line containing fewer than0.10 * MAX_TOOLTIP_COLS
.If the original text contained newlines, then each automatically-inserted newline will be followed by an arrow character. The arrow character
'↳'
is unicode U+21b3.If an individual word is longer than MAX_TOOLTIP_COLS, it will be placed on its own line. Text will only be wrapped at whitespace; never in the middle of a word.
If
value
does not require a tooltip (meaning that it does not contains newlines, or thatactualCellWidth >= preferredTextWidth
), then this method simply returnsnull
.- Parameters:
value
- The value oractualCellWidth
- The current width of the cellvalue
is displayed in.preferredTextWidth
- The preferred width of the cellvalue
is displayed in. This is how wide the cell would have to be to fit the text ofvalue
in its entirety.- Returns:
- HTML to display the first
MAX_TOOLTIP_LINES
ofvalue
, if it contains newlines or is too big to fit in its cell. Otherwise,null
.
-