public class AutoCompletionList extends javax.swing.table.AbstractTableModel
AutoCompletionItem
s.
The list is sorted, items with higher priority first, then according to lexicographic order
on the value of the AutoCompletionItem
.
AutoCompletionList maintains two views on the list of AutoCompletionItem
s.
AbstractTableModel
which serves the list of filtered
items to a JTable
.Modifier and Type | Field and Description |
---|---|
private java.lang.String |
filter
the filter expression
|
private java.util.ArrayList<AutoCompletionItem> |
filtered
the filtered list of AutoCompletionItems
|
private AutoCompletionSet |
list
the bare list of AutoCompletionItems
|
Constructor and Description |
---|
AutoCompletionList()
constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(AutoCompletionItem item)
adds an
AutoCompletionItem to the list. |
void |
add(AutoCompletionList other)
adds another
AutoCompletionList to this list. |
void |
add(java.util.Collection<AutoCompletionItem> collection)
adds a colleciton of
AutoCompletionItem to this list. |
void |
add(java.util.Collection<java.lang.String> values,
AutoCompletionPriority priority)
adds a list of strings to this list.
|
void |
addUserInput(java.util.Collection<java.lang.String> values)
Adds values that have been entered by the user.
|
void |
applyFilter(java.lang.String filter)
applies a filter expression to the list of
AutoCompletionItem s. |
void |
clear()
removes all elements from the auto completion list
|
void |
clearFilter()
clears the current filter
|
boolean |
contains(AutoCompletionItem item)
checks whether a specific item is already in the list.
|
boolean |
contains(java.lang.String value)
checks whether an item with the given value is already in the list.
|
protected void |
filter() |
int |
getColumnCount() |
java.lang.String |
getFilter() |
AutoCompletionItem |
getFilteredItemAt(int idx)
replies the idx-th item from the list of filtered items
|
int |
getFilteredSize()
replies the number of filtered items
|
int |
getRowCount() |
(package private) AutoCompletionSet |
getSet() |
(package private) java.util.Set<AutoCompletionItem> |
getUnmodifiableSet() |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
void |
remove(java.lang.String key)
removes the auto completion item with key
key |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
private final transient AutoCompletionSet list
private final transient java.util.ArrayList<AutoCompletionItem> filtered
private java.lang.String filter
public AutoCompletionList()
public void applyFilter(java.lang.String filter)
AutoCompletionItem
s.
The matching criterion is a case insensitive substring match.filter
- the filter expression; must not be nulljava.lang.IllegalArgumentException
- if filter is nullpublic void clearFilter()
public java.lang.String getFilter()
public void add(AutoCompletionItem item)
AutoCompletionItem
to the list. Only adds the item if it
is not null and if not in the list yet.item
- the itempublic void add(AutoCompletionList other)
AutoCompletionList
to this list. An item is only
added it is not null and if it does not exist in the list yet.other
- another auto completion list; must not be nulljava.lang.IllegalArgumentException
- if other is nullpublic void add(java.util.Collection<AutoCompletionItem> collection)
AutoCompletionItem
to this list. An item is only
added it is not null and if it does not exist in the list yet.collection
- auto completion collection; must not be nulljava.lang.IllegalArgumentException
- if other is nullpublic void add(java.util.Collection<java.lang.String> values, AutoCompletionPriority priority)
values
- a list of strings to addpriority
- the priority to usepublic void addUserInput(java.util.Collection<java.lang.String> values)
values
- values that have been entered by the userpublic boolean contains(AutoCompletionItem item)
item
- the item to checkpublic boolean contains(java.lang.String value)
value
- the value of an auto completion itempublic void remove(java.lang.String key)
key
key
- the keyprotected void filter()
public int getFilteredSize()
public AutoCompletionItem getFilteredItemAt(int idx)
idx
- the index; must be in the range 0 <= idx < getFilteredSize()
java.lang.IndexOutOfBoundsException
- if idx is out of boundsAutoCompletionSet getSet()
java.util.Set<AutoCompletionItem> getUnmodifiableSet()
public void clear()
public int getColumnCount()
public int getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)