Class SelectFromListDialog<T>

java.lang.Object
docking.DialogComponentProvider
docking.widgets.SelectFromListDialog<T>
Type Parameters:
T - opaque object type that will be selected by the user.
All Implemented Interfaces:
ActionContextProvider, StatusListener, TaskListener

public class SelectFromListDialog<T> extends DialogComponentProvider
Dialog that presents the user with a list of strings and returns the object associated with the user-picked element.

  • Constructor Details

  • Method Details

    • selectFromList

      public static <T> T selectFromList(List<T> list, String title, String prompt, Function<T,String> toStringFunction)
      Modally shows the user a dialog with a list of strings, and returns the picked object.

      (automatically switches to Swing thread)

      Parameters:
      list - list of object of type T
      title - title of dialog
      prompt - prompt shown above list
      toStringFunction - function that converts a T into a String.
      Returns:
      the chosen T object, or null if dialog canceled.
    • okCallback

      protected void okCallback()
      Description copied from class: DialogComponentProvider
      The callback method for when the "OK" button is pressed.
      Overrides:
      okCallback in class DialogComponentProvider
    • getSelectedObject

      public T getSelectedObject()
    • setSelectedObject

      public void setSelectedObject(T obj)