org.vishia.gral.area9

## Class GuiCfg

- java.lang.Object
- - org.vishia.gral.area9.GuiCfg

- Direct Known Subclasses:
    BzrGui, Fcmd, InspcGui.InspcGuiCfg, ViewCfg

      public class GuiCfg
      extends java.lang.Object

  This class is the basic class for configurable GUI applications with 9-Area Main window. It works without any derivation, if only simple widgets are necessary. If additional capabilities are need, this class can uses as the super class. Some protected methods support overriding, especially:
  - `initMain()`: initializes the GUI
  - `stepMain()`: Will be invoked in the main loop.
  - `finishMain()`: invoked on exit.
  Hint: call super.stepMain() etc. in an overridden method if necessary.
  The class contains a `main(String[])`. It is a complete ready to run application. The content of the GUI can be controlled by a script. The command line arguments are parsed in `GralArea9MainCmd`, the universal or basic MainCmd for gral-GUI applications.
  The configuration is done with `GralCfgZbnf` in the `initMain()` routine.
  Registered user action can be used by script.
  - "cmdInvoke": The given parameter 'cmd' of the widget will be executed as command line. It is usefull to start commands from this GUI for example with a button.
  A user plugin class can be plugged which can register some more user actions etc.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `GralMng` | `_gralMng` Especially for debug access to the singleton instance, start with _ to present on top of variables.
    `protected GralUserAction` | `actionFile`
    `(package private) GuiCallingArgs` | `cargs` The calling arguments of this class.
    `private GralUserAction` | `cmdInvoke` Registered as user action.
    `(package private) GralGraphicTimeOrder` | `configGuiWithZbnf` Code snippet to run the ZBNF-configurator (text controlled GUI)
    `Report` | `console` To Output log informations.
    `GralArea9_ifc` | `gui`
    `GralMng_ifc` | `guiAccess`
    `GralCfgData` | `guiCfgData` The configuration data for graphical appearance.
    `GralArea9Window` | `guiW`
    `(package private) GralGraphicTimeOrder` | `initGraphic` Code snippet for initializing the GUI area (panel).
    `private Inspector` | `inspector` Composition of a Inspector-Target instance.
    `MainCmd_ifc` | `mainCmd`
    `protected GralTabbedPanel` | `mainTabPanel`
    `GralMngBuild_ifc` | `panelBuildIfc` Panel-Management-interface for the panels.
    `protected GralPlugUser2Gral_ifc` | `plugUser2Gui`
    `private static GuiCfg` | `singleton`
    `protected GralPlugUser_ifc` | `user` Some actions may be processed by a user implementation.
    `static int` | `version` The version, history and license.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GuiCfg(GuiCallingArgs cargs, GralArea9MainCmd cmdGui, GralPlugUser_ifc plugUser, GralPlugUser2Gral_ifc plugUser2Gui, java.util.List<java.lang.String> cfgConditions)` ctor for the main class of the application.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendTextInfoBox(java.lang.CharSequence text)`
    `void` | `execute()`
    `protected void` | `finishMain()` This routine is called on end of main-execution.
    `static GuiCfg` | `get()`
    `GralPlugUser_ifc` | `getPluggedUser()`
    `protected void` | `initGuiAreas(java.lang.String sMainArea)` Initializes the areas for the panels and configure the panels.
    `protected void` | `initMain()`
    `protected void` | `initMenuGralDesigner()`
    `static void` | `main(java.lang.String[] args)` The command-line-invocation (primary command-line-call).
    `void` | `setTextInfoBox(java.lang.CharSequence text)`
    `void` | `showInfoBox(java.lang.CharSequence text)`
    `protected void` | `stepMain()`
    `(package private) void` | `stop()`
    `protected void` | `userInit()` Will be overridden...

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

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

- - ### Field Detail

    - #### version

          public static final int version

      The version, history and license.
      - 2013-12-02 Hartmut new Parameter for `GuiCfg(GuiCallingArgs, GralArea9MainCmd, GralPlugUser_ifc, GralPlugUser2Gral_ifc, List)`: cfgConditions.
      - 2012-09-17 Hartmut new: `#showMethods`
      - 2011-10-12 Hartmut chg: ctor needs a `GralPlugUser_ifc` which may be null: A plugin may be instantiated by reflection with String given class name. It may be possible to give it as parameter too.
      - 2011-10-20 Hartmut chg: ctor needs a `GralPlugUser2Gral_ifc` which may be null. Idea: a derived class should support it. Other Idea: either both via reflection or both maybe direct.
      - 2011-10-11 Hartmut new: Switches MainCmd-output to OutputBox.
      - 2011-09-30 Hartmut new: menu 'Design/...' to edit fields and work with the `GralCfgDesigner`.
      - 2011-09-18 Hartmut new: The main tab panel has the name 'mainTab' and it is registered in the `_gralMng` now. Generally an application may have more as one tabbed panels.
      - 2011-09-10 Hartmut del: Remove dialogZbnfConfigurator, it was not used. It is the old solution.
      - 2011-09-08 Hartmut del: Remove the message panel. It was a special solution.
      - 2011-08-08 Hartmut new: `initMain()` as override-able method instead direct call of initializing.
      - 2011-08-07 Hartmut chg: Now `GuiCallingArgs` as primary class, not an inner class here.
      - 2011-08-07 Hartmut chg: Now `GralArea9MainCmd` as extra primary class.
      - 2011-08-04 Hartmut chg: rename and move from org/vishia/guiCmdMenu/CmdMenu.java to org/vishia/gral/area9/GuiCfg.java. It is a universal GUI which is configurable in content. Also it is a base class for some configurable GUI applications.
      - 2011-08-04 Hartmut chg: Use `GralPanelContent` instead the special InspcGuiPanelContent.
      - 2011-08-04 Hartmut new: `userInit()` as override-able method instead direct call of user.init(). Advantage: User can do anything in the derived class.
      - 2011-08-04 Hartmut new: Use first key of argument --size: to determine the size. TODO parseArgs
      - 2011-07-31 Hartmut new: First usage as super class.
      - 2010-01-01 Hartmut new: The base of this class was created with some applications.
      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

    - #### inspector

          private final Inspector inspector

      Composition of a Inspector-Target instance. This is only to visit this application for debugging. Not necessary for functionality.

    - #### console

          public final Report console

      To Output log informations. The ouput will be done in the output area of the graphic.

    - #### cargs

          final GuiCallingArgs cargs

      The calling arguments of this class. It may be filled by command line invocation but maybe given in a direct way too while calling this class in a Java environment.

    - #### guiCfgData

          public final GralCfgData guiCfgData

      The configuration data for graphical appearance.

    - #### user

          protected GralPlugUser_ifc user

      Some actions may be processed by a user implementation.

    - #### plugUser2Gui

          protected final GralPlugUser2Gral_ifc plugUser2Gui

    - #### gui

          public final GralArea9_ifc gui

    - #### guiW

          public final GralArea9Window guiW

    - #### mainCmd

          public final MainCmd_ifc mainCmd

    - #### _gralMng

          public GralMng _gralMng

      Especially for debug access to the singleton instance, start with _ to present on top of variables.

    - #### panelBuildIfc

          public GralMngBuild_ifc panelBuildIfc

      Panel-Management-interface for the panels.

    - #### guiAccess

          public GralMng_ifc guiAccess

    - #### mainTabPanel

          protected GralTabbedPanel mainTabPanel

    - #### singleton

          private static GuiCfg singleton

    - #### initGraphic

          GralGraphicTimeOrder initGraphic

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

    - #### configGuiWithZbnf

          GralGraphicTimeOrder configGuiWithZbnf

      Code snippet to run the ZBNF-configurator (text controlled GUI)

    - #### cmdInvoke

          private final GralUserAction cmdInvoke

      Registered as user action.

    - #### actionFile

          protected GralUserAction actionFile

  - ### Constructor Detail

    - #### GuiCfg

          public GuiCfg(GuiCallingArgs cargs,
                        GralArea9MainCmd cmdGui,
                        GralPlugUser_ifc plugUser,
                        GralPlugUser2Gral_ifc plugUser2Gui,
                        java.util.List<java.lang.String> cfgConditions)

      ctor for the main class of the application. The main class can be created in some other kinds as done in static main too. But it needs the `MainCmdWin`.
      The ctor checks whether a gUI-configuration file is given. If not then the default configuration is used. It is especially for the Sample.
      The the GUI will be completed with the content of the GUI-configuration file.
      Parameters:
        `cargs` - The given calling arguments.
        `cmdGui` - The GUI-organization.
        `plugUser2Gui` - maybe possible a instances which plugs the user instance to the GUI. This instance may be defined in the context which calls this constructor. Note: A user instance may be instantiated with the cmd line calling argument "-plugin=JAVACLASSPATH"

  - ### Method Detail

    - #### get

          public static GuiCfg get()

    - #### getPluggedUser

          public GralPlugUser_ifc getPluggedUser()

    - #### userInit

          protected void userInit()

      Will be overridden... TODO InspcGui

    - #### initGuiAreas

          protected void initGuiAreas(java.lang.String sMainArea)

      Initializes the areas for the panels and configure the panels. This routine can be overridden if other areas are need.

    - #### initMenuGralDesigner

          protected void initMenuGralDesigner()

    - #### initMain

          protected void initMain()

    - #### stepMain

          protected void stepMain()

    - #### finishMain

          protected void finishMain()

      This routine is called on end of main-execution. This default implementation calls `Closeable.close()`.

    - #### execute

          public final void execute()

    - #### showInfoBox

          public void showInfoBox(java.lang.CharSequence text)

    - #### setTextInfoBox

          public void setTextInfoBox(java.lang.CharSequence text)

    - #### appendTextInfoBox

          public void appendTextInfoBox(java.lang.CharSequence text)

    - #### main

          public static void main(java.lang.String[] args)

      The command-line-invocation (primary command-line-call).
      Parameters:
        `args` - Some calling arguments are taken. This is the GUI-configuration especially.

    - #### stop

          void stop()