org.vishia.gral.area9

## Class GralArea9MainCmd

- java.lang.Object
- - org.vishia.mainCmd.MainCmd
  - - org.vishia.gral.area9.GralArea9MainCmd

- All Implemented Interfaces:
    MainCmd_ifc, MainCmdLogging_ifc, Report, LogMessage
  Direct Known Subclasses:
    BzrGui.CmdLineAndGui, Fcmd.FcmdMainCmd, InspcGui.CmdLineAndGui, ViewCfg.CmdLineAndGui

      public class GralArea9MainCmd
      extends MainCmd

  This class is an extension of the `MainCmd` for graphic applications. It provides up to 9 areas for panels. With them a basic partitioning of panels can be done. See `GralArea9_ifc`. This instance can used for graphical output without any inheritance in an user application. The user application may inherit from `GuiCfg` instead or use GuiCfg with a special plugin and text-given graphic configuration. GuiCfg aggregates this class. Follow the pattern in `GuiCfg.main(String[])` to build a users application.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.vishia.mainCmd.MainCmd

      `MainCmd.Argument, MainCmd.SetArgument`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected GuiCallingArgs` | `cargs` Aggregation to given instance for the command-line-argument.
    `GralMng` | `gralMng`
    `GralArea9_ifc` | `gui`
    `(package private) LogMessage` | `log`
    `(package private) java.lang.String` | `sArgError`
    `static int` | `version` Version, history and license.

    - ### Fields inherited from class org.vishia.mainCmd.MainCmd

      `argList, bHelpIswritten, cmdLineArgs, currdir, dateFormatMsg, errCmdline, fReport, kError_writeInfoDirectly, kInfo_writeInfoDirectly, kInfoln_writeInfoDirectly, kWarning_writeInfoDirectly, listAboutInfo, listHelpInfo, logMessageImplReport, mError_writeInfoDirectly, mNewln_writeInfoDirectly, msgDisp, mWarning_writeInfoDirectly, nLevelDisplayToReport, nLogLevel, nReportLevelDisplay, outCmdline, sVersion`

    - ### Fields inherited from interface org.vishia.mainCmd.MainCmdLogging_ifc

      `anytime, debug, error, eventOrder, exitSuccessfull, exitUserAbort, exitWithArgumentError, exitWithErrors, exitWithFileProblems, exitWithNotes, exitWithWarnings, fineDebug, fineEventOrder, fineInfo, info, interested, mNeverOutputToDisplay, mReportLevel, warning`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralArea9MainCmd(GuiCallingArgs cargs, java.lang.String[] args)` ctor called in static main.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `callWithoutArguments()` Invoked from parseArguments if no argument is given.
    `protected boolean` | `checkArguments()` Checks the cmdline arguments relation together.
    `void` | `exit()` Exits the cmdline application with the maximum of setted exit error level.
    `boolean` | `parseArgumentsAndInitGraphic(java.lang.String sTitle, java.lang.String sOutputArea)` Builds the graphic and parses the command line parameters.
    `boolean` | `parseArgumentsAndInitGraphic(java.lang.String sTitle, java.lang.String sOutputArea, char sizeShow, java.lang.String position)` Builds the graphic and parses the command line parameters.
    `protected boolean` | `testArgument(java.lang.String arg, int nArg)` Tests one argument.

    - ### Methods inherited from class org.vishia.mainCmd.MainCmd

      `addAboutInfo, addArgument, addHelpInfo, addMsgConfig, addStandardHelpInfo, close, currdir, executeCmdLine, executeCmdLine, executeCmdLine, executeCmdLine, executeCmdLine, executeCmdLine, flush, flushReport, getArgument, getExitErrorLevel, getLogging_ifc, getLogMessageErrorConsole, getLogMessageOutputConsole, getLogMessageOutputFile, getReportFileName, getReportLevel, getReportLevelFromIdent, isOnline, openReportfile, parseArguments, parseArguments, report, report, reportln, reportln, sendMsg, sendMsgTime, sendMsgVaList, setcurrdir, setExitErrorLevel, setLogMessageDestination, setOutputChannels, setReportLevel, setReportLevelToIdent, startCmdLine, startCmdLine, switchToWindowOrStartCmdline, writeAboutInfo, writeDirectly, writeError, writeError, writeErrorDirectly, writeHelpInfo, writeInfo, writeInfoln, writeStackTrace, writeWarning, XXXassertion`

    - ### 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, history and license.
      - 2016-07-10 Hartmut chg: Positioning of Windows on open, especiallythe top level window: with pos-String, it is the new concept of opsitioning of a GralWidget
      - 2015-05-16 Hartmut new "-help:" for help base dir in argument check, "-msgcfg:" in argument check. It is moved from Fcmd to this base class of Fcmd, available generally.
      - 2013-11-22 Hartmut chg: title of main window as argument -title=
      - 2013-01-26 Hartmut chg: The MsgDispatchSystemOutErr.create(file) was invoked in this constructor. Therefore all Applications redirect the System.out and System.err outputs to the message system. The outputs were completed with the time stamp and a number, the `MsgDispatcher` was prepared to use. This capability is removed from here yet. It should be a part of the application. See `GuiCfg.main(String[])`.
      - 2012-07-09 Hartmut new: The `Inspector` will be initialized only if the command line argument "-inspectorPort=" is given. That parameter in form "UDP:ip:port" is used.
      - 2012-04-22 Hartmut new: `#parseArgumentsAndInitGraphic(String, String, int, int, int, int)` for determination of display coordinates in the users application. Getting size arguments from main-args.
      - 2012-03-30 MsgPrintStream systemErrAdapter used here. Now System.err.println can be used to generate an dispatch-able message with numeric identifier.
      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 ist 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

    - #### gui

          public GralArea9_ifc gui

    - #### log

          final LogMessage log

    - #### cargs

          protected final GuiCallingArgs cargs

      Aggregation to given instance for the command-line-argument. The instance can be arranged anywhere else. It is given as ctor-parameter.

    - #### gralMng

          public GralMng gralMng

    - #### sArgError

          java.lang.String sArgError

  - ### Constructor Detail

    - #### GralArea9MainCmd

          public GralArea9MainCmd(GuiCallingArgs cargs,
                                  java.lang.String[] args)

      ctor called in static main.
      Parameters:
        `cargs` - aggregation to command-line-argument data, it will be filled here.
        `args` - The command-line-calling arguments from static main
        `sTitle` - Title in title line
        `sOutputArea` - area for output, for example "3A3C".

  - ### Method Detail

    - #### parseArgumentsAndInitGraphic

          public boolean parseArgumentsAndInitGraphic(java.lang.String sTitle,
                                                      java.lang.String sOutputArea)

      Builds the graphic and parses the command line parameters. Possible command line argument errors or help texts are outputted to the window in the output box.
      Parameters:
        `sTitle` - Title for window
        `sOutputArea` - Use 1..3 for row and A..C for column in form for example "3A3C". In this example the output box occupies all 3 columns (A to C) from the 3. (= bottom) row of the 9 areas. If null is used, the default selection is "3A3C".
      Returns:
        true if it is successfully.

    - #### parseArgumentsAndInitGraphic

          public boolean parseArgumentsAndInitGraphic(java.lang.String sTitle,
                                                      java.lang.String sOutputArea,
                                                      char sizeShow,
                                                      java.lang.String position)

      Builds the graphic and parses the command line parameters. Possible command line argument errors or help texts are outputted to the window in the output box.
      Parameters:
        `sTitle` - Title for window as default if -title= is not given as arg
        `sOutputArea` - Use 1..3 for row and A..C for column in form for example "3A3C". In this example the output box occupies all 3 columns (A to C) from the 3. (= bottom) row of the 9 areas. If null is used, the default selection is "3A3C".
      Returns:
        true if it is successfully.

    - #### testArgument

          protected boolean testArgument(java.lang.String arg,
                                         int nArg)

      Tests one argument. This method is invoked from parseArgument. It is abstract in the superclass MainCmd and must be overwritten from the user. :TODO: user, test and evaluate the content of the argument string or test the number of the argument and evaluate the content in dependence of the number.
      Overrides:
        `testArgument` in class `MainCmd`
      Parameters:
        `argc` - String of the actual parsed argument from cmd line
        `nArg` - number of the argument in order of the command line, the first argument is number 1.
      Returns:
        true is okay, false if the argument doesn't match. The parseArgument method in MainCmd throws an exception, the application should be aborted.

    - #### callWithoutArguments

          protected void callWithoutArguments()

      Invoked from parseArguments if no argument is given. In the default implementation a help info is written and the application is terminated. The user should overwrite this method if the call without comand line arguments is meaningfull.
      Overrides:
        `callWithoutArguments` in class `MainCmd`

    - #### checkArguments

          protected boolean checkArguments()

      Checks the cmdline arguments relation together. If there is an inconsistents, a message should be written. It may be also a warning. :TODO: the user only should determine the specific checks, this is a sample.
      Specified by:
        `checkArguments` in class `MainCmd`
      Returns:
        true if successfull, false if failed.

    - #### exit

          public void exit()

      Description copied from class: `org.vishia.mainCmd.MainCmd`
      Exits the cmdline application with the maximum of setted exit error level. This method should be called only on end of the application, never inside. If the user will abort the application from inside, he should throw an exception instead. So an comprising application may catch the exception and works beyond. This method is not member of MainCmd_Ifc and is setted protected, because the users Main class (UserMain in the introcuction) only should call exit.
      Overrides:
        `exit` in class `MainCmd`