org.vishia.gral.swt

## Class SwtGraphicThread

- java.lang.Object
- - org.vishia.gral.base.GralGraphicThread.ImplAccess
  - - org.vishia.gral.swt.SwtGraphicThread

-     class SwtGraphicThread
      extends GralGraphicThread.ImplAccess

  This class is the implementation class of a simple graphic implementation for SWT. It doesn't depend of complex functionality of the org.vishia.gral. But that implementations based on this. This class can be used for a simple SWT graphic implementation.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `SwtGraphicThread.WindowsCloseListener` The windows-closing event handler.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) org.eclipse.swt.widgets.Display` | `displaySwt` The graphical device for the application for all windows of this application.
    `(package private) SwtMng` | `gralMng`
    `(package private) org.eclipse.swt.events.KeyListener` | `keyListener`
    `(package private) org.eclipse.swt.events.ShellListener` | `mainComponentListerner`
    `(package private) org.eclipse.swt.widgets.Listener` | `traverseKeyFilter` This interface routine is invoked on any key which is used as 'traverse' key to switch between widgets, panels etc.
    `static java.lang.String` | `version` Version, history and license.
    `private SwtGraphicThread.WindowsCloseListener` | `windowsCloseListener` Instance of windowsCloseHandler.
    `(package private) org.eclipse.swt.widgets.Shell` | `windowSwt` The main window.
    `(package private) org.eclipse.swt.events.TraverseListener` | `XXXkeyTraverse` Disables the ctrl-pgUp and ctrl-Pgdn as traversal key listener.

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

      `gralGraphicThread, log, mainWindow, sizeCharProperties, threadGuiDispatch`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SwtGraphicThread(GralWindow windowGral, char sizeShow, LogMessage log)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addToGraphicImplThread(java.lang.Runnable exec)` Yet Experience: SWT knows the `Display.asyncExec(Runnable)`.
    `protected boolean` | `dispatchOsEvents()` Calls the dispatch routine of the implementation graphic.
    `protected void` | `graphicThreadSleep()` Forces the graphic thread to sleep and wait for any events.
    `protected void` | `initGraphic()` This method should be implemented by the graphical implementation layer.
    `(package private) void` | `stop()`
    `void` | `wakeup()` This method should be implemented by the graphical base.
    `(package private) void` | `XXX_Old_createWindow__()`

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

      `gralGraphicThread, setClosed, startThread`

    - ### 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.
      - 2016-07-16 Hartmut chg: The main window will be created with same methods like all other windows.
      - 2015-01-17 Hartmut chg: Now `GralGraphicThread` is an own instance able to create before the graphic is established. This graphical implementation extends the `GralGraphicThread.ImplAccess`. `traverseKeyFilter` now excludes [ctrl-tab]. Only [tab] is a traversal key.
      - 2012-04-16 Hartmut chg: `initGraphic()` now creates the main window, creates the `SwtMng` instead it is doing in the non-graphic thread.
      - 2012-04-10 Hartmut chg: Now the traversal keys ctrl-Pgdn/up are disabled.
      - 2011-11-12 Hartmut chg: Now the primary window has a menu bar anyway.
      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

    - #### displaySwt

          org.eclipse.swt.widgets.Display displaySwt

      The graphical device for the application for all windows of this application.

    - #### windowSwt

          org.eclipse.swt.widgets.Shell windowSwt

      The main window. SWT: named as Shell.

    - #### gralMng

          SwtMng gralMng

    - #### windowsCloseListener

          private final SwtGraphicThread.WindowsCloseListener windowsCloseListener

      Instance of windowsCloseHandler.

    - #### keyListener

          org.eclipse.swt.events.KeyListener keyListener

    - #### XXXkeyTraverse

          org.eclipse.swt.events.TraverseListener XXXkeyTraverse

      Disables the ctrl-pgUp and ctrl-Pgdn as traversal key listener. It should be able to use by the application. Only Tab and sh-Tab are usual.

    - #### traverseKeyFilter

          org.eclipse.swt.widgets.Listener traverseKeyFilter

      This interface routine is invoked on any key which is used as 'traverse' key to switch between widgets, panels etc. SWT uses the ctrl-pgup and ctrl-pgdn to switch between the tab cards on a TabbedPanel. This is not a standard behavior for all graphic systems. That keys should be able to use in the application. Therefore they are disabled as traversal keys. To switch between the tabs - it may be application specific to do it with keys - or the mouse can be used.

    - #### mainComponentListerner

          org.eclipse.swt.events.ShellListener mainComponentListerner

  - ### Constructor Detail

    - #### SwtGraphicThread

          SwtGraphicThread(GralWindow windowGral,
                           char sizeShow,
                           LogMessage log)

  - ### Method Detail

    - #### initGraphic

          protected void initGraphic()

      Description copied from class: `GralGraphicThread.ImplAccess`
      This method should be implemented by the graphical implementation layer. It should build the graphic main window and returned when finished. This routine is called as the first routine in the Graphic thread's method `GralGraphicThread.run()`. See `SwtGraphicThread`.
      Specified by:
        `initGraphic` in class `GralGraphicThread.ImplAccess`
      See Also:
        `org.vishia.gral.base.GralGraphicThread#initGraphic()`

    - #### XXX_Old_createWindow__

          void XXX_Old_createWindow__()

    - #### dispatchOsEvents

          protected boolean dispatchOsEvents()

      Description copied from class: `GralGraphicThread.ImplAccess`
      Calls the dispatch routine of the implementation graphic.
      Specified by:
        `dispatchOsEvents` in class `GralGraphicThread.ImplAccess`
      Returns:
        true if dispatching should be continued.

    - #### graphicThreadSleep

          protected void graphicThreadSleep()

      Description copied from class: `GralGraphicThread.ImplAccess`
      Forces the graphic thread to sleep and wait for any events. Either this routine returns if `GralGraphicThread.ImplAccess.wakeup()` is called or this routine returns if the operation system wakes up the graphic thread.
      Specified by:
        `graphicThreadSleep` in class `GralGraphicThread.ImplAccess`

    - #### addToGraphicImplThread

          protected void addToGraphicImplThread(java.lang.Runnable exec)

      Yet Experience: SWT knows the `Display.asyncExec(Runnable)`.
      Parameters:
        `exec` -

    - #### wakeup

          public void wakeup()

      Description copied from class: `GralGraphicThread.ImplAccess`
      This method should be implemented by the graphical base. It should be waked up the execution of the graphic thread because some actions are registered..
      Specified by:
        `wakeup` in class `GralGraphicThread.ImplAccess`

    - #### stop

          void stop()