Class BeanListComboBoxCellEditor<T extends java.lang.Comparable<? super T>>
- java.lang.Object
-
- javax.swing.AbstractCellEditor
-
- javax.swing.DefaultCellEditor
-
- io.github.jonestimd.swing.component.ComboBoxCellEditor
-
- io.github.jonestimd.swing.component.BeanListComboBoxCellEditor<T>
-
- Type Parameters:
T
- list item class
- All Implemented Interfaces:
java.io.Serializable
,javax.swing.CellEditor
,javax.swing.table.TableCellEditor
,javax.swing.tree.TreeCellEditor
- Direct Known Subclasses:
EditableComboBoxCellEditor
public abstract class BeanListComboBoxCellEditor<T extends java.lang.Comparable<? super T>> extends ComboBoxCellEditor
Provides a cell editor (BeanListComboBox
) for selecting from a list of beans. Provides the option to load the list items lazily the first time a cell is edited.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BeanListComboBoxCellEditor(BeanListComboBox<T> comboBox, java.lang.String loadingMessage)
Create a combo box cell editor for an optional field.protected
BeanListComboBoxCellEditor(java.text.Format format, java.lang.String loadingMessage)
Create a combo box cell editor for an optional field.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addListItems(java.util.Collection<T> newItems)
Add items to the drop down list.protected BeanListComboBox<T>
getComboBox()
protected LazyLoadComboBoxModel<T>
getComboBoxModel()
protected abstract java.util.List<T>
getComboBoxValues()
Must be implemented to provide the list items.java.awt.Component
getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
Overridden start a background thread to load the list values if they haven't been loaded yet,java.awt.Component
getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
Overridden start a background thread to load the list values if they haven't been loaded yet,void
setListItems(java.util.List<T> items)
Set the list items.-
Methods inherited from class javax.swing.DefaultCellEditor
cancelCellEditing, getCellEditorValue, getClickCountToStart, getComponent, isCellEditable, setClickCountToStart, shouldSelectCell, stopCellEditing
-
Methods inherited from class javax.swing.AbstractCellEditor
addCellEditorListener, fireEditingCanceled, fireEditingStopped, getCellEditorListeners, removeCellEditorListener
-
-
-
-
Constructor Detail
-
BeanListComboBoxCellEditor
protected BeanListComboBoxCellEditor(java.text.Format format, java.lang.String loadingMessage)
Create a combo box cell editor for an optional field.
-
BeanListComboBoxCellEditor
protected BeanListComboBoxCellEditor(BeanListComboBox<T> comboBox, java.lang.String loadingMessage)
Create a combo box cell editor for an optional field.
-
-
Method Detail
-
getTableCellEditorComponent
public java.awt.Component getTableCellEditorComponent(javax.swing.JTable table, java.lang.Object value, boolean isSelected, int row, int column)
Overridden start a background thread to load the list values if they haven't been loaded yet,- Specified by:
getTableCellEditorComponent
in interfacejavax.swing.table.TableCellEditor
- Overrides:
getTableCellEditorComponent
in classjavax.swing.DefaultCellEditor
- See Also:
getComboBoxValues()
-
getTreeCellEditorComponent
public java.awt.Component getTreeCellEditorComponent(javax.swing.JTree tree, java.lang.Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
Overridden start a background thread to load the list values if they haven't been loaded yet,- Specified by:
getTreeCellEditorComponent
in interfacejavax.swing.tree.TreeCellEditor
- Overrides:
getTreeCellEditorComponent
in classjavax.swing.DefaultCellEditor
- See Also:
getComboBoxValues()
-
getComboBox
protected BeanListComboBox<T> getComboBox()
-
getComboBoxModel
protected LazyLoadComboBoxModel<T> getComboBoxModel()
-
setListItems
public void setListItems(java.util.List<T> items)
Set the list items. Disables background loading of the list items.
-
addListItems
public void addListItems(java.util.Collection<T> newItems)
Add items to the drop down list.
-
getComboBoxValues
protected abstract java.util.List<T> getComboBoxValues()
Must be implemented to provide the list items. Called from a background thread the first time a cell is edited unless the items have been set usingsetListItems(List)
.
-
-