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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     

    Fields inherited from class org.eclipse.swt.widgets.Text

    DELIMITER, LIMIT

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors
    Constructor
    Description
    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.
    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 Type
    Method
    Description
    protected void
     
    org.eclipse.swt.graphics.Point
    computeSize(int wHint, int hHint, boolean changed)
     
    int
    Returns a value of the max height for this component.
    int
    Returns a value of the mix height for this component.
    void
    Hides an error.
    void
    setMaxHeight(int height)
    Sets the max height of this component.
    void
    setMessage(String message)
     
    void
    setMinHeight(int height)
    Sets the min height of this component.
    void
    setText(String string)
     
    void
    Shows 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, showSelection

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods 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, update

    Methods 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, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Field Details

  • 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 construct
      errorDectorationPos - the position of the error decorator
      errorMsg - the string for tooltip that will be shown as error message
    • CustomText

      public 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.

      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 construct
      errorMsg - 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:
      computeSize in class org.eclipse.swt.widgets.Control
    • setText

      public void setText(String string)
      Overrides:
      setText in class org.eclipse.swt.widgets.Text
    • setMessage

      public void setMessage(String message)
      Overrides:
      setMessage in class org.eclipse.swt.widgets.Text
    • checkSubclass

      protected void checkSubclass()
      Overrides:
      checkSubclass in class org.eclipse.swt.widgets.Widget