Class TextUtils
- java.lang.Object
-
- org.eclipse.nebula.widgets.grid.internal.TextUtils
-
public class TextUtils extends java.lang.ObjectUtility class to provide common operations on strings not supported by the base java API.- Since:
- 2.0.0
-
-
Constructor Summary
Constructors Modifier Constructor Description privateTextUtils()private constructor to prevent instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetShortStr(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width, int style)Shortens a supplied string so that it fits within the area specified by the width argument.private static java.lang.StringgetShortStringTruncatedInTheBeginning(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)private static java.lang.StringgetShortStringTruncatedInTheEnd(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)private static java.lang.StringgetShortStringTruncatedInTheMiddle(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)
-
-
-
Method Detail
-
getShortStr
public static java.lang.String getShortStr(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width, int style)Shortens a supplied string so that it fits within the area specified by the width argument. Strings that have been shorted have an "..." attached to the end of the string. The width is computed using theGC.getCharWidth(char).- Parameters:
gc- GC used to perform calculation.text- text to modify.width- Pixels to display.style- truncation style. seeSWT.LEFT,SWT.CENTER,SWT.RIGHT- Returns:
- shortened string that fits in area specified.
-
getShortStringTruncatedInTheBeginning
private static java.lang.String getShortStringTruncatedInTheBeginning(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)
-
getShortStringTruncatedInTheEnd
private static java.lang.String getShortStringTruncatedInTheEnd(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)
-
getShortStringTruncatedInTheMiddle
private static java.lang.String getShortStringTruncatedInTheMiddle(org.eclipse.swt.graphics.GC gc, java.lang.String text, int width)
-
-