org.vishia.gral.awt

## Class AwtTextField

- java.lang.Object
- - org.vishia.gral.base.GralWidget.ImplAccess
  - - org.vishia.gral.base.GralTextField.GraphicImplAccess
    - - org.vishia.gral.awt.AwtTextField

- All Implemented Interfaces:
    GralWidgImpl_ifc

      public class AwtTextField
      extends GralTextField.GraphicImplAccess

  Implementation of the `GralTextField` in awt graphics. The original `TextField` has a considerable border for a smart outfit. That is not proper for some applications which needs an slim and simple outfit without borders because the smart outfit properties are given outside of the textfield itself. Therefore the functionality of a text field is implemented with a simple canvas. All functions to edit the content with keyboard are implemented here in an independent way of the awt.TextField. The `paint(Graphics)` shows the simple outfit in a special kind.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) class` | `AwtTextField.TextCanvas`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) java.lang.StringBuilder` | `editBuffer`
    `(package private) java.awt.event.HierarchyBoundsListener` | `hierarchyBoundsListener`
    `(package private) java.awt.event.KeyListener` | `keyListener`
    `(package private) java.awt.Label` | `promptSwt` A possible prompt for the text field or null.
    `static java.lang.String` | `sVersion` Version, history and license.
    `(package private) AwtTextField.TextCanvas` | `widgetAwt` The AWT widget.
    `private AwtWidgetHelper` | `widgHelper` It contains the association to the swt widget (Control) and the `SwtMng` and implements some methods of `GralWidgImpl_ifc` which are delegate from this.

    - ### 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
    Constructor and Description
    `AwtTextField(GralTextField widgg, AwtWidgetMng mng)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `GralRectangle` | `getPixelPositionSize()`
    `java.lang.Object` | `getWidgetImplementation()` Returns the implementation class of the widget.
    `private void` | `paint(java.awt.Graphics gc)`
    `private void` | `processKey(int key)`
    `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)`
    `int` | `setCursorPos(int pos)`
    `void` | `setEditable(boolean editable)`
    `boolean` | `setFocusGThread()` Sets the focus to the widget.
    `void` | `setVisibleGThread(boolean bVisible)` Sets the implementation widget vible or not.

    - ### 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, setDragEnable, setDropEnable, setFocused, setTextChanged, setVisibleState, XXXfocusGained`

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

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

- - ### Field Detail

    - #### sVersion

          public static final java.lang.String sVersion

      Version, history and license.
      - 2015-10-30 Hartmut improved, own implementation with canvas
      - 2011-10-31 Hartmut created.
      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 don'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 are intent to use this sources without publishing its usage, you can get a second license subscribing a special contract with the author.
      See Also:
        Constant Field Values

    - #### widgetAwt

          final AwtTextField.TextCanvas widgetAwt

      The AWT widget. A TextField is not used because a TextField has a border which is not proper in any case. Therefore the capability of text output and edit is implemented with an own algorithm.

    - #### promptSwt

          java.awt.Label promptSwt

      A possible prompt for the text field or null.

    - #### widgHelper

          private final AwtWidgetHelper widgHelper

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

    - #### editBuffer

          java.lang.StringBuilder editBuffer

    - #### hierarchyBoundsListener

          java.awt.event.HierarchyBoundsListener hierarchyBoundsListener

    - #### keyListener

          java.awt.event.KeyListener keyListener

  - ### Constructor Detail

    - #### AwtTextField

          public AwtTextField(GralTextField widgg,
                              AwtWidgetMng mng)

  - ### Method Detail

    - #### removeWidgetImplementation

          public void removeWidgetImplementation()

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

    - #### getWidgetImplementation

          public java.lang.Object 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)

      Sets the implementation widget vible or not.
      Parameters:
        `bVisible` - true then the widget should be visible, false it is set to invisible.
      See Also:
        `GralWidgImpl_ifc.setVisibleGThread(boolean)`

    - #### setCursorPos

          public int setCursorPos(int pos)

    - #### setBoundsPixel

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

    - #### setEditable

          public void setEditable(boolean editable)

    - #### 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`

    - #### getPixelPositionSize

          public GralRectangle getPixelPositionSize()

    - #### processKey

          private void processKey(int key)

    - #### paint

          private void paint(java.awt.Graphics gc)