Class ToolTipWrapUtil
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ToolTipWrapUtil
public ToolTipWrapUtil()
-
-
Method Details
-
wrapTip
Returns the appropriate HTML to display a preview ofvaluein a tooltip, ifvalueis multiline text or is too big to display in the cell that contains it. The tooltip will only display up toMAX_TOOLTIP_LINESof 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
valueto 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
valuedoes 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 cellvalueis displayed in.preferredTextWidth- The preferred width of the cellvalueis displayed in. This is how wide the cell would have to be to fit the text ofvaluein its entirety.- Returns:
- HTML to display the first
MAX_TOOLTIP_LINESofvalue, if it contains newlines or is too big to fit in its cell. Otherwise,null.
-