Package xal.extension.widgets.swing
Class KeyValueRecordSelector<T>
java.lang.Object
xal.extension.widgets.swing.KeyValueRecordSelector<T>
- Direct Known Subclasses:
NodeChannelSelector
display a dialog that allows users to select records from a table
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
KeyValueRecordSelector
(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title) Constructor with default filter promptprotected
KeyValueRecordSelector
(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title, String filterPrompt) Primary Constructor -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.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.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.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.get the table which displays the records from which to selectget the table model for displaying the recordsget the list of selected recordsShow the dialog with arbitrary record selection allowed and return a list of selected records.showDialog
(int selectionMode) Show the dialog with the specified record selection mode and return a list of selected records.Show the dialog with single record selection allowed and return the selected record if any.
-
Constructor Details
-
KeyValueRecordSelector
protected KeyValueRecordSelector(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title, String filterPrompt) Primary Constructor -
KeyValueRecordSelector
protected KeyValueRecordSelector(KeyValueFilteredTableModel<T> tableModel, JFrame owner, String title) Constructor with default filter prompt
-
-
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 displayowner
- the window that owns the dialog windowtitle
- 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 selectionowner
- the window that owns the dialog windowtitle
- the title of the dialog windowkeyPaths
- 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 displayowner
- the window that owns the dialog windowtitle
- the title of the dialog windowfilterPrompt
- 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 selectionowner
- the window that owns the dialog windowtitle
- the title of the dialog windowfilterPrompt
- the prompt to appear as a placeholder in the filter fieldkeyPaths
- are the key paths applied to each record to supply the table's column data
-
getRecordTable
get the table which displays the records from which to select -
getRecordTableModel
get the table model for displaying the records -
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
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
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
get the list of selected records
-