org.vishia.commander

## Class FcmdFileCard

- java.lang.Object
- - org.vishia.gral.base.GralWidget
  - - org.vishia.gral.widget.GralFileSelector
    - - org.vishia.commander.FcmdFileCard

- All Implemented Interfaces:
    GetGralWidget_ifc, GralSetValue_ifc, GralWidget_ifc, Removeable

      public class FcmdFileCard
      extends GralFileSelector

  This is one file table in the the.File.commander. Each main panel (left, middle, right) has maybe more as one tabs, each tab has exactly one file table. The file table is reused for the several tabs of the main panel, and they are reused too if the directory is changed.
  Synchronization of 2 file cards:
  If the synchronization is switch on with `FcmdFavorPathSelector.bSyncMidRight` then `syncWithSecondPanel(String)` is called with the filename. Therewith the same file in the second panel (middle or right) will be selected if it exists. If an existing directory is selected, the other file card follows it if it exists. So the user can walk through two file trees which have the same structure, but maybe some different content. It is proper for comparison.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.vishia.gral.widget.GralFileSelector

      `GralFileSelector.FileSelectList, GralFileSelector.MenuTexts, GralFileSelector.WindowConfirmSearch`

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

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

    - ### 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
    --- | ---
    `(package private) GralUserAction` | `actionFocused` This action is bound in the File selection table.
    `(package private) GralUserAction` | `actionOnFileSelection` Action to show the file properties in the info line.
    `(package private) GralUserAction` | `actionSetFileLineAttrib` Sets the color of the table line adequate to the select state of the file.
    `(package private) GralUserAction` | `actionSetFromTabSelection`
    `(package private) GralColor[]` | `colorSelectFocused123`
    `(package private) FcmdFavorCard` | `favorCard` Table widget for the select table of the file tab.
    `(package private) FcmdFavorPathSelector.FavorPath` | `favorPathInfo` Association to the current used favor path selection.
    `(package private) java.lang.String` | `label` The label which is written in the line of favor file after l:label m:label r:label It is the label on the tab.
    `(package private) Fcmd` | `main` The component
    `(package private) FcmdLeftMidRightPanel` | `mainPanel` The left, mid or right main panel where this tabbed file table is associated.
    `(package private) java.lang.String` | `nameFilePanel` The search-name of the tabbed file panel where this Table is placed on.
    `(package private) FcmdFileCard` | `otherFileCardtoSync` If not null, then should synchronize with this file card.
    `(package private) java.lang.String` | `sDirSync` If not null, then it is the base dir for synchronization with the `otherFileCardtoSync`.
    `(package private) java.lang.String` | `sLocaldir`
    `(package private) java.lang.String` | `sLocalpath`
    `static int` | `version` Version, history and license 2012-03-09 Hartmut new: Now the synchronization between 2 panels works independent of the comparison with a improved algorithm.
    `(package private) GralHorizontalSelector<java.lang.Object>` | `wdgCardSelector`
    `(package private) int` | `zDirSync` length of sDirSync or -1 It will be set in `FcmdFilesCp.setDirs()`.

    - ### Fields inherited from class org.vishia.gral.widget.GralFileSelector

      `actionOnFileSelected, callbackChildren1, contextMenuTexts, currentDir, currentFile, durationFillin, durationRefresh, favorList, kColDate, kColDesignation, kColFilename, kColLength, kSortDateNewest, kSortDateOldest, kSortExtension, kSortExtensionNonCase, kSortName, kSortNameNonCase, kSortSizeLargest, kSortSizeSmallest, refreshCount, selectList, showTime, sVersion, timeFilesRefreshed, timeFillinFinished, timeFillinInvoked, widgBtnFavor, widgdPathDir, windSearch, zColumns`

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

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

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FcmdFileCard(FcmdLeftMidRightPanel mainPanelP, java.lang.String label)` Creates the cards with tabs for the files and for the favorite paths.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `actionOnFileSelection(FileRemote file, java.lang.String sFileName)` This routine is invoked from `actionOnFileSelection` action listener whenever a file in any file card will be selected (key up, down, mouse click etc.).
    `boolean` | `actionUserKey(int keyCode, java.lang.Object oData, GralTableLine_ifc line)` This method is called on any user key or mouse event while operating in the file table.
    `private void` | `buildGraphic()`
    `boolean` | `remove()` Removes this file card with its widgets and data.
    `(package private) FileCompare.Result` | `searchCompareResult(java.io.File file)` Searches whether the given file has a comparison result in this file card.
    `private void` | `setActFilePanel_setColorCurrLine()` Sets the panel which contains this File card as actual, adjust the order of actual file panels and sets the color of the current line of table of all 3 current file panels to the 3-stage color to see which table has the focus.
    `void` | `setFocus()` Overrides the `GralFileSelector.setFocus()` and calls him, before that sets the color of the current line of table of all 3 current file panels to the 3-stage color to see which table has the focus.
    `(package private) void` | `setFocusFavorOrFile()`
    `(package private) void` | `setNewContent(FcmdFavorPathSelector.FavorPath favorPathInfoP, FileRemote dir)` Sets a new content for this file table because another favor or tab is selected
    `(package private) void` | `syncWithSecondPanel(java.lang.String sFileName)`
    `java.lang.String` | `toString()` Especially for test and debug, short info about widget.

    - ### Methods inherited from class org.vishia.gral.widget.GralFileSelector

      `buildKey, checkRefresh, createImplWidget_Gthread, createWindowConfirmSearchGthread, currentDir, currentFile, fillIn, fillInCurrentDir, fillInOriginDir, forcefillIn, getCurrentDir, getCurrentDirPath, getSelectedFiles, selectFile, setActionOnEnterDirectory, setActionOnEnterFile, setActionOnEnterPathNewFile, setActionSetFileLineAttrib, setDateFormat, setNameWidget, setOriginDir, setSortOrder, setSortOrderFiles, setVisible, specifyActionOnFileSelected, XXXgetSelectedFile`

    - ### 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, repaint, repaint, requestNewValueForVariable, setActionChange, setActionFocused, setActionMouse, setActionShow, setBackColor, setBackgroundColor, setBoundsPixel, setCfgElement, setCmd, setContentIdent, setContentInfo, setData, setDataIx, setDataPath, setDragEnable, setDropEnable, setEditable, setFocus, setForegroundColor, setFormat, setHtmlHelp, setLineColor, setLongValue, setMinMax, setPanelMng, setPrimaryWidgetOfPanel, setText, setTextColor, setToolTip, setToPanel, setValue, setValue, setValue, setValue, setVisibleState, setVisibleStateWidget, specifyActionChange, specifyContextMenu, XXXgetPixelPositionSize, XXXgetWidgetImplementation, XXXremoveWidgetImplementation, XXXrepaintGthread, XXXsetFocusGThread, XXXsetVisibleGThread`

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

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

- - ### Field Detail

    - #### version

          public static final int version

      Version, history and license
      - 2012-03-09 Hartmut new: Now the synchronization between 2 panels works independent of the comparison with a improved algorithm.
      - 2012-02-04 Hartmut new: `searchCompareResult(File)` supports working with comparison result, used to set equal if a file was copied.
      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

    - #### favorCard

          FcmdFavorCard favorCard

      Table widget for the select table of the file tab.

    - #### main

          final Fcmd main

      The component

    - #### mainPanel

          final FcmdLeftMidRightPanel mainPanel

      The left, mid or right main panel where this tabbed file table is associated.

    - #### colorSelectFocused123

          GralColor[] colorSelectFocused123

    - #### nameFilePanel

          final java.lang.String nameFilePanel

      The search-name of the tabbed file panel where this Table is placed on. It is the visible label of the tab, following by ".1" till ".3" for the three panels.

    - #### label

          final java.lang.String label

      The label which is written in the line of favor file after l:label m:label r:label It is the label on the tab.

    - #### wdgCardSelector

          final GralHorizontalSelector<java.lang.Object> wdgCardSelector

    - #### favorPathInfo

          FcmdFavorPathSelector.FavorPath favorPathInfo

      Association to the current used favor path selection. Note that this instance is re-used for more as one selection.

    - #### otherFileCardtoSync

          FcmdFileCard otherFileCardtoSync

      If not null, then should synchronize with this file card. Used in

    - #### sDirSync

          java.lang.String sDirSync

      If not null, then it is the base dir for synchronization with the `otherFileCardtoSync`. It will be set in `FcmdFilesCp.setDirs()`.

    - #### zDirSync

          int zDirSync

      length of sDirSync or -1 It will be set in `FcmdFilesCp.setDirs()`.

    - #### sLocalpath

          java.lang.String sLocalpath

    - #### sLocaldir

          java.lang.String sLocaldir

    - #### actionOnFileSelection

          GralUserAction actionOnFileSelection

      Action to show the file properties in the info line. This action is called anytime if a line was changed in the file view table.

    - #### actionSetFileLineAttrib

          GralUserAction actionSetFileLineAttrib

      Sets the color of the table line adequate to the select state of the file.

    - #### actionFocused

          GralUserAction actionFocused

      This action is bound in the File selection table. If it is focused, the current file tables of the other file panels will gotten the `#colorSelectNonFocused` to show that are not the first one. The file table of this is set with the `#colorSelectFocused`. Twice the `Fcmd.lastFilePanels` list is ordered with this panel as first one.

    - #### actionSetFromTabSelection

          GralUserAction actionSetFromTabSelection

  - ### Constructor Detail

    - #### FcmdFileCard

          FcmdFileCard(FcmdLeftMidRightPanel mainPanelP,
                       java.lang.String label)

      Creates the cards with tabs for the files and for the favorite paths. This ctor will be called in the graphic thread. Therefore it can initialize the graphic for the fileCard and for the associated favor card in this code.
      Parameters:
        `mainPanelP` - The left, mid or right panel where this cards are assigned to
        `label` - The label of the tab, it builds the name of all widgets.

  - ### Method Detail

    - #### buildGraphic

          private void buildGraphic()

    - #### setNewContent

          void setNewContent(FcmdFavorPathSelector.FavorPath favorPathInfoP,
                             FileRemote dir)

      Sets a new content for this file table because another favor or tab is selected
      Parameters:
        `favorPathInfoP` -
        `dir` -
        `mode` - 0 no tab, 1 -temporary tab, 2 - new tab

    - #### setFocusFavorOrFile

          void setFocusFavorOrFile()

    - #### setFocus

          public void setFocus()

      Overrides the `GralFileSelector.setFocus()` and calls him, before that sets the color of the current line of table of all 3 current file panels to the 3-stage color to see which table has the focus.
      Specified by:
        `setFocus` in interface `GralWidget_ifc`
      Overrides:
        `setFocus` in class `GralFileSelector`
      See Also:
        `GralWidget_ifc.setFocus()`

    - #### remove

          public boolean remove()

      Removes this file card with its widgets and data. It is 'close tab'.
      Specified by:
        `remove` in interface `Removeable`
      Overrides:
        `remove` in class `GralFileSelector`
      Returns:
        true if successfully. If false it is a hint for the application that the instance itself should not be removed.

    - #### searchCompareResult

          FileCompare.Result searchCompareResult(java.io.File file)

      Searches whether the given file has a comparison result in this file card. That method is used to present the file in the table with comparison result information and to change the comparison result if the file was copied.
      Parameters:
        `file` - The file, usual selected in the file table
      Returns:
        null a comparison result is not existed, elsewhere the result.

    - #### actionUserKey

          public boolean actionUserKey(int keyCode,
                                       java.lang.Object oData,
                                       GralTableLine_ifc line)

      Description copied from class: `GralFileSelector`
      This method is called on any user key or mouse event while operating in the file table. It should be overwritten by a derived class. This routine is empty.
      Overrides:
        `actionUserKey` in class `GralFileSelector`
        `oData` - The user data stored in the line of table.
        `line` - The table line.
      Returns:
        true if is was relevant for the key.

    - #### actionOnFileSelection

          protected void actionOnFileSelection(FileRemote file,
                                               java.lang.String sFileName)

      This routine is invoked from `actionOnFileSelection` action listener whenever a file in any file card will be selected (key up, down, mouse click etc.). The routine writes infos about the file and may synchronize with another file card.
      Parameters:
        `file` - The currently selected file.
        `sFileName` - Text in the cell, especially ".." for the parent dir entry.

    - #### syncWithSecondPanel

          void syncWithSecondPanel(java.lang.String sFileName)

    - #### setActFilePanel_setColorCurrLine

          private void setActFilePanel_setColorCurrLine()

      Sets the panel which contains this File card as actual, adjust the order of actual file panels and sets the color of the current line of table of all 3 current file panels to the 3-stage color to see which table has the focus. Sets `Fcmd.lastFavorCard`, `FcmdLeftMidRightPanel.actFileCard`, `Fcmd.lastFilePanels`.

    - #### toString

          public java.lang.String toString()

      Description copied from class: `GralWidget`
      Especially for test and debug, short info about widget.
      Overrides:
        `toString` in class `GralWidget`
      See Also:
        `Object.toString()`