org.vishia.commander

## Class FcmdView

- java.lang.Object
- - org.vishia.commander.FcmdView

-     public class FcmdView
      extends java.lang.Object

  All functionality of view (F3-Key) and edit a file.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) GralUserAction` | `actionFind` Action for Key F3 for view command.
    `(package private) GralUserAction` | `actionOnSetInvisible`
    `(package private) GralUserAction` | `actionOpenView` Action for Key F3 for view command.
    `(package private) GralUserAction` | `actionQuickView` Action for Key crl-Q for quick view command.
    `(package private) GralUserAction` | `actionSave`
    `(package private) GralUserAction` | `actionSaveTextAsISO8859_1_unix`
    `(package private) GralUserAction` | `actionSaveTextAsUTF8unix`
    `(package private) GralUserAction` | `actionSaveTextAsWindows`
    `(package private) GralUserAction` | `actionSetEditable` Action for Key F3 for view command.
    `(package private) GralUserAction` | `actionSetHexView` Action for Key F3 for view command.
    `(package private) GralUserAction` | `actionSetTextViewISO8859_1` Action for Key F3 for view command.
    `(package private) GralUserAction` | `actionSetTextViewUTF8` Action for Key F3 for view command.
    `private static java.nio.charset.Charset` | `ascii7`
    `(package private) boolean` | `bEditable`
    `private GralButton` | `btnCase`
    `private GralButton` | `btnFind`
    `private GralButton` | `btnQuickview`
    `private GralButton` | `btnWholeword`
    `(package private) boolean` | `bVisible`
    `private int` | `cursorPos`
    `private java.nio.charset.Charset` | `encodingContent`
    `private static byte[]` | `endl_0a`
    `private static byte[]` | `endl_0d0a`
    `(package private) FileRemote` | `file`
    `private char` | `format` The current choiced view format.
    `private StringFormatter` | `formatterHex` Instance to prepare the text especially for hex view.
    `private static java.nio.charset.Charset` | `iso8859_1`
    `protected Fcmd` | `main`
    `(package private) int` | `nrQuickview`
    `private java.nio.ByteBuffer` | `tmpReadTransmissionBuffer` A buffer to get bytes from the file using the java.nio.Channel mechanism.
    `private byte[]` | `uContent` The gotten bytes from bytebuffer.
    `(package private) GralTextFieldUser_ifc` | `userKeys`
    `private static java.nio.charset.Charset` | `utf8`
    `private GralTextBox` | `widgContent` The widget to show content.
    `private GralTextField` | `widgFindText`
    `private GralTextBox` | `widgQuickView`
    `private GralTextField` | `widgShowInfo`
    `private GralWindow_ifc` | `windView` The window of this functionallity.
    `private int` | `zContent` Number of read bytes.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FcmdView(Fcmd main)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `(package private) void` | `buildWindowView()` Builds the content of the confirm-delete window.
    `(package private) void` | `closeQuickView()`
    `(package private) void` | `detectEncoding()`
    `(package private) void` | `openQuickView(FileRemote src)`
    `(package private) void` | `presentContent()`
    `(package private) void` | `presentContentHex()`
    `(package private) void` | `presentContentText(java.nio.charset.Charset charset)`
    `void` | `quickView()` This routine will be called whenever a file is selected newly, it checks quickview.
    `(package private) void` | `saveTextAs(java.nio.charset.Charset encoding, byte[] lineEnd)`
    `(package private) void` | `syncContentFromWidg()`
    `(package private) void` | `syncTextFromWidg(java.nio.charset.Charset charset)`
    `(package private) void` | `view(FileRemote XXXsrc)` Reads the current (last selected) file in the binary content buffer, detects its encoding, shows it.

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

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

- - ### Field Detail

    - #### main

          protected final Fcmd main

    - #### windView

          private GralWindow_ifc windView

      The window of this functionallity.

    - #### widgContent

          private GralTextBox widgContent

      The widget to show content.

    - #### widgFindText

          private GralTextField widgFindText

    - #### widgShowInfo

          private GralTextField widgShowInfo

    - #### btnFind

          private GralButton btnFind

    - #### btnWholeword

          private GralButton btnWholeword

    - #### btnCase

          private GralButton btnCase

    - #### btnQuickview

          private GralButton btnQuickview

    - #### bVisible

          boolean bVisible

    - #### bEditable

          boolean bEditable

    - #### nrQuickview

          int nrQuickview

    - #### widgQuickView

          private GralTextBox widgQuickView

    - #### file

          FileRemote file

    - #### tmpReadTransmissionBuffer

          private final java.nio.ByteBuffer tmpReadTransmissionBuffer

      A buffer to get bytes from the file using the java.nio.Channel mechanism. The channel mechanism is proper to work with remote file access especially. Note: The ByteBuffer may be a part of the channel mechanism itself, because it is placed JVM-internally, for example for socket communication. TODO check and change it. The size of the byteBuffer is set to less than 1 UDP-telegram payload to support any communication.

    - #### zContent

          private int zContent

      Number of read bytes.

    - #### uContent

          private final byte[] uContent

      The gotten bytes from bytebuffer. This buffer is set to the size of the file, if the file is less than a maximal size.

    - #### encodingContent

          private java.nio.charset.Charset encodingContent

    - #### format

          private char format

      The current choiced view format.
      - a: us-ascii-text
      - w: iso (Windows)-text
      - u: UTF16-text
      - 1: Hexa byte wise
      - 2: Hexa 16-bit-words
      - 4: Hexa 32-bit-words
      - F: contains, float values, shows it

    - #### cursorPos

          private int cursorPos

    - #### ascii7

          private static java.nio.charset.Charset ascii7

    - #### utf8

          private static java.nio.charset.Charset utf8

    - #### iso8859_1

          private static java.nio.charset.Charset iso8859_1

    - #### endl_0a

          private static byte[] endl_0a

    - #### endl_0d0a

          private static byte[] endl_0d0a

    - #### formatterHex

          private final StringFormatter formatterHex

      Instance to prepare the text especially for hex view.

    - #### actionQuickView

          GralUserAction actionQuickView

      Action for Key crl-Q for quick view command. Its like Norton Commander.

    - #### actionFind

          GralUserAction actionFind

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionOpenView

          GralUserAction actionOpenView

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionSetTextViewUTF8

          GralUserAction actionSetTextViewUTF8

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionSetHexView

          GralUserAction actionSetHexView

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionSetTextViewISO8859_1

          GralUserAction actionSetTextViewISO8859_1

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionSetEditable

          GralUserAction actionSetEditable

      Action for Key F3 for view command. Its like Norton Commander.

    - #### actionSave

          GralUserAction actionSave

    - #### actionSaveTextAsUTF8unix

          GralUserAction actionSaveTextAsUTF8unix

    - #### actionSaveTextAsWindows

          GralUserAction actionSaveTextAsWindows

    - #### actionSaveTextAsISO8859_1_unix

          GralUserAction actionSaveTextAsISO8859_1_unix

    - #### actionOnSetInvisible

          GralUserAction actionOnSetInvisible

    - #### userKeys

          GralTextFieldUser_ifc userKeys

  - ### Constructor Detail

    - #### FcmdView

          public FcmdView(Fcmd main)

  - ### Method Detail

    - #### buildWindowView

          void buildWindowView()

      Builds the content of the confirm-delete window. The window is created static. It is shown whenever it is used.

    - #### view

          void view(FileRemote XXXsrc)

      Reads the current (last selected) file in the binary content buffer, detects its encoding, shows it. The file is held in a binary content buffer independent of its content type. The hexa view shows the bytes in any case. If the file will be shown as text, either the encoding can be self - detect, or the encoding can be selected by the user. Opens the view window and fills its content.
      Parameters:
        `src` - The path which is selected as source. It may be a directory or a file.

    - #### quickView

          public void quickView()

      This routine will be called whenever a file is selected newly, it checks quickview.

    - #### detectEncoding

          void detectEncoding()

    - #### presentContent

          void presentContent()
                       throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### presentContentHex

          void presentContentHex()
                          throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### presentContentText

          void presentContentText(java.nio.charset.Charset charset)
                           throws java.io.UnsupportedEncodingException

      Throws:
        `java.io.UnsupportedEncodingException`

    - #### syncContentFromWidg

          void syncContentFromWidg()

    - #### syncTextFromWidg

          void syncTextFromWidg(java.nio.charset.Charset charset)

    - #### saveTextAs

          void saveTextAs(java.nio.charset.Charset encoding,
                          byte[] lineEnd)

    - #### openQuickView

          void openQuickView(FileRemote src)

    - #### closeQuickView

          void closeQuickView()