org.vishia.gral.widget

## Class GralSelectList<UserData>

- java.lang.Object
- - org.vishia.gral.widget.GralSelectList<UserData>

- All Implemented Interfaces:
    Removeable
  Direct Known Subclasses:
    FcmdFavorCard, FcmdLeftMidRightPanel.FcmdFavorThemeCard, GralCommandSelector, GralFileSelector.FileSelectList

      public abstract class GralSelectList<UserData>
      extends java.lang.Object
      implements Removeable

  The base class for lists which supports nested selections. The associated widget is a table. The action listener `actionTable` captures all key and mouse activities on the table-widget. It is the base class for file selection and command selection. The base idea is, left and right keys navigates in a tree to outer and deeper nodes. The table shows only members of the current node. A text line shows the current node path. It may be possible to switch to a tree presentation (TODO). But this complex widget should occupy only a simple rectangle of a GUI, not some windows etc. It may be less in spread too if necessary.
  Note: this class should not be a derived class of `GralTable`, because instances of derived classes should be created as final compositions in the main thread before the table can be presented in the graphic thread. Therefore the aggregation `wdgdTable` cannot be final. It is set only when `#setToPanel(GralMngBuild_ifc, String, int, int[], char)` is called.

        GralSelectList
              |--wdgdTable--->GralTable         TableLineData
                                           |---idxLine------*>|
                                           |---tableLines---*>|

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.util.Map<java.lang.String,GralUserAction>` | `actions` Not used yet, register actions?
    `private GralUserAction` | `actionTable`
    `protected int` | `keyLeft` The keys for left and right navigation.
    `protected int` | `keyRight` The keys for left and right navigation.
    `static java.lang.String` | `version` Version and history: 2018-10-28 Hartmut chg: `createImplWidget_Gthread()` instead setToPanel(mng) 2011-11-18 chg: This class does not inherit from GralWidget now.
    `GralTable<UserData>` | `wdgdTable` The table which is showing in the widget.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `GralSelectList(java.lang.String posName, int rows, int[] columns, char size)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract void` | `actionLeft(java.lang.Object userData, GralTableLine_ifc<UserData> line)` Action if a table line is selected and ctrl-left is pressed or the release button is pressed.
    `protected abstract boolean` | `actionOk(java.lang.Object userData, GralTableLine_ifc<UserData> line)` Action if a table line is selected and entered.
    `protected abstract void` | `actionRight(java.lang.Object userData, GralTableLine_ifc<UserData> line)` Action if a table line is selected and ctrl-right is pressed or the release button is pressed.
    `protected abstract boolean` | `actionUserKey(int key, java.lang.Object userData, GralTableLine_ifc<UserData> line)` Action if a table line is selected and any other key is pressed or the context menu is invoked.
    `void` | `createImplWidget_Gthread()`
    `boolean` | `remove()` Removes all data and all widgets of this class.
    `void` | `set(java.util.List<java.lang.String[]> listData)`
    `boolean` | `setFocus()` Sets the focus of the associated table widget.
    `void` | `setLeftRightKeys(int keyLeft, int keyRight)` The left and right key codes for selection left and right can be changed.
    `(package private) void` | `stop()`
    `void` | `XXXsetToPanel(GralMngBuild_ifc gralMng)`

    - ### 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 and history:
      - 2018-10-28 Hartmut chg: `createImplWidget_Gthread()` instead setToPanel(mng)
      - 2011-11-18 chg: This class does not inherit from GralWidget now. The GralWidget, which represents this class, is referenced with the public aggregation `wdgdTable`. Only this instance is registered on a panel calling `#setToPanel(GralMngBuild_ifc, String, int, int[], char)`.
      - 2011-10-02 chg: Uses keycodes from `KeyCode` now,
      - 2011-10-02 chg: `actionOk(Object, GralTableLine_ifc)` returns boolean now, false if no action is done.
      - older- TODO
      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 indent 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

    - #### wdgdTable

          public GralTable<UserData> wdgdTable

      The table which is showing in the widget.

    - #### keyLeft

          protected int keyLeft

      The keys for left and right navigation. Default it is shift + left and right arrow key.

    - #### keyRight

          protected int keyRight

      The keys for left and right navigation. Default it is shift + left and right arrow key.

    - #### actions

          protected java.util.Map<java.lang.String,GralUserAction> actions

      Not used yet, register actions?

    - #### actionTable

          private final GralUserAction actionTable

  - ### Constructor Detail

    - #### GralSelectList

          protected GralSelectList(java.lang.String posName,
                                   int rows,
                                   int[] columns,
                                   char size)

  - ### Method Detail

    - #### setLeftRightKeys

          public final void setLeftRightKeys(int keyLeft,
                                             int keyRight)

      The left and right key codes for selection left and right can be changed. The key code is a number maybe in combination with alt, ctrl, shift see `KeyCode`.
      Parameters:
        `keyLeft` - Key code for outer selection
        `keyRight` - KeyCode for deeper selection

    - #### XXXsetToPanel

          public void XXXsetToPanel(GralMngBuild_ifc gralMng)

      Parameters:
        `panel` -
        `identArgJbat` -
        `rows` -
        `columns` -
        `size` -

    - #### createImplWidget_Gthread

          public void createImplWidget_Gthread()

    - #### set

          public void set(java.util.List<java.lang.String[]> listData)

    - #### setFocus

          public boolean setFocus()

      Sets the focus of the associated table widget.
      Returns:
        true if focused.

    - #### remove

          public boolean remove()

      Removes all data and all widgets of this class.
      Specified by:
        `remove` in interface `Removeable`
      Returns:
        true if successfully. If false it is a hint for the application that the instance itself should not be removed.

    - #### actionOk

          protected abstract boolean actionOk(java.lang.Object userData,
                                              GralTableLine_ifc<UserData> line)

      Action if a table line is selected and entered. Its either a double click with the mouse or click of OK (Enter) button.
      Parameters:
        `userData` - The user data stored in the line of table.

    - #### actionLeft

          protected abstract void actionLeft(java.lang.Object userData,
                                             GralTableLine_ifc<UserData> line)

      Action if a table line is selected and ctrl-left is pressed or the release button is pressed.
      Parameters:
        `userData` - The user data stored in the line of table.

    - #### actionRight

          protected abstract void actionRight(java.lang.Object userData,
                                              GralTableLine_ifc<UserData> line)

      Action if a table line is selected and ctrl-right is pressed or the release button is pressed.
      Parameters:
        `userData` - The user data stored in the line of table.

    - #### actionUserKey

          protected abstract boolean actionUserKey(int key,
                                                   java.lang.Object userData,
                                                   GralTableLine_ifc<UserData> line)

      Action if a table line is selected and any other key is pressed or the context menu is invoked.
      Parameters:
        `key` - code or mouse code, one of constans from `KeyCode`.
        `userData` - The user data stored in the line of table.
        `line` - The table line.
      Returns:
        true if is was relevant for the key.

    - #### stop

          void stop()