Package docking.widgets
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
Dialog that presents the user with a list of strings and returns the object
associated with the user-picked element.
-
Field Summary
Fields inherited from class docking.DialogComponentProvider
applyButton, buttonPanel, cancelButton, dismissButton, okButton, rootPanel
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
The callback method for when the "OK" button is pressed.static <T> T
Modally shows the user a dialog with a list of strings, and returns the picked object.void
setSelectedObject
(T obj) Methods inherited from class docking.DialogComponentProvider
addAction, addApplyButton, addButton, addCancelButton, addDismissButton, addOKButton, addWorkPanel, alertMessage, alertMessage, applyCallback, cancelCallback, cancelCurrentTask, clearScheduledTask, clearStatusText, close, closeDialog, dialogClosed, dialogShown, dismissCallback, dispose, doInitialize, escapeCallback, executeProgressTask, getActionContext, getActions, getBackground, getBounds, getComponent, getDefaultButton, getDefaultSize, getDialogSize, getFocusComponent, getGlassPane, getHelpLocation, getId, getInitialLocation, getLocationOnScreen, getParent, getPreferredSize, getRememberLocation, getRememberSize, getStatusColor, getStatusLabel, getStatusText, getTaskMonitorComponent, getTaskScheduler, getTitle, getUseSharedLocation, hideTaskMonitorComponent, isApplyEnabled, isCancelEnabled, isModal, isOKEnabled, isResizeable, isRunningTask, isShowing, isTransient, isVisible, notifyContextChanged, removeAction, removeButton, removeWorkPanel, repack, setAccessibleDescription, setApplyEnabled, setApplyToolTip, setBackground, setCancelButtonText, setCancelEnabled, setCancelToolTip, setCursor, setDefaultButton, setDefaultSize, setDialogSize, setDismissToolTip, setFocusComponent, setGlassPane, setHelpLocation, setInitialLocation, setMinimumSize, setMinimumSize, setOkButtonText, setOkEnabled, setOkToolTip, setPreferredSize, setRememberLocation, setRememberSize, setResizable, setStatusJustification, setStatusText, setStatusText, setStatusText, setTitle, setTransient, setUseSharedLocation, showProgressBar, showTaskMonitorComponent, stopProgressTimer, taskCancelled, taskCompleted, toFront, toString, waitForCurrentTask
-
Constructor Details
-
SelectFromListDialog
-
-
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 Ttitle
- title of dialogprompt
- prompt shown above listtoStringFunction
- 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 classDialogComponentProvider
-
getSelectedObject
-
setSelectedObject
-