{
Objects.requireNonNull(ttext,
"Tootip text to format must not be null!");
- ttext = ttext.trim();
+ if (enclose)
+ {
+ ttext = ttext.trim();
+ }
boolean maxLengthExceeded = false;
boolean hasBr = false;
for (String br : new String[] { "<br>", "<br/>" })
{
- hasBr = true;
if (ttext.contains(br))
{
+ hasBr = true;
String[] htmllines = ttext.split(br);
StringBuilder sb = new StringBuilder();
for (String line : htmllines)
{
- line = line.replaceAll("\\s+", " ");
- line = line.trim();
+ if (enclose)
+ {
+ line = line.replaceAll("\\s+", " ");
+ line = line.trim();
+ }
if (line.length() == 0 || line.equals(" "))
{
continue;
ttext = sb.toString();
}
}
- if (!hasBr)
+ if (enclose)
{
ttext = ttext.replaceAll("\\s+", " ");
ttext = ttext.trim();
+ }
+ if (!hasBr)
+ {
maxLengthExceeded = ttext.length() > 60;
}