Class KeyValueRecordSelector<T>

java.lang.Object
xal.extension.widgets.swing.KeyValueRecordSelector<T>
Direct Known Subclasses:
NodeChannelSelector

public class KeyValueRecordSelector<T> extends Object
display a dialog that allows users to select records from a table
  • Constructor Details

  • Method Details

    • getInstance

      public static <T> KeyValueRecordSelector<T> getInstance(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title)
      Get an instance of a record selector for allowing users to select records (of the specified type) from a list in a table.
      Parameters:
      tableModel - table model supplying the records to display
      owner - the window that owns the dialog window
      title - the title of the dialog window
    • getInstance

      public static <T> KeyValueRecordSelector<T> getInstance(List<T> records, JFrame owner, String title, String... keyPaths)
      Get an instance of a record selector for allowing users to select records (of the specified type) from a list in a table.
      Parameters:
      records - the objects of the specified types to list for selection
      owner - the window that owns the dialog window
      title - the title of the dialog window
      keyPaths - are the key paths applied to each record to supply the table's column data
    • getInstanceWithFilterPrompt

      public static <T> KeyValueRecordSelector<T> getInstanceWithFilterPrompt(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title, String filterPrompt)
      Get an instance of a record selector for allowing users to select records (of the specified type) from a list in a table.
      Parameters:
      tableModel - table model supplying the records to display
      owner - the window that owns the dialog window
      title - the title of the dialog window
      filterPrompt - the prompt to appear as a placeholder in the filter field
    • getInstanceWithFilterPrompt

      public static <T> KeyValueRecordSelector<T> getInstanceWithFilterPrompt(List<T> records, JFrame owner, String title, String filterPrompt, String... keyPaths)
      Get an instance of a record selector for allowing users to select records (of the specified type) from a list in a table.
      Parameters:
      records - the objects of the specified types to list for selection
      owner - the window that owns the dialog window
      title - the title of the dialog window
      filterPrompt - the prompt to appear as a placeholder in the filter field
      keyPaths - are the key paths applied to each record to supply the table's column data
    • getRecordTable

      public JTable getRecordTable()
      get the table which displays the records from which to select
    • getRecordTableModel

      public KeyValueFilteredTableModel<T> getRecordTableModel()
      get the table model for displaying the records
    • showSingleSelectionDialog

      public T showSingleSelectionDialog()
      Show the dialog with single record selection allowed and return the selected record if any.
      Returns:
      the selected record or null if no record was selected or the dialog was canceled
    • showDialog

      public List<T> showDialog()
      Show the dialog with arbitrary record selection allowed and return a list of selected records.
      Returns:
      the selected records or null if the dialog was canceled
    • showDialog

      public List<T> showDialog(int selectionMode)
      Show the dialog with the specified record selection mode and return a list of selected records.
      Parameters:
      selectionMode - record selection mode: ListSelectionModel.SINGLE_SELECTION, ListSelectionModel.SINGLE_INTERVAL_SELECTION or ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
      Returns:
      the selected records or null if the dialog was canceled
    • getSelectedRecords

      protected List<T> getSelectedRecords()
      get the list of selected records