org.vishia.gral.cfg

## Class GralCfgZbnf

- java.lang.Object
- - org.vishia.gral.cfg.GralCfgZbnf

-     public class GralCfgZbnf
      extends java.lang.Object

  Class to read the configuration script for a Graphical User Interface. The syntax of the configuration matches to the class `GralCfgData`, which contains all data of read configuration after invoking the read method. That configuration data are associated in `GralCfgBuilder#GuiCfgBuilder(GralCfgData, GralMngBuild_ifc, File)` and used in `GralCfgBuilder.buildGui(org.vishia.msgDispatch.LogMessage, int)` to build the GUI appearance. The building of the GUI with the `GralCfgData` can be done without this script reader too, but this class reads that data from a script.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private MainCmdLogging_ifc` | `console`
    `(package private) java.io.File` | `currentDir` The current directory is that directory, where the config file is located.
    `private java.io.File` | `fileSyntax`
    `private ZbnfParser` | `parser`
    `static int` | `version` Version and history 2018-09-17 Now the syntax is contained in `org/vishia/gral/cfg/Syntax.zbnf` as file inside jar (ressource).
    `java.lang.String` | `XXXsyntaxStd` Deprecated.
    `private ZbnfJavaOutput` | `zbnfJavaOutput`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralCfgZbnf()`
    `GralCfgZbnf(Report log, java.io.File fileSyntax)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `configureWithZbnf(java.lang.CharSequence configurationZbnf, GralCfgData destination)` Configures the GUI using a description in a file.
    `java.lang.String` | `configureWithZbnf(java.io.File fileConfigurationZbnf, GralCfgData destination)` Configures the GUI using a description in a file.
    `(package private) java.lang.String` | `getSyntaxFromJar()`

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

      Version and history
      - 2018-09-17 Now the syntax is contained in `org/vishia/gral/cfg/Syntax.zbnf` as file inside jar (ressource). It is read with `getSyntaxFromJar()`
      - 2011-05-00 Hartmut created, the old ZbnfCfg.. class is obsolte now.
      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

    - #### parser

          private final ZbnfParser parser

    - #### zbnfJavaOutput

          private final ZbnfJavaOutput zbnfJavaOutput

    - #### console

          private final MainCmdLogging_ifc console

    - #### fileSyntax

          private final java.io.File fileSyntax

    - #### XXXsyntaxStd

          @Deprecated
          public final java.lang.String XXXsyntaxStd

      Deprecated.
      The standard syntax for graphic configuration. Note: it is possible to use an abbreviated syntax with the same semantic if the constructor `GralCfgZbnf(Report, File)` is used. This syntax is used with the constructor
      See Also:
        Constant Field Values

    - #### currentDir

          java.io.File currentDir

      The current directory is that directory, where the config file is located. It is used if other files are given with relative path.

  - ### Constructor Detail

    - #### GralCfgZbnf

          public GralCfgZbnf()

    - #### GralCfgZbnf

          public GralCfgZbnf(Report log,
                             java.io.File fileSyntax)

  - ### Method Detail

    - #### getSyntaxFromJar

          java.lang.String getSyntaxFromJar()

      Returns:
        null if not found.

    - #### configureWithZbnf

          public java.lang.String configureWithZbnf(java.io.File fileConfigurationZbnf,
                                                    GralCfgData destination)

      Configures the GUI using a description in a file. The syntax is described see `#configureWithZbnf(String, String)`. Because the configuration is containing in a user-accessible file, it may be faulty. Than a error message was written on the own Report output. Therefore this routine should be called after the main application is started. See example in `appl.menu.Menu`.
      Parameters:
        `sTitle` - Title line for the application
        `fileConfigurationZbnf` - File containing the configuration. The file should be exist and able to read.
      Returns:
        true if successfully, false on any error. If false, an error message was written using the own Report-implementation.

    - #### configureWithZbnf

          public void configureWithZbnf(java.lang.CharSequence configurationZbnf,
                                        GralCfgData destination)
                                 throws java.text.ParseException

      Configures the GUI using a description in a file. The syntax is described see `#configureWithZbnf(String, String)`. Because the configuration is containing in a user-accessible file, it may be faulty. Than a error message was written on the own Report output. Therefore this routine should be called after the main application is started. See example in `appl.menu.Menu`.
      Parameters:
        `sTitle` - Title line for the application
        `fileConfigurationZbnf` - File containing the configuration. The file should be exist and able to read.
      Throws:
        `java.text.ParseException`