org.vishia.gral.widget

## Class GralFileSelectWindow

- java.lang.Object
- - org.vishia.gral.widget.GralFileSelectWindow

- All Implemented Interfaces:
    GralFileDialog_ifc

      public class GralFileSelectWindow
      extends java.lang.Object
      implements GralFileDialog_ifc

  A window for search-in-file dialogue. It is instantiated calling `GralFileSelector.createWindowConfirmSearchGthread(GralMngBuild_ifc)`. The user can invoke `#confirmSearchInFiles(GralFileSelector, Appendable)` to open that window.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) GralUserAction` | `actionOk` Action of OK button or enter button.
    `(package private) GralUserAction` | `actionOkForUser`
    `(package private) GralUserAction` | `actionSelectFile`
    `private java.io.File` | `dir`
    `private GralFileSelector` | `fileSelector`
    `static int` | `version` Version, history and license.
    `private GralButton` | `widgButtonOk`
    `private GralTextField` | `widgFilename`
    `private GralWindow_ifc` | `wind`

    - ### Fields inherited from interface org.vishia.gral.ifc.GralFileDialog_ifc

      `directory, multi`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GralFileSelectWindow(java.lang.String name, GralMngBuild_ifc mng)` Creates the window to confirm search in files.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeWindow()`
    `java.lang.String[]` | `getMultiSelection()`
    `java.lang.String` | `getSelection()` Returns the last selected local path and file.
    `boolean` | `open(java.lang.String sTitle, int mode)`
    `void` | `openDialog(FileRemote startDir, java.lang.String sTitle, boolean bForWrite, GralUserAction actionSelect)` Prepares the action and appearance and shows the window.
    `java.lang.String` | `show(java.lang.String sBaseDir, java.lang.String sLocalDir, java.lang.String sMask, java.lang.String sTitle)` Shows the file dialog.

    - ### 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. The version number is a date written as yyyymmdd as decimal number. Changes:
      - 2013-03-28 Hartmut implements `GralFileDialog_ifc` because it should be so. TODO tuning with the other possibility `SwtFileDialog` which uses the standard file dialog of windows or linux
      - 2013-03-28 Hartmut creating, it was a static inner class of `GralFileSelector`
      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

    - #### wind

          private final GralWindow_ifc wind

    - #### fileSelector

          private final GralFileSelector fileSelector

    - #### widgFilename

          private final GralTextField widgFilename

    - #### widgButtonOk

          private final GralButton widgButtonOk

    - #### actionOkForUser

          GralUserAction actionOkForUser

    - #### dir

          private java.io.File dir

    - #### actionOk

          GralUserAction actionOk

      Action of OK button or enter button. It returns the file in the shown directory with the name written in the widgFilename-textfield. It is not the selected file. But the textfield is filled with the name of the selected file if a file was selected in the table.

    - #### actionSelectFile

          GralUserAction actionSelectFile

  - ### Constructor Detail

    - #### GralFileSelectWindow

          public GralFileSelectWindow(java.lang.String name,
                                      GralMngBuild_ifc mng)

      Creates the window to confirm search in files. This window can be created only one time for all file panels, if the application has more as one. On activating the directory and the file panel to show results should be given. But only one search process can be run simultaneously.

  - ### Method Detail

    - #### openDialog

          public void openDialog(FileRemote startDir,
                                 java.lang.String sTitle,
                                 boolean bForWrite,
                                 GralUserAction actionSelect)

      Prepares the action and appearance and shows the window. The param actionSelect is called if the user presses the Button on right bottom. The button is marked with "select" or "write" depending on the param bForWrite. For actionSelect the method `GralUserAction.exec(int, GralWidget_ifc, Object...)` is called with null for the widget (a widget should not necessary for the user) but with the selected File(s) as Object parameter. If one file is selected the first Object is instanceof File. If more as one files are selected a List or File[] is provided. The user should check this type.
      Parameters:
        `startDir` -
        `sTitle` - shown in title bar of the window
        `bForWrite` - true then the name field is editable and "Save" is shown on button. False then the name Field is readonly and "select" is shown on button
        `actionSelect` - Action which is called on Button ok. The first Object of exec(...,object) is the selected File or a File[] or List if more as one file is selected.

    - #### open

          public boolean open(java.lang.String sTitle,
                              int mode)

      Specified by:
        `open` in interface `GralFileDialog_ifc`

    - #### show

          public java.lang.String show(java.lang.String sBaseDir,
                                       java.lang.String sLocalDir,
                                       java.lang.String sMask,
                                       java.lang.String sTitle)

      Description copied from interface: `GralFileDialog_ifc`
      Shows the file dialog.
      Specified by:
        `show` in interface `GralFileDialog_ifc`
      Parameters:
        `sBaseDir` - Part of start path, which should not be leave in selection. May be null
        `sLocalDir` - Part of start path which is shown as default. May be null. If both sBaseDir and sLocalDir are null, the dialog may start with the last saved base dir.
        `sMask` - If not null, then mask for file selection. If null, all files will be shown.
        `sTitle` - The title in the dialog's title. If null, then the title is unchanged.
      Returns:
        null if the selection was aborted.

    - #### getMultiSelection

          public java.lang.String[] getMultiSelection()

      Specified by:
        `getMultiSelection` in interface `GralFileDialog_ifc`

    - #### getSelection

          public java.lang.String getSelection()

      Description copied from interface: `GralFileDialog_ifc`
      Returns the last selected local path and file.
      Specified by:
        `getSelection` in interface `GralFileDialog_ifc`
      Returns:
        null if the last selection was aborted.

    - #### closeWindow

          public void closeWindow()