org.vishia.gral.swt

## Class SwtTextFieldWrapper

- java.lang.Object
- - org.vishia.gral.base.GralWidget.ImplAccess
  - - org.vishia.gral.base.GralTextField.GraphicImplAccess
    - - org.vishia.gral.swt.SwtTextFieldWrapper

- All Implemented Interfaces:
    GralWidgImpl_ifc

      public class SwtTextFieldWrapper
      extends GralTextField.GraphicImplAccess

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private class` | `SwtTextFieldWrapper.TextFieldFocusListener` For edit able fields.
    `protected class` | `SwtTextFieldWrapper.TextFieldKeyListener`
    `protected class` | `SwtTextFieldWrapper.TextFieldModifyListener`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private org.eclipse.swt.dnd.DropTarget` | `drop`
    `(package private) org.eclipse.swt.events.PaintListener` | `paintListener`
    `(package private) SwtTransparentLabel` | `promptSwt` A possible prompt for the text field or null.
    `private SwtWidgetHelper` | `swtWidgHelper` It contains the association to the swt widget (Control) and the `SwtMng` and implements some methods of `GralWidgImpl_ifc` which are delegate from this.
    `protected org.eclipse.swt.widgets.Text` | `textFieldSwt`
    `static java.lang.String` | `version` Version, history and license.

    - ### Fields inherited from class org.vishia.gral.base.GralTextField.GraphicImplAccess

      `chgCursor, chgPrompt, posField, posPrompt`

    - ### Fields inherited from class org.vishia.gral.base.GralWidget.ImplAccess

      `chgBitsDerived, chgColorBack, chgColorLine, chgColorText, chgEditable, chgFloat, chgFocus, chgFont, chgIntg, chgInvisible, chgObjects, chgPos, chgText, chgVisible, chgVisibleInfo, pixBounds, wdgimpl, widgg`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `SwtTextFieldWrapper(GralTextField widgg, SwtMng mng)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) static void` | `createTextField(GralTextField widgg, GralMng mng)` Creates a SwtTextField.
    `GralRectangle` | `getPixelPositionSize()`
    `org.eclipse.swt.widgets.Text` | `getWidgetImplementation()` Returns the implementation class of the widget.
    `protected void` | `paintWidget(org.eclipse.swt.widgets.Text swt, org.eclipse.swt.events.PaintEvent e)`
    `void` | `removeWidgetImplementation()` Removes the graphical widget in the graphic.
    `void` | `repaintGthread()` This method should be implemented in all Widget implementations of the adapter for the underlying graphic system.
    `void` | `setBoundsPixel(int x, int y, int dx, int dy)`
    `protected void` | `setDragEnable(int dragType)` Implementation routine to set receiving a drag event and initializes the drag feature of the widget.
    `protected void` | `setDropEnable(int dropType)` Implementation routine to set receiving a drop event and initializes the drop feature of the widget.
    `boolean` | `setFocusGThread()` Sets the focus to the widget.
    `void` | `setVisibleGThread(boolean bVisible)` Sets the implementation widget(s) visible state.
    `(package private) void` | `stop()`
    `protected void` | `textFieldFocusGained()`
    `protected void` | `textFieldFocusLost()`

    - ### Methods inherited from class org.vishia.gral.base.GralTextField.GraphicImplAccess

      `borderwidth, caretPos, caretPos, isPasswordField, prompt, promptStylePosition, setTouched, user`

    - ### Methods inherited from class org.vishia.gral.base.GralWidget.ImplAccess

      `acknChanged, actionShow, dyda, getActionChange, getChanged, gralWidgetFromImplData, setFocused, setTextChanged, setVisibleState, XXXfocusGained`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### version

          public static final java.lang.String version

      Version, history and license.
      - 2015-05-04 Hartmut new: `GralTextField.setBorderWidth(int)` to show the text field with a border. That is not a property of an SWT Text, therefore a new `paintListener` was added to draw the border.
      - 2013-12-22 Hartmut chg: Now `GralTextField` uses the new concept of instantiation: It is not the super class of the implementation class. But it provides `GralTextField.GraphicImplAccess` as the super class.
      - 2012-06-30 Hartmut new actionChange called on typing inside a field.
      - 2012-06-30 Hartmut new `#swtKeyListener`. The [Enter] key will be send to the User in opposite to `SwtTextBox`.
      - 2012-06-08 Hartmut chg: `repaintGthread()` does not do anything if the textFieldSwt is removed because the widget was removed. Prevent null-Pointer exception.
      - 2012-04-10 Hartmut chg: A key listener, only for experience
      - 2012-03-17 Hartmut bugfix: adjustment of prompt for top prompt
      - 2012-03-10 Hartmut chg: Minor for top-level prompt.
      - 2011-06-00 Hartmut creation
      Copyright/Copyleft: For this source the LGPL Lesser General Public License, published by the Free Software Foundation is valid. It means:
      1. You can use this source without any restriction for any desired purpose.
      2. You can redistribute copies of this source to everybody.
      3. Every user of this source, also the user of redistribute copies with or without payment, must accept this license for further using.
      4. But the LPGL is not appropriate for a whole software product, if this source is only a part of them. It means, the user must publish this part of source, but doesn't need to publish the whole source of the own product.
      5. You can study and modify (improve) this source for own using or for redistribution, but you have to license the modified sources likewise under this LGPL Lesser General Public License. You mustn't delete this Copyright/Copyleft inscription in this source file.
      If you intent to use this source without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### swtWidgHelper

          private final SwtWidgetHelper swtWidgHelper

      It contains the association to the swt widget (Control) and the `SwtMng` and implements some methods of `GralWidgImpl_ifc` which are delegate from this.

    - #### textFieldSwt

          protected org.eclipse.swt.widgets.Text textFieldSwt

    - #### promptSwt

          SwtTransparentLabel promptSwt

      A possible prompt for the text field or null.

    - #### drop

          private org.eclipse.swt.dnd.DropTarget drop

    - #### paintListener

          org.eclipse.swt.events.PaintListener paintListener

  - ### Constructor Detail

    - #### SwtTextFieldWrapper

          private SwtTextFieldWrapper(GralTextField widgg,
                                      SwtMng mng)

  - ### Method Detail

    - #### createTextField

          static void createTextField(GralTextField widgg,
                                      GralMng mng)

      Creates a SwtTextField. It is package private, only called from the `SwtMng`.
      Parameters:
        `widgg` -
        Prompting: The parameter promptStylePosition determines where a prompt is showing.
        - "t": prompt above, calculates inside position
        - "r": prompt right, calculates outside position.
        `name` - The name to register it.
        `editable` - false then show field
        `prompt` - maybe null, propmt text
        `promptStylePosition` - maybe null, prompt position
        `mng` -

    - #### getPixelPositionSize

          public GralRectangle getPixelPositionSize()

    - #### setDropEnable

          protected void setDropEnable(int dropType)

      Description copied from class: `GralWidget.ImplAccess`
      Implementation routine to set receiving a drop event and initializes the drop feature of the widget.
      Overrides:
        `setDropEnable` in class `GralWidget.ImplAccess`
      Parameters:
        `dropType` - one of `KeyCode.dropFiles` or ..dropText

    - #### setDragEnable

          protected void setDragEnable(int dragType)

      Description copied from class: `GralWidget.ImplAccess`
      Implementation routine to set receiving a drag event and initializes the drag feature of the widget. A overridden routine should be implemented for the implementation graphic layer widget. This routine is invoked when it isn't overridden, it throws an exception because the drag feature isn't supported for the implementation.
      Overrides:
        `setDragEnable` in class `GralWidget.ImplAccess`
      Parameters:
        `dragType` - one of `KeyCode.dragFiles` or ..dragText

    - #### repaintGthread

          public void repaintGthread()

      Description copied from interface: `GralWidgImpl_ifc`
      This method should be implemented in all Widget implementations of the adapter for the underlying graphic system.
      Implementation hints: In SWT it should call redraw().
      It is possible that the widget consists of more as one graphical widget, then all of it should be redrawn. It is possible that some data are set in another thread, they should be applied to the widgets firstly. It is possible that the widget is removed though a repaintGthread-order is pending from the time before deleting, for example if the graphic layout is changed.
      See `#repaintRequ`

    - #### getWidgetImplementation

          public org.eclipse.swt.widgets.Text getWidgetImplementation()

      Description copied from interface: `GralWidgImpl_ifc`
      Returns the implementation class of the widget. If the widget has more as one implementation widgets, this method returns one of the widgets, usual the first important one respectively that widget which represents the implementation layer. A widget of the implementation layer is a SWT.control or a `Component`.
      If more as one widget are part of the GralWidget, use the special `GralWidget._wdgImpl` class which should contain the references to that implementation widgets.

    - #### setFocusGThread

          public boolean setFocusGThread()

      Description copied from interface: `GralWidgImpl_ifc`
      Sets the focus to the widget. See `GralMng_ifc#setFocus(GralWidget)`.
      Returns:
        true if it has the focus after this operation. false on any error.

    - #### setVisibleGThread

          public void setVisibleGThread(boolean bVisible)

      Description copied from interface: `GralWidgImpl_ifc`
      Sets the implementation widget(s) visible state. The widgets are really invisible, or they are visible in principle, but they can be covered by other windows or clipping. This method should set the `GralWidget.bVisibleState` too. Therewith it is able to quest `GralWidget.isVisible()` in any thread.
      Parameters:
        `bVisible` - true then the widget should be visible, false it is set to invisible.

    - #### removeWidgetImplementation

          public void removeWidgetImplementation()

      Description copied from interface: `GralWidgImpl_ifc`
      Removes the graphical widget in the graphic.

    - #### setBoundsPixel

          public void setBoundsPixel(int x,
                                     int y,
                                     int dx,
                                     int dy)

    - #### textFieldFocusGained

          protected void textFieldFocusGained()

    - #### textFieldFocusLost

          protected void textFieldFocusLost()

    - #### paintWidget

          protected void paintWidget(org.eclipse.swt.widgets.Text swt,
                                     org.eclipse.swt.events.PaintEvent e)

    - #### stop

          void stop()