org.vishia.gral.base

## Class GralWindow

- java.lang.Object
- - org.vishia.gral.base.GralWidget
  - - org.vishia.gral.base.GralPanelContent
    - - org.vishia.gral.base.GralWindow

- All Implemented Interfaces:
    GetGralWidget_ifc, GralWindow_setifc, GralSetValue_ifc, GralWidget_ifc, GralWindow_getifc, GralWindow_ifc, Removeable

      public class GralWindow
      extends GralPanelContent
      implements GralWindow_ifc

  This class represents a window of an application, either the primary window or any sub window. The `GralPos#pos` of the baseclass is the position of the window derived from any other Position.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `GralWindow.ActionResizeOnePanel` Standard action for resizing, used if the window contains one panel.
    `static class` | `GralWindow.GraphicImplAccess` This class is not intent to use from an application, it is the super class for the implementation layer to access all necessary data and methods with protected access rights.

    - ### Nested classes/interfaces inherited from class org.vishia.gral.base.GralPanelContent

      `GralPanelContent.ImplAccess, GralPanelContent.MethodsCalledbackFromImplementation`

    - ### Nested classes/interfaces inherited from class org.vishia.gral.base.GralWidget

      `GralWidget.ActionChangeSelect, GralWidget.ConfigData, GralWidget.DynamicData`

    - ### Nested classes/interfaces inherited from interface org.vishia.gral.ifc.GralWidget_ifc

      `GralWidget_ifc.ActionChange, GralWidget_ifc.ActionChangeWhen`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected GralUserAction` | `actionOnCloseWindow`
    `protected boolean` | `bFullScreen` State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread.
    `protected boolean` | `bShouldClose` State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread.
    `(package private) GralGraphicTimeOrder` | `createImplWindow` Code snippet for initializing the GUI area (panel).
    `protected GralMenu` | `menuBarGral`
    `protected GralUserAction` | `mouseAction` See `GralWindow_ifc.setMouseAction(GralUserAction)`.
    `protected GralUserAction` | `resizeAction` This action is called whenever the window is resized by user handling on GUI and the window is determined as `GralWindow_ifc.windResizeable`.
    `static java.lang.String` | `version` Version, history and license.
    `protected boolean` | `visibleFirst`
    `(package private) int` | `windProps` Or of some wind... constants.
    `protected boolean` | `XXXbVisible` State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread.

    - ### Fields inherited from class org.vishia.gral.base.GralPanelContent

      `bGridZoomed, bZoomed, canvas, primaryWidget, widgetList, widgetsToResize`

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

      `_wdgImpl, bEditable, bHasFocus, bShouldInitialize, buildMng, bVisibleState, cfg, contextMenu, dateUser, dyda, htmlHelp, itsMng, lastTimeSetVisible, name, repaintDelay, repaintDelayMax, sCmd, sFormat, sToolTip, sVersion, whatIs`

    - ### Fields inherited from interface org.vishia.gral.ifc.GralWindow_ifc

      `windConcurrently, windExclusive, windHasMenu, windIsMain, windOnTop, windRemoveOnClose, windResizeable`

    - ### Fields inherited from interface org.vishia.gral.ifc.GralWidget_ifc

      `sVersion`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralWindow(java.lang.String posString, java.lang.String nameWindow, java.lang.String sTitle, int windProps)` Constructs a window.
    `GralWindow(java.lang.String posString, java.lang.String nameWindow, java.lang.String sTitle, int windProps, GralMng mng, java.lang.Object panelComposite)` Deprecated.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMenuBarItemGThread(java.lang.String nameMenu, java.lang.String sMenuPath, GralUserAction action)` Deprecated. use `getMenuBar()` and then `GralMenu.addMenuItem(String, String, GralUserAction)`
    `void` | `closeWindow()`
    `void` | `create(java.lang.String awtOrSwt, char size, LogMessage log, GralGraphicTimeOrder initializeInGraphicThread)` Creates the window.
    `GralMenu` | `getMenuBar()` Gets the menu bar to add a menu item.
    `GralRectangle` | `getPixelPositionSize()`
    `boolean` | `isWindowsVisible()`
    `boolean` | `remove()` This overridden form of `Removeable.remove()` removes all widgets of this panel.
    `void` | `setFullScreen(boolean val)`
    `void` | `setMouseAction(GralUserAction action)` Sets an action which is invoked if any mouse button is pressed in the windows area on the screen.
    `void` | `setResizeAction(GralUserAction action)` Sets an action which is invoked if the whole window is resized by user handling on the window borders.
    `void` | `setTitle(java.lang.String sTitle)`
    `void` | `setWindowVisible(boolean visible)` Controls whether the whole window, which contains this panel, should be visible or not.
    `void` | `specifyActionOnCloseWindow(GralUserAction action)` Sets an action which is invoked if the window is set invisible or it is disposed.

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

      `addWidget, createImplWidget_Gthread, getTextFrom, getWidget, getWidgetImplementation, getWidgetList, removeWidget, setPrimaryWidget, setTextIn, setVisibleState, toString, widgetList, XXXsetFocusGThread`

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

      `chgPos, clearShowParam, getActionChange, getActionChangeStrict, getActionDrag, getActionDrop, getActionFocused, getActionShow, getBackColor, getCfgElement, getCmd, getCmd, getContentIdent, getContentInfo, getContextMenu, getData, getDataIx, getDataPath, getDataPath, getFloatValue, getFormat, getGralWidget, getHtmlHelp, getImpl, getItsPanel, getLongValue, getName, getShowMethod, getShowParam, getsToolTip, getText, getValue, getVariable, getVariableFromContentInfo, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, pos, refreshFromVariable, refreshFromVariable, registerWidget, repaint, repaint, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setFocus, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPanelMng, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setValue, setVisible, setVisibleStateWidget, specifyActionChange, specifyContextMenu, stop, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetVisibleGThread`

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

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

    - ### Methods inherited from interface org.vishia.gral.ifc.GralWidget_ifc

      `createImplWidget_Gthread, getActionChange, getBackColor, getCmd, getContentIdent, getContentInfo, getData, getDataPath, getName, gralMng, isChanged, isEditable, isGraphicDisposed, isInFocus, isNotEditableOrShouldInitialize, isVisible, refreshFromVariable, refreshFromVariable, repaint, repaint, setBackColor, setBackgroundColor, setBoundsPixel, setCmd, setContentIdent, setData, setDataPath, setEditable, setFocus, setFocus, setForegroundColor, setHtmlHelp, setLineColor, setText, setTextColor, setToPanel, setVisible`

- - ### Field Detail

    - #### version

          public static final java.lang.String version

      Version, history and license.
      - 2016-09-23 Hartmut chg: `create(String, char, LogMessage, GralGraphicTimeOrder)` now needs an obligate argument which can be null for the first callback routine for graphic initializing.
      - 2016-09-18 Hartmut chg: renaming `specifyActionOnCloseWindow(GralUserAction)` instead 'setActionOnSettingInvisible', more expressive name.
      - 2016-08-28 Hartmut new `create(String, char, LogMessage, GralGraphicTimeOrder)` to create either the primary window inclusive the whole graphic machine, or create any secondary window.
      - 2015-05-31 Hartmut The `GralWindow.GraphicImplAccess` is now derived from `GralPanelContent.ImplAccess` because this class is derived from that too. Parallel inheritance.
      - 2013-12-19 Hartmut bugfix: `setFullScreen(boolean)` now works.
      - 2013-12-19 Hartmut new: Now it is able to instantiate without Graphic Layer and `GralWidget.setToPanel(GralMngBuild_ifc)` is supported.
      - 2012-04-16 Hartmut new: `#actionResizeOnePanel`
      - 2012-03-13 Hartmut chg: Some abstract method declarations moved to its interface.
      - 2011-12-31 Hartmut chg: Implements the set-methods of `GralWindow_ifc` in form of calling `GralMng_ifc#setInfo(GralWidget, int, int, Object, Object)`. This methods can be called in any thread, it may be stored using `GralGraphicThread#addRequ(org.vishia.gral.base.GralWidgetChangeRequ)`.
      - 2011-11-27 Hartmut new: `addMenuBarItemGThread(String, String, GralUserAction)` copied from `GralPrimaryWindow_ifc`. The capability to have a menu bar should be enabled for sub-windows too. To support regularity, the property bit `GralWindow_ifc.windHasMenu` is created. The property whether a window has a menu bar or not should be given on creation already.
      - 2011-11-27 Hartmut new: `windProps` now stored for all implementations here. `visibleFirst`: Maybe a problem while creation a menu bar in SWT (?)
      - 2011-11-18 Hartmut new: `GralWindow_ifc.windExclusive` etc. as properties for creation a window.
      - 2011-11-12 Hartmut chg: Because the `GralPanelContent` inherits `GralWidget` and this class has a `GralWidget.pos()`, the member 'posWindow' is removed.
      - 2011-10-31 Hartmut new: `setResizeAction(GralUserAction)` and `setMouseAction(GralUserAction)` for operations with the whole window.
      - 2011-10-30 Hartmut new: `resizeAction`
      - 2011-09-23 Hartmut new: member GralGridPos: Position of the window. The position is referred to any Panel in another Window. It can be tuned and it is used if the Window is set visible.
      - 2011-09-18 Hartmut creation: Now a PrimaryWindow and a SubWindow are defined.
      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

    - #### windProps

          int windProps

      Or of some wind... constants.

    - #### resizeAction

          protected GralUserAction resizeAction

      This action is called whenever the window is resized by user handling on GUI and the window is determined as `GralWindow_ifc.windResizeable`. Per default an instance of `GralWindow.ActionResizeOnePanel` is called. See `GralWindow_ifc.setResizeAction(GralUserAction)`.

    - #### actionOnCloseWindow

          protected GralUserAction actionOnCloseWindow

    - #### mouseAction

          protected GralUserAction mouseAction

      See `GralWindow_ifc.setMouseAction(GralUserAction)`.

    - #### menuBarGral

          protected GralMenu menuBarGral

    - #### visibleFirst

          protected boolean visibleFirst

    - #### XXXbVisible

          protected boolean XXXbVisible

      State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread. It is stored here and executed in the `GralWidgImpl_ifc.repaintGthread()`.

    - #### bFullScreen

          protected boolean bFullScreen

      State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread. It is stored here and executed in the `GralWidgImpl_ifc.repaintGthread()`.

    - #### bShouldClose

          protected boolean bShouldClose

      State of visible, fullScreen, close set by `GralWidget.setVisible(boolean)`, `setFullScreen(boolean)`, `closeWindow()` called in another thread than the graphic thread. It is stored here and executed in the `GralWidgImpl_ifc.repaintGthread()`.

    - #### createImplWindow

          GralGraphicTimeOrder createImplWindow

      Code snippet for initializing the GUI area (panel). This snippet will be executed in the GUI-Thread if the GUI is created.

  - ### Constructor Detail

    - #### GralWindow

          @Deprecated
          public GralWindow(java.lang.String posString,
                                         java.lang.String nameWindow,
                                         java.lang.String sTitle,
                                         int windProps,
                                         GralMng mng,
                                         java.lang.Object panelComposite)

      Deprecated.
      Constructs a window.
      Parameters:
        `nameWindow` -
        `windProps` -
        `mng` -
        `panelComposite` - The implementing instance for a panel.

    - #### GralWindow

          public GralWindow(java.lang.String posString,
                            java.lang.String nameWindow,
                            java.lang.String sTitle,
                            int windProps)

      Constructs a window.
      Parameters:
        `posString` - the position relative to a given position of the parent window. "!" on top level window.
        `nameWindow` -
        `sTitle` -
        `windProps` - See `GralWindow_ifc.windResizeable` etc.

  - ### Method Detail

    - #### specifyActionOnCloseWindow

          public void specifyActionOnCloseWindow(GralUserAction action)

      Description copied from interface: `GralWindow_ifc`
      Sets an action which is invoked if the window is set invisible or it is disposed. Note that depending of the property `GralWindow_ifc.windRemoveOnClose` the window is disposed or it is set invisible without disposing if the close action is done by the user. In both cases this action will be invoked.
      Specified by:
        `specifyActionOnCloseWindow` in interface `GralWindow_ifc`
      Parameters:
        `action` - The `GralUserAction.userActionGui(int, GralWidget, Object...)` will be called without parameter.

    - #### create

          public void create(java.lang.String awtOrSwt,
                             char size,
                             LogMessage log,
                             GralGraphicTimeOrder initializeInGraphicThread)

      Creates the window. Either the `GralGraphicThread.isRunning()` already then it is a second window. If the graphic thread is not running, it would be started and this is the primary window. The it invokes `GralFactory.createGraphic(GralWindow, char, LogMessage, String)`. The application should not know whether it is the primary or any secondary window. That helps for applications which are started from a Gral graphic application itself without an own operation system process.
      Parameters:
        `awtOrSwt` - see `GralFactory.createGraphic(GralWindow, char, LogMessage, String)`
        `size` - 'A'..'G', 'A' is a small size, 'G' is the largest.
        `log` - maybe null. If not given a `LogMessageStream` with System.out will be created. For internal logging.
        `initializeInGraphicThread` - maybe null, an order which will be executed in the graphic thread after creation of the window.

    - #### setWindowVisible

          public void setWindowVisible(boolean visible)

      Description copied from interface: `GralWindow_setifc`
      Controls whether the whole window, which contains this panel, should be visible or not. It is proper for such panels especially, which are the only one in a window. If a window is setting visible with this method, it is arranged in the foreground.
      Specified by:
        `setWindowVisible` in interface `GralWindow_setifc`

    - #### closeWindow

          public void closeWindow()

      Specified by:
        `closeWindow` in interface `GralWindow_setifc`

    - #### remove

          public boolean remove()

      Description copied from class: `GralPanelContent`
      This overridden form of `Removeable.remove()` removes all widgets of this panel. It includes the disposition of the widgets in the graphic. It is done by invocation `GralWidget.remove()`.
      Specified by:
        `remove` in interface `Removeable`
      Overrides:
        `remove` in class `GralPanelContent`
      Returns:
        true because it is done.

    - #### getPixelPositionSize

          public GralRectangle getPixelPositionSize()

      Specified by:
        `getPixelPositionSize` in interface `GralWindow_getifc`

    - #### addMenuBarItemGThread

          @Deprecated
          public void addMenuBarItemGThread(java.lang.String nameMenu,
                                                         java.lang.String sMenuPath,
                                                         GralUserAction action)

      Deprecated. use `getMenuBar()` and then `GralMenu.addMenuItem(String, String, GralUserAction)`
      It assumes that the window implementation is present. It calls `GralWindowImpl_ifc#addMenuBarArea9ItemGThread(String, String, GralUserAction)` with the known `GralWidget._wdgImpl` instance to invoke the graphic implementation layer method for the window.
      Specified by:
        `addMenuBarItemGThread` in interface `GralWindow_ifc`
        `sMenuPath` - Menu position. Use slash as separator, use & for hot key. For example "&edit/&search/co&ntinue" creates a menu 'edit' or uses the existing one in the top level (menu bar), then creates the search menu item as pull down in menu bar, and then 'continue' with 'n' as hot key as sub-menu. It is stored in `GralWidget.sDataPath`
        `action` - called on menu activation.

    - #### getMenuBar

          public GralMenu getMenuBar()

      Gets the menu bar to add a menu item. If this window hasn't a gral menu bar, then the menu bar is created by calling `GralMng.createMenuBar(GralWindow)`. If the window has a menu bar already, it is stored in the reference `menuBarGral`.
      Specified by:
        `getMenuBar` in interface `GralWindow_ifc`
      Returns:
        the menu root for this window.

    - #### setMouseAction

          public void setMouseAction(GralUserAction action)

      Description copied from interface: `GralWindow_ifc`
      Sets an action which is invoked if any mouse button is pressed in the windows area on the screen.
      Specified by:
        `setMouseAction` in interface `GralWindow_ifc`
      Parameters:
        `action` - The `GralUserAction.userActionGui(int, GralWidget, Object...)` will be called with parameter key: The mouse key. params[0]: Instance of `GralRectangle` with mouse coordinates.

    - #### setResizeAction

          public void setResizeAction(GralUserAction action)

      Description copied from interface: `GralWindow_ifc`
      Sets an action which is invoked if the whole window is resized by user handling on the window borders.
      Specified by:
        `setResizeAction` in interface `GralWindow_ifc`
      Parameters:
        `action` - The `GralUserAction.userActionGui(int, GralWidget, Object...)` will be called without parameter.

    - #### setTitle

          public void setTitle(java.lang.String sTitle)

      Specified by:
        `setTitle` in interface `GralWindow_ifc`

    - #### setFullScreen

          public void setFullScreen(boolean val)

      Specified by:
        `setFullScreen` in interface `GralWindow_setifc`
      Specified by:
        `setFullScreen` in interface `GralWindow_ifc`

    - #### isWindowsVisible

          public boolean isWindowsVisible()

      Specified by:
        `isWindowsVisible` in interface `GralWindow_getifc`