- Type Parameters:
T
- the type of data in the model.
- All Known Subinterfaces:
EntityTableModel<E>
,FilteredTableModel<R,
C>
- All Known Implementing Classes:
EntityComboBoxModel
,FilteredComboBoxModel
,ItemComboBoxModel
,SwingEntityTableModel
public interface FilteredModel<T>
Specifies a data model that can be filtered to hide some or all of the items it contains.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
An abstract base implementation ofFilteredModel.Refresher
.static interface
Handles refreshing data for aFilteredModel
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<Boolean>
Specifies whether data models should refresh data asynchronously or on the EDT.
Value type: Boolean
Default value: true -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsItem
(T item) Returns true if this model contains the given item, visible or filtered.boolean
Returns true if this model contains the given item, and it is filtered, that is, is not visibleint
void
Filters this model according to the condition specified byincludeCondition()
.items()
void
refresh()
Refreshes the items in this filtered model using itsFilteredModel.Refresher
.void
refreshThen
(Consumer<Collection<T>> afterRefresh) Refreshes the data in this filtered model using itsFilteredModel.Refresher
.boolean
Returns true if this model contains the given item, and it is visible, that is, not filteredint
-
Field Details
-
ASYNC_REFRESH
Specifies whether data models should refresh data asynchronously or on the EDT.
Value type: Boolean
Default value: true- See Also:
-
-
Method Details
-
filterItems
void filterItems()Filters this model according to the condition specified byincludeCondition()
. If no include condition is specified this method does nothing. This method does not interfere with the internal ordering of the visible items.- See Also:
-
includeCondition
- Returns:
- the include condition value
-
items
Collection<T> items()- Returns:
- an unmodifiable view of all visible and filtered items in this model
- See Also:
-
visibleItems
- Returns:
- an unmodifiable view of the visible items, in the order they appear in the model
-
filteredItems
Collection<T> filteredItems()- Returns:
- an unmodifiable view of the filtered items
-
visibleCount
int visibleCount()- Returns:
- the number of currently visible items
-
filteredCount
int filteredCount()- Returns:
- the number of currently filtered items
-
containsItem
Returns true if this model contains the given item, visible or filtered.- Parameters:
item
- the item- Returns:
- true if this model contains the item
-
visible
Returns true if this model contains the given item, and it is visible, that is, not filtered- Parameters:
item
- the item- Returns:
- true if the given item is visible
-
filtered
Returns true if this model contains the given item, and it is filtered, that is, is not visible- Parameters:
item
- the item- Returns:
- true if the given item is filtered
-
refresher
FilteredModel.Refresher<T> refresher()- Returns:
- this models Refresher instance
-
refresh
void refresh()Refreshes the items in this filtered model using itsFilteredModel.Refresher
.- Throws:
RuntimeException
- in case of an exception when running refresh synchronously, as in, not on the user interface thread- See Also:
-
refreshThen
Refreshes the data in this filtered model using itsFilteredModel.Refresher
. Note that this method only throws exceptions when run synchronously off the user interface thread. UseFilteredModel.Refresher.refreshFailedEvent()
to listen for exceptions that happen during asynchronous refresh.- Parameters:
afterRefresh
- called after a successful refresh, may be null- See Also:
-