Class CustomText
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Text
com.e1c.langtool.internal.ui.common.tools.CustomText
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class CustomText
extends org.eclipse.swt.widgets.Text
The realization of text field based on
Text.
In contrast to Text this class provides setting
max and min heights of the component. Also it allows showing a small error tooltip and showing a
hint message (see setMessage(String)) when text is empty end it's not focused.- See Also:
-
Text
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intFields inherited from class org.eclipse.swt.widgets.Text
DELIMITER, LIMITFields inherited from class org.eclipse.swt.widgets.Control
handle -
Constructor Summary
ConstructorsConstructorDescriptionCustomText(org.eclipse.swt.widgets.Composite parent, int style, int errorDectorationPos, String errorMsg) Creates a new instance of this class given its parent and a style values describing its behavior and a behavior error decorator for this component.CustomText(org.eclipse.swt.widgets.Composite parent, int style, String errorMsg) Creates a new instance of this class given its parent, a style value describing its behavior and appearance, a string for error decorator. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidorg.eclipse.swt.graphics.PointcomputeSize(int wHint, int hHint, boolean changed) intReturns a value of the max height for this component.intReturns a value of the mix height for this component.voidHides an error.voidsetMaxHeight(int height) Sets the max height of this component.voidsetMessage(String message) voidsetMinHeight(int height) Sets the min height of this component.voidvoidShows an error.Methods inherited from class org.eclipse.swt.widgets.Text
addModifyListener, addSegmentListener, addSelectionListener, addVerifyListener, append, clearSelection, copy, cut, getCaretLineNumber, getCaretLocation, getCaretPosition, getCharCount, getDoubleClickEnabled, getEchoChar, getEditable, getLineCount, getLineDelimiter, getLineHeight, getMessage, getOrientation, getSelection, getSelectionCount, getSelectionText, getTabs, getText, getText, getTextChars, getTextLimit, getTopIndex, getTopPixel, insert, paste, removeModifyListener, removeSegmentListener, removeSelectionListener, removeVerifyListener, selectAll, setDoubleClickEnabled, setEchoChar, setEditable, setFont, setOrientation, setRedraw, setSelection, setSelection, setSelection, setTabs, setTextChars, setTextLimit, setTopIndex, showSelectionMethods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBarMethods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFocus, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, updateMethods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.eclipse.swt.graphics.Drawable
isAutoScalable
-
Field Details
-
DEFAULT_MAX_HEIGHT
public static final int DEFAULT_MAX_HEIGHT- See Also:
-
DEFAULT_MIN_HEIGHT
public static final int DEFAULT_MIN_HEIGHT- See Also:
-
-
Constructor Details
-
CustomText
public CustomText(org.eclipse.swt.widgets.Composite parent, int style, int errorDectorationPos, String errorMsg) Creates a new instance of this class given its parent and a style values describing its behavior and a behavior error decorator for this component.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to constructerrorDectorationPos- the position of the error decoratorerrorMsg- the string for tooltip that will be shown as error message
-
CustomText
Creates a new instance of this class given its parent, a style value describing its behavior and appearance, a string for error decorator.In contrast to
#HeightBoundedText(Composite, int, int, String)constructor it constructs this component with error decorator that located at top-left.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to constructerrorMsg- the string for tooltip that will be shown as error message
-
-
Method Details
-
setMaxHeight
public void setMaxHeight(int height) Sets the max height of this component. If the given max height is less than 0 or than the min height of this component then this method does nothing.- Parameters:
height- a new max height of this component (value must be non negative)
-
getMaxHeight
public int getMaxHeight()Returns a value of the max height for this component.- Returns:
- a value of the max height
-
setMinHeight
public void setMinHeight(int height) Sets the min height of this component. If the given min height is less than 0 or it's greater than the max height of this component then this method does nothing.- Parameters:
height- a new min height of this component (value must be non negative)
-
getMinHeight
public int getMinHeight()Returns a value of the mix height for this component.- Returns:
- a value of the mix height
-
showError
public void showError()Shows an error. It shows a little error image and tooltip with error message. -
hideError
public void hideError()Hides an error. -
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed) - Overrides:
computeSizein classorg.eclipse.swt.widgets.Control
-
setText
- Overrides:
setTextin classorg.eclipse.swt.widgets.Text
-
setMessage
- Overrides:
setMessagein classorg.eclipse.swt.widgets.Text
-
checkSubclass
protected void checkSubclass()- Overrides:
checkSubclassin classorg.eclipse.swt.widgets.Widget
-