org.vishia.gral.swt

## Class SwtSubWindow

- java.lang.Object
- - org.vishia.gral.base.GralWidget.ImplAccess
  - - org.vishia.gral.base.GralPanelContent.ImplAccess
    - - org.vishia.gral.base.GralWindow.GraphicImplAccess
      - - org.vishia.gral.swt.SwtSubWindow

- All Implemented Interfaces:
    GralWidgImpl_ifc

      public class SwtSubWindow
      extends GralWindow.GraphicImplAccess
      implements GralWidgImpl_ifc

- - ### Nested Class Summary

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

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `bFullScreen` State of the window in swt.
    `private boolean` | `bHasMouseAction` Some flags to set an action listener a first time if the action is given.
    `private boolean` | `bHasResizeAction` Some flags to set an action listener a first time if the action is given.
    `private org.eclipse.swt.events.DisposeListener` | `disposeListener`
    `private org.eclipse.swt.events.DisposeListener` | `disposeListenerMainWindow`
    `protected SwtMenu` | `menuBar`
    `(package private) org.eclipse.swt.events.MouseListener` | `mouseListener` The mouseListener will be activated if `GralWindow.setMouseAction(GralUserAction)` will be called.
    `private org.eclipse.swt.events.ControlListener` | `resizeListener` The resizeListener will be activated if `GralWindow.setResizeAction(GralUserAction)` will be called.
    `protected org.eclipse.swt.events.ShellListener` | `shellListener`
    `static java.lang.String` | `sVersion` Version, history and license: 2016-08-31 Hartmut chg: Now disposes the window in `shellListener` 2015-05-31 Hartmut `setFocusGThread()` now regards the `GralPanelContent.setPrimaryWidget(GralWidget)`.
    `(package private) SwtWidgetHelper` | `swtWidgWrapper` 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.Shell` | `window`

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

      `gralWindow`

    - ### 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
    `SwtSubWindow(SwtMng mng, GralWindow wdgGral)` Constructs a window (primary or sub window maybe for dialog etc.).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `GralRectangle` | `getPixelPositionSize()` Returns the absolute position of this panel on screen and its size.
    `GralRectangle` | `getPixelSize()` Returns the size of this panel in pixel.
    `java.lang.Object` | `getWidgetImplementation()` Returns the implementation class of the widget.
    `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)` Returns the size of the working area without border, menu and title of the window.
    `boolean` | `setFocusGThread()` Sets the focus to the widget.
    `void` | `setVisibleGThread(boolean bVisible)` Sets the implementation widget(s) visible state.
    `(package private) void` | `stop()`

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

      `actionOnCloseWindow, getTitle, getWindowProps, isFullScreen, mouseAction, resizeAction, shouldClose`

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

      `gralPanel`

    - ### 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:
      - 2016-08-31 Hartmut chg: Now disposes the window in `shellListener`
      - 2015-05-31 Hartmut `setFocusGThread()` now regards the `GralPanelContent.setPrimaryWidget(GralWidget)`.
      - 2015-04-27 Hartmut new `GralWindow_ifc.windRemoveOnClose`
      - 2012-07-13 Hartmut new: `getPixelSize()`, chg: `getPixelPositionSize()` in all implementations. A swt.widget.Shell now returns the absolute position and the real size of its client area without menu and title bar.
      - 2012-06-29 Hartmut new: `GralWindow.setResizeAction(GralUserAction)` now for both ctors, resize on subwindow works.
      - 2012-03-10 Hartmut new: calls invisibleSetAction.userActionGui if the window is set invisible by pressing the X closing icon.
      - 2012-02-11 Hartmut chg: The menu of the window is managed now in `SwtMenu`. Instance refered with `menuBar`
      - 2011-11-27 Hartmut chg: `#addMenuBarArea9ItemGThread(String, String, GralUserAction)` moved from `SwtPrimaryWindow` to this, because the capability to have a menu bar may needed on a sub-window too.
      - 2011-11-18 Hartmut chg: `SwtSubWindow#SwtSubWindow(String, Display, String, int, GralMng)` now gets an int-property instead boolean 'exclusive'. A window has more as one property. Constants are defined in `GralWindow_ifc.windExclusive` etc.
      - 2011-11-10 Hartmut chg: move all files from mainGuiSwt to gral.swt, dissolve of package mainGuiSwt
      - 2011-11-09 Hartmut chg: renamed from SubWindowSwt to SwtSubWindow
      - 2011-11-01 Hartmut new: `shellListener` and `disposeListener` added, but empty yet.
      - 2011-10-31 Hartmut new: `mouseListener` and `GralWindow.setMouseAction(GralUserAction)`.
      - 2011-10-30 Hartmut new: `resizeListener`, `GralWindow.setResizeAction(GralUserAction)` etc: Not this class is base of `SwtPrimaryWindow` and contains this capabilities yet.
      - 2011-10-30 Hartmut new: `getPixelPositionSize()` and `setBoundsPixel(int, int, int, int)` to support pixel-orientation too. Note it isn't a concept of GRAL anyway, but it is needed.
      - 2011-10-20 Hartmut chg: `GralMng` as parameter of constructor: The `GralWidget` refers it, it should be initialized.
      - 2011-10-15 Hartmut new: `removeWidgetImplementation()`.
      - 2011-09-23 Hartmut bugfix: setFocus() called in `GralWindow.setWindowVisible(boolean)`, it hasn't the focus automatically.
      - 2011-09-18 Hartmut chg: Now it is a SubWindowSwt and inherits from the new `GralWindow`. Some methods `GralWidget.setBackColor(GralColor, int)`, `GralWindow.setWindowVisible(boolean)` etc added to comply the interface and super class definitions.
      - 2011-09-03 Hartmut creation as wrapper arround a SWT.Shell inherits `GralPanelContent`.
      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

    - #### swtWidgWrapper

          SwtWidgetHelper swtWidgWrapper

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

    - #### window

          protected org.eclipse.swt.widgets.Shell window

    - #### menuBar

          protected SwtMenu menuBar

    - #### bFullScreen

          protected boolean bFullScreen

      State of the window in swt.

    - #### bHasResizeAction

          private boolean bHasResizeAction

      Some flags to set an action listener a first time if the action is given.

    - #### bHasMouseAction

          private boolean bHasMouseAction

      Some flags to set an action listener a first time if the action is given.

    - #### resizeListener

          private final org.eclipse.swt.events.ControlListener resizeListener

      The resizeListener will be activated if `GralWindow.setResizeAction(GralUserAction)` will be called. It calls this user action on resize.

    - #### shellListener

          protected org.eclipse.swt.events.ShellListener shellListener

    - #### disposeListener

          private final org.eclipse.swt.events.DisposeListener disposeListener

    - #### disposeListenerMainWindow

          private final org.eclipse.swt.events.DisposeListener disposeListenerMainWindow

    - #### mouseListener

          org.eclipse.swt.events.MouseListener mouseListener

      The mouseListener will be activated if `GralWindow.setMouseAction(GralUserAction)` will be called. It calls this user action on resize.

  - ### Constructor Detail

    - #### SwtSubWindow

          SwtSubWindow(SwtMng mng,
                       GralWindow wdgGral)

      Constructs a window (primary or sub window maybe for dialog etc.).
      Parameters:
        `name` -
        `display` -
        `title` -
        `windProps` -
        `gralMng` -

  - ### Method Detail

    - #### 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.
      Specified by:
        `getWidgetImplementation` in interface `GralWidgImpl_ifc`

    - #### removeWidgetImplementation

          public void removeWidgetImplementation()

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

    - #### getPixelPositionSize

          public GralRectangle getPixelPositionSize()

      Description copied from class: `GralPanelContent.ImplAccess`
      Returns the absolute position of this panel on screen and its size. If it is a main window, the useable area of the window without title and menu bar is returned.
      Specified by:
        `getPixelPositionSize` in interface `GralWidgImpl_ifc`
      Specified by:
        `getPixelPositionSize` in class `GralPanelContent.ImplAccess`

    - #### getPixelSize

          public GralRectangle getPixelSize()

      Description copied from class: `GralPanelContent.ImplAccess`
      Returns the size of this panel in pixel.
      Specified by:
        `getPixelSize` in class `GralPanelContent.ImplAccess`
      Returns:
        the x and y is 0, the dy and dy is the size.

    - #### setBoundsPixel

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

      Returns the size of the working area without border, menu and title of the window. Uses `Scrollable.getClientArea()` to get the size.
      Specified by:
        `setBoundsPixel` in interface `GralWidgImpl_ifc`

    - #### stop

          void stop()

    - #### setFocusGThread

          public boolean setFocusGThread()

      Description copied from interface: `GralWidgImpl_ifc`
      Sets the focus to the widget. See `GralMng_ifc#setFocus(GralWidget)`.
      Specified by:
        `setFocusGThread` in interface `GralWidgImpl_ifc`
      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.
      Specified by:
        `setVisibleGThread` in interface `GralWidgImpl_ifc`
      Parameters:
        `bVisible` - true then the widget should be visible, false it is set to invisible.

    - #### 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`
      Specified by:
        `repaintGthread` in interface `GralWidgImpl_ifc`