org.vishia.commander

## Class Fcmd

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

-     public class Fcmd
      extends GuiCfg

  This class is the main class of the-File-commander.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `Fcmd.CallingArgs`
    `private static class` | `Fcmd.FcmdMainCmd` This class is instantiated in the static main routine and builds a command line interface and the graphical frame.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) GralUserAction` | `actionDragFileFromStatusLine` This callback will be invoked in the drag event while the mouse is released in the destination.
    `(package private) GralUserAction` | `actionEdit` Key F4 for edit command.
    `(package private) GralUserAction` | `actionFocusCardInPanelToLeft`
    `(package private) GralUserAction` | `actionFocusCardInPanelToRight`
    `(package private) GralUserAction` | `actionFocusCmdCard` Action to focus the cmd card.
    `(package private) GralUserAction` | `actionFocusFileCard`
    `(package private) GralUserAction` | `actionFocusPanelToLeft`
    `(package private) GralUserAction` | `actionFocusPanelToRight`
    `(package private) GralUserAction` | `actionFocusThemeCard`
    `(package private) GralUserAction` | `actionKey` This action is invoked for all general key pressed actions.
    `(package private) GralUserAction` | `actionReadMsgConfig` Key alt-F1 to select a directory/cmd list in a list of directories for the left panel.
    `(package private) GralUserAction` | `actionTest` This action is invoked for all general key pressed actions.
    `JZtxtcmdScript.AddSub2List` | `addButtonCmd`
    `(package private) java.util.Map<java.lang.String,JZtxtcmdScript.Subroutine>` | `buttonCmds` The commands which are used for some buttons or menu items from the JavaCommander itself.
    `(package private) Fcmd.CallingArgs` | `cargs`
    `(package private) FcmdCopyCmprDel` | `compareCmd`
    `(package private) FcmdCopyCmprDel` | `copyCmd`
    `(package private) FcmdFileCard` | `currentFileCard`
    `(package private) FcmdCopyCmprDel` | `delCmd`
    `(package private) FcmdDelete` | `deleteCmd`
    `(package private) FcmdEdit` | `editWind`
    `(package private) FcmdExecuter` | `executer`
    `(package private) FcmdFavorPathSelector` | `favorPathSelector`
    `(package private) FcmdButtons` | `fButtons`
    `(package private) FileCluster` | `fileCluster`
    `(package private) FcmdFileProps` | `filePropsCmd`
    `(package private) FcmdFilesCp` | `filesCp`
    `protected CmdGetterArguments` | `getterFileArguments` This implementation resolves the arguments for invoked commands with the capabilities of the Fcmd.
    `(package private) FcmdIdents` | `idents` Note: this should be the last aggregate of Fcmd because it uses some other ones.
    `(package private) java.util.Map<java.lang.String,GralFileSelector>` | `idxFileSelector`
    `(package private) FcmdKeyActions` | `keyActions`
    `(package private) FcmdFavorCard` | `lastFavorCard` The last used favor card or its last used file card.
    `(package private) java.util.List<FcmdLeftMidRightPanel>` | `lastFilePanels` The last selected file panels in its order of selection.
    `private static Fcmd` | `main` Static reference for the main instance to access from any class in the package.
    `(package private) FcmdMkDirFile` | `mkCmd`
    `(package private) MsgRedirectConsole` | `msgDisp`
    `(package private) java.lang.String` | `nameTextFieldFilePath`
    `(package private) java.lang.String` | `nameTextFieldInfo`
    `(package private) java.lang.String` | `nameTextFieldRunInfo`
    `(package private) GralPanelContent` | `panelButtons`
    `(package private) GralUserAction` | `selectCardThemesLeft` Key alt-F1 to select a directory/cmd list in a list of directories for the left panel.
    `(package private) GralUserAction` | `selectCardThemesMiddle` Key alt-F2 to select a directory/cmd list in a list of directories for the middle panel.
    `(package private) GralUserAction` | `selectCardThemesRight` Key alt-F3 to select a directory/cmd list in a list of directories for the right panel.
    `(package private) java.io.File[]` | `selectedFiles123` The last selected files of the three panels, [0] for left .. [2] for right.
    `(package private) GralUserAction` | `selectFileCardLeft` Key sh-F1 to select a directory/cmd list in a list of directories for the right panel.
    `(package private) GralUserAction` | `selectFileCardMid` Key sh-F2 to select a directory/cmd list in a list of directories for the right panel.
    `(package private) GralUserAction` | `selectFileCardOther` Key sh-F3 to select a directory/cmd list in a list of directories for the right panel.
    `(package private) GralUserAction` | `selectFileCardRight` Key sh-F3 to select a directory/cmd list in a list of directories for the right panel.
    `(package private) FcmdSettings` | `settings`
    `(package private) FcmdStatus` | `status`
    `(package private) FcmdStatusLine` | `statusLine`
    `(package private) FcmdtTarget_ifc` | `target`
    `(package private) java.util.List<java.io.Closeable>` | `threadsToClose`
    `static java.lang.String` | `version` Version, history and license.
    `(package private) FcmdView` | `viewCmd`
    `(package private) FcmdWindowMng` | `windMng`

    - ### Fields inherited from class org.vishia.gral.area9.GuiCfg

      `_gralMng, actionFile, console, gui, guiAccess, guiCfgData, guiW, mainCmd, mainTabPanel, panelBuildIfc, plugUser2Gui, user`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Fcmd(Fcmd.CallingArgs cargs, GralArea9MainCmd cmdgui)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) FileRemote` | `currentDir()`
    `(package private) FileRemote` | `currentFile()`
    `void` | `finishMain()` Executing in the main thread loop.
    `(package private) FcmdFileCard` | `getLastSelectedFileCard()` Get the last selected file card in order of selection of the file panels.
    `(package private) FcmdFileCard[]` | `getLastSelectedFileCards()` Get the last selected file cards in order of selection of the file panels.
    `(package private) FileRemote[]` | `getLastSelectedFiles(boolean bAlsoDirs, int mask)` Get the last selected files in order of selection of the file panels.
    `(package private) java.util.List<java.io.File>[]` | `getLastSelectedFilesPerCard()` Get the last selected file cards in order of selection of the file panels.
    `protected void` | `initGuiAreas(java.lang.String sAreaMainPanel)` Initializes the areas for the panels and configure the panels.
    `protected void` | `initMain()`
    `(package private) static Fcmd` | `main()` Access the static instance of Fcmd.
    `static void` | `main(java.lang.String[] args)` The command-line-invocation (primary command-line-call.
    `(package private) void` | `openExtEditor(java.io.File file)`
    `protected void` | `refreshFilePanel(FileRemote fileOrDir)` Refreshes the `FcmdFileCard` if the dir is the current one.
    `(package private) void` | `setLastSelectedPanel(FcmdLeftMidRightPanel panel)`
    `void` | `stepMain()` Executing in the main thread loop.
    `(package private) static void` | `testT1()`

    - ### Methods inherited from class org.vishia.gral.area9.GuiCfg

      `appendTextInfoBox, execute, get, getPluggedUser, initMenuGralDesigner, setTextInfoBox, showInfoBox, userInit`

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

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

- - ### Field Detail

    - #### version

          public static final java.lang.String version

      Version, history and license. This String is visible in the about info.
      - 2017-08-27 `FcmdFavorPathSelector.actionDeselectDirtree` now removes all FileRemote instances of children because a selection is not necessary furthermore. This is a 'refresh'. But the 'refresh' (F5, ctrl-R) should not change selection, it must not delete this children-FileRemote. Only deselection is the key action for that.
      - 2016-08-28 see `FcmdExecuter#sVersion`, `FcmdSettings.sVersion`
      - 2015-07-18 Hartmut chg: Now the output of script errors while executing the JZcmd cmd script is visible in the output window.
      - 2015-07-12 Hartmut new: Many fixes in the base classes for functionality. See all commit messages of the component.
      - 2014-12-26 Hartmut new: `refreshFilePanel(FileRemote)` can be called in any callback thread.
      - 2011-2013 some changes, see source files.
      - 2011-10-00 Hartmut created
      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

    - #### actionTest

          GralUserAction actionTest

      This action is invoked for all general key pressed actions. It tests the key and switches to the concretely action for the pressed key. General keys are [F1] for help, [F4] for edit etc.

    - #### actionKey

          GralUserAction actionKey

      This action is invoked for all general key pressed actions. It tests the key and switches to the concretely action for the pressed key. General keys are [F1] for help, [F4] for edit etc.

    - #### actionReadMsgConfig

          GralUserAction actionReadMsgConfig

      Key alt-F1 to select a directory/cmd list in a list of directories for the left panel. The original Norton Commander approach is to select a drive letter for windows. Selection of paths instead are adequate.

    - #### selectCardThemesLeft

          GralUserAction selectCardThemesLeft

      Key alt-F1 to select a directory/cmd list in a list of directories for the left panel. The original Norton Commander approach is to select a drive letter for windows. Selection of paths instead are adequate.

    - #### selectCardThemesMiddle

          GralUserAction selectCardThemesMiddle

      Key alt-F2 to select a directory/cmd list in a list of directories for the middle panel.

    - #### selectCardThemesRight

          GralUserAction selectCardThemesRight

      Key alt-F3 to select a directory/cmd list in a list of directories for the right panel.

    - #### selectFileCardLeft

          GralUserAction selectFileCardLeft

      Key sh-F1 to select a directory/cmd list in a list of directories for the right panel.

    - #### selectFileCardMid

          GralUserAction selectFileCardMid

      Key sh-F2 to select a directory/cmd list in a list of directories for the right panel.

    - #### selectFileCardRight

          GralUserAction selectFileCardRight

      Key sh-F3 to select a directory/cmd list in a list of directories for the right panel.

    - #### selectFileCardOther

          GralUserAction selectFileCardOther

      Key sh-F3 to select a directory/cmd list in a list of directories for the right panel.

    - #### actionFocusPanelToLeft

          GralUserAction actionFocusPanelToLeft

    - #### actionFocusPanelToRight

          GralUserAction actionFocusPanelToRight

    - #### actionFocusFileCard

          GralUserAction actionFocusFileCard

    - #### actionFocusThemeCard

          GralUserAction actionFocusThemeCard

    - #### actionFocusCmdCard

          GralUserAction actionFocusCmdCard

      Action to focus the cmd card.

    - #### actionFocusCardInPanelToLeft

          GralUserAction actionFocusCardInPanelToLeft

    - #### actionFocusCardInPanelToRight

          GralUserAction actionFocusCardInPanelToRight

    - #### actionEdit

          GralUserAction actionEdit

      Key F4 for edit command. Its like Norton Commander.

    - #### actionDragFileFromStatusLine

          GralUserAction actionDragFileFromStatusLine

      This callback will be invoked in the drag event while the mouse is released in the destination.

    - #### getterFileArguments

          protected CmdGetterArguments getterFileArguments

      This implementation resolves the arguments for invoked commands with the capabilities of the Fcmd. Especially the following argument strings are supported:
      This instance is used only locally (private). It is designated as protected for documentation.

    - #### addButtonCmd

          public JZtxtcmdScript.AddSub2List addButtonCmd

    - #### cargs

          final Fcmd.CallingArgs cargs

    - #### msgDisp

          final MsgRedirectConsole msgDisp

    - #### fileCluster

          final FileCluster fileCluster

    - #### windMng

          final FcmdWindowMng windMng

    - #### fButtons

          final FcmdButtons fButtons

    - #### statusLine

          final FcmdStatusLine statusLine

    - #### nameTextFieldInfo

          final java.lang.String nameTextFieldInfo

      See Also:
        Constant Field Values

    - #### nameTextFieldFilePath

          final java.lang.String nameTextFieldFilePath

      See Also:
        Constant Field Values

    - #### nameTextFieldRunInfo

          final java.lang.String nameTextFieldRunInfo

      See Also:
        Constant Field Values

    - #### panelButtons

          GralPanelContent panelButtons

    - #### favorPathSelector

          final FcmdFavorPathSelector favorPathSelector

    - #### executer

          final FcmdExecuter executer

    - #### settings

          final FcmdSettings settings

    - #### status

          final FcmdStatus status

    - #### filePropsCmd

          final FcmdFileProps filePropsCmd

    - #### viewCmd

          final FcmdView viewCmd

    - #### editWind

          final FcmdEdit editWind

    - #### copyCmd

          final FcmdCopyCmprDel copyCmd

    - #### delCmd

          final FcmdCopyCmprDel delCmd

    - #### compareCmd

          final FcmdCopyCmprDel compareCmd

    - #### mkCmd

          final FcmdMkDirFile mkCmd

    - #### deleteCmd

          final FcmdDelete deleteCmd

    - #### filesCp

          final FcmdFilesCp filesCp

    - #### keyActions

          final FcmdKeyActions keyActions

    - #### idents

          final FcmdIdents idents

      Note: this should be the last aggregate of Fcmd because it uses some other ones.

    - #### selectedFiles123

          final java.io.File[] selectedFiles123

      The last selected files of the three panels, [0] for left .. [2] for right.

    - #### lastFilePanels

          java.util.List<FcmdLeftMidRightPanel> lastFilePanels

      The last selected file panels in its order of selection. This list contains max 3 entries. To get the last selected files: The panel knows the last used file card there.

    - #### lastFavorCard

          FcmdFavorCard lastFavorCard

      The last used favor card or its last used file card. It is used for delete tab.

    - #### currentFileCard

          FcmdFileCard currentFileCard

    - #### idxFileSelector

          final java.util.Map<java.lang.String,GralFileSelector> idxFileSelector

    - #### target

          FcmdtTarget_ifc target

    - #### buttonCmds

          final java.util.Map<java.lang.String,JZtxtcmdScript.Subroutine> buttonCmds

      The commands which are used for some buttons or menu items from the JavaCommander itself.

    - #### threadsToClose

          final java.util.List<java.io.Closeable> threadsToClose

    - #### main

          private static Fcmd main

      Static reference for the main instance to access from any class in the package. This static instance is set firstly in constructor, all other constructors in this package can be used it therefore. Use `main()`

  - ### Constructor Detail

    - #### Fcmd

          public Fcmd(Fcmd.CallingArgs cargs,
                      GralArea9MainCmd cmdgui)

  - ### Method Detail

    - #### openExtEditor

          void openExtEditor(java.io.File file)

    - #### main

          static Fcmd main()

      Access the static instance of Fcmd. This static instance is set firstly in constructor, all other constructors in this package can be used it therefore.

    - #### initGuiAreas

          protected void initGuiAreas(java.lang.String sAreaMainPanel)

      Initializes the areas for the panels and configure the panels. Note that the window is initialized with an output area already. This is used for output messages if problems occurs while build the rest of the GUI.
      Overrides:
        `initGuiAreas` in class `GuiCfg`

    - #### initMain

          protected final void initMain()

      Overrides:
        `initMain` in class `GuiCfg`

    - #### stepMain

          public void stepMain()

      Executing in the main thread loop. It handles commands.
      Overrides:
        `stepMain` in class `GuiCfg`
      See Also:
        `GuiCfg.stepMain()`

    - #### finishMain

          public void finishMain()

      Executing in the main thread loop. It handles commands.
      Overrides:
        `finishMain` in class `GuiCfg`
      See Also:
        `GuiCfg.stepMain()`

    - #### setLastSelectedPanel

          void setLastSelectedPanel(FcmdLeftMidRightPanel panel)

    - #### getLastSelectedFiles

          FileRemote[] getLastSelectedFiles(boolean bAlsoDirs,
                                            int mask)

      Get the last selected files in order of selection of the file panels. If the current file of any panel is marked, then all other marked files (but not directories) of this panel are taken as next files. But only 3 at all. It is possible to mark two files in one file panel to execute an application with them. New method since 2011-12-23
      Returns:
        array[3] of the last selected files in the file panels. It has always a length of 3 but not all elements are set ( they are ==null) if no files were selected before. The returned instance is a new one, not referenced elsewhere. It can be stored and it remains the situation of selection files independently of further user actions.

    - #### getLastSelectedFileCards

          FcmdFileCard[] getLastSelectedFileCards()

      Get the last selected file cards in order of selection of the file panels.
      Returns:
        array[3] of the last selected file cards in the file panels. It has always a length of 3 but not all elements are set ( they are ==null) if the file cards are not opened before in the panel. The returned instance is a new one, not referenced elsewhere. It can be stored and it remains the situation of selection files independently of further user actions.

    - #### getLastSelectedFilesPerCard

          java.util.List<java.io.File>[] getLastSelectedFilesPerCard()

      Get the last selected file cards in order of selection of the file panels.
      Returns:
        array[3] of the last selected file cards in the file panels. It has always a length of 3 but not all elements are set ( they are ==null) if the file cards are not opened before in the panel. The returned instance is a new one, not referenced elsewhere. It can be stored and it remains the situation of selection files independently of further user actions.

    - #### getLastSelectedFileCard

          FcmdFileCard getLastSelectedFileCard()

      Get the last selected file card in order of selection of the file panels.
      Returns:
        The file card reference.

    - #### currentFile

          FileRemote currentFile()

    - #### currentDir

          FileRemote currentDir()

    - #### refreshFilePanel

          protected void refreshFilePanel(FileRemote fileOrDir)

      Refreshes the `FcmdFileCard` if the dir is the current one. This method can be invoked in any for example callback routine in any thread, which changes the content of directories. Note: It starts `GralFileSelector.fillIn(FileRemote, boolean)` which refreshes the files
      Parameters:
        `fileOrDir` - The changed file or its directory. it is checked whether the directory is shown currently in one of the three file panels, then the panel will be refreshed. If the directory is not shown yet then nothing is done. Note that a directory will be refreshed whenever it will be activated in a panel.

    - #### testT1

          static void testT1()

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