org.vishia.commander

## Class FcmdButtons

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

-     public class FcmdButtons
      extends java.lang.Object

  This class contains all functionality of the function buttons in The-file-Commander.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `FcmdButtons.ButtonAction`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `(package private) GralUserAction` | `actionMainKeys` The main key action registered in the `GralMng.setMainKeyAction(GralUserAction)`.
    `(package private) GralUserAction` | `actionViewButtons` Action to focus the cmd card.
    `(package private) java.lang.String[]` | `b1` This is only a helper String array to associate button texts from `FCmdIdent` in form "aF1:Text" and there action to the viewable buttons.
    `(package private) boolean` | `bButtonVisible`
    `(package private) GralButton` | `buttonDel`
    `(package private) FcmdButtons.ButtonAction` | `currentButton`
    `(package private) FcmdButtons.ButtonAction` | `emptyButton`
    `(package private) java.util.Map<java.lang.String,FcmdButtons.ButtonAction>` | `idxButtons`
    `(package private) java.util.Map<java.lang.Integer,GralUserAction>` | `idxKeyAction` Actions for all keys in `#keys`.
    `private Fcmd` | `main`
    `static int` | `version` Version, history and copyright/copyleft.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FcmdButtons(Fcmd main)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `addButton(int idx, java.util.Iterator<java.util.Map.Entry<java.lang.String,FcmdButtons.ButtonAction>> iterButtonAction)` Assigns the next action to the `#keyAction` and creates the button.
    `(package private) FcmdButtons.ButtonAction` | `getNext(int idx, java.util.Iterator<java.util.Map.Entry<java.lang.String,FcmdButtons.ButtonAction>> iterButtonAction)` Get the proper button for the requested idx in `b1`.
    `(package private) void` | `initPanelButtons()`
    `(package private) boolean` | `processKey(int keyCode, GralWidget_ifc widg)` Searches the given keyCode and processes its action.
    `(package private) void` | `setBtnMenuAndKeys(GralUserAction action, java.lang.String buttonText, int key, int key2, java.lang.String menu)` Assign an action to any function button, menu and key.
    `(package private) void` | `setBtnMenuAndKeys(GralUserAction action, java.lang.String buttonText, int key, java.lang.String menu)` Assign an action to any function button, menu and key.

    - ### 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 copyright/copyleft.
      - 2012-06-16 Hartmut new: `#processKey(int)`: Now all control keys are set together with the buttons in `#setBtnMenuAndKeys(GralUserAction, String)`.
      - 2012-01-01 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

    - #### main

          private final Fcmd main

    - #### buttonDel

          GralButton buttonDel

    - #### bButtonVisible

          boolean bButtonVisible

    - #### emptyButton

          FcmdButtons.ButtonAction emptyButton

    - #### idxButtons

          java.util.Map<java.lang.String,FcmdButtons.ButtonAction> idxButtons

    - #### b1

          final java.lang.String[] b1

      This is only a helper String array to associate button texts from `FCmdIdent` in form "aF1:Text" and there action to the viewable buttons. The order of character are in alphabetic one because the given button control texts are processed in that order.

    - #### idxKeyAction

          java.util.Map<java.lang.Integer,GralUserAction> idxKeyAction

      Actions for all keys in `#keys`.

    - #### currentButton

          FcmdButtons.ButtonAction currentButton

    - #### actionMainKeys

          GralUserAction actionMainKeys

      The main key action registered in the `GralMng.setMainKeyAction(GralUserAction)`.

    - #### actionViewButtons

          GralUserAction actionViewButtons

      Action to focus the cmd card.

  - ### Constructor Detail

    - #### FcmdButtons

          FcmdButtons(Fcmd main)

  - ### Method Detail

    - #### setBtnMenuAndKeys

          void setBtnMenuAndKeys(GralUserAction action,
                                 java.lang.String buttonText,
                                 int key,
                                 int key2,
                                 java.lang.String menu)

      Assign an action to any function button, menu and key.
      Parameters:
        `action` - The action
        `buttonText` - use the form "Btn:text" where button is F1..F12, aF1 etc. text is the text.

    - #### setBtnMenuAndKeys

          void setBtnMenuAndKeys(GralUserAction action,
                                 java.lang.String buttonText,
                                 int key,
                                 java.lang.String menu)

      Assign an action to any function button, menu and key.
      Parameters:
        `action` - The action
        `buttonText` - use the form "Btn:text" where button is F1..F12, aF1 etc. text is the text.

    - #### getNext

          FcmdButtons.ButtonAction getNext(int idx,
                                           java.util.Iterator<java.util.Map.Entry<java.lang.String,FcmdButtons.ButtonAction>> iterButtonAction)

      Get the proper button for the requested idx in `b1`.
      Parameters:
        `idx` -
        `iterButtonAction` -
      Returns:
        the `emptyButton` if no button matches.

    - #### addButton

          private void addButton(int idx,
                                 java.util.Iterator<java.util.Map.Entry<java.lang.String,FcmdButtons.ButtonAction>> iterButtonAction)

      Assigns the next action to the `#keyAction` and creates the button.
      Parameters:
        `idx` -
        `iterButtonAction` -

    - #### initPanelButtons

          void initPanelButtons()

    - #### processKey

          boolean processKey(int keyCode,
                             GralWidget_ifc widg)

      Searches the given keyCode and processes its action. The action was set initially from the `#setBtnMenuAndKeys(GralUserAction, String)` with key assignment in `FcmdIdents`.
      Parameters:
        `keyCode` -
      Returns:
        true if done.