public class AutoCompletionList extends javax.swing.table.AbstractTableModel
AutoCompletionListItems.
The list is sorted, items with higher priority first, then according to lexicographic order
on the value of the AutoCompletionListItem.
AutoCompletionList maintains two views on the list of AutoCompletionListItems.
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<AutoCompletionListItem> |
filtered
the filtered list of AutoCompletionItems
|
private java.util.List<AutoCompletionListItem> |
list
the bare list of AutoCompletionItems
|
private java.util.Map<java.lang.String,AutoCompletionListItem> |
valutToItemMap
map from value to priority
|
| Constructor and Description |
|---|
AutoCompletionList()
constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(AutoCompletionList other)
adds another AutoCompletionList to this list.
|
void |
add(AutoCompletionListItem item)
adds an AutoCompletionListItem to the list.
|
void |
add(java.util.Collection<java.lang.String> values,
AutoCompletionItemPriority priority)
adds a list of strings to this list.
|
void |
add(java.util.List<AutoCompletionListItem> other)
adds a list of AutoCompletionListItem to this list.
|
void |
addUserInput(java.util.Collection<java.lang.String> values) |
protected void |
appendOrUpdatePriority(AutoCompletionListItem toAdd) |
void |
applyFilter(java.lang.String filter)
applies a filter expression to the list of
AutoCompletionListItems. |
void |
clear()
removes all elements from the auto completion list
|
void |
clearFilter()
clears the current filter
|
boolean |
contains(AutoCompletionListItem 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() |
AutoCompletionListItem |
getFilteredItem(int idx)
replies the idx-th item from the list of filtered items
|
int |
getFilteredSize()
replies the number of filtered items
|
(package private) java.util.List<AutoCompletionListItem> |
getList() |
int |
getRowCount() |
(package private) java.util.List<AutoCompletionListItem> |
getUnmodifiableList() |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex) |
void |
remove(java.lang.String key)
removes the auto completion item with key
key |
protected void |
sort()
sorts the list
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAtprivate java.util.List<AutoCompletionListItem> list
private java.util.ArrayList<AutoCompletionListItem> filtered
private java.lang.String filter
private java.util.Map<java.lang.String,AutoCompletionListItem> valutToItemMap
public AutoCompletionList()
public void applyFilter(java.lang.String filter)
AutoCompletionListItems.
The matching criterion is a case insensitive substring match.filter - the filter expression; must not be nulljava.lang.IllegalArgumentException - thrown, if filter is nullpublic void clearFilter()
public java.lang.String getFilter()
public void add(AutoCompletionListItem item)
item - the itempublic void add(AutoCompletionList other)
other - another auto completion list; must not be nulljava.lang.IllegalArgumentException - thrown, if other is nullpublic void add(java.util.List<AutoCompletionListItem> other)
other - a list of AutoCompletionListItem; must not be nulljava.lang.IllegalArgumentException - thrown, if other is nullpublic void add(java.util.Collection<java.lang.String> values, AutoCompletionItemPriority priority)
values - a list of strings to addpriority - the priority to usepublic void addUserInput(java.util.Collection<java.lang.String> values)
protected void appendOrUpdatePriority(AutoCompletionListItem toAdd)
public boolean contains(AutoCompletionListItem 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)
keykey - the key;protected void sort()
protected void filter()
public int getFilteredSize()
public AutoCompletionListItem getFilteredItem(int idx)
idx - the index; must be in the range 0 <= idx < getFilteredSize()java.lang.IndexOutOfBoundsException - thrown, if idx is out of boundsjava.util.List<AutoCompletionListItem> getList()
java.util.List<AutoCompletionListItem> getUnmodifiableList()
public void clear()
public int getColumnCount()
public int getRowCount()
public java.lang.Object getValueAt(int rowIndex, int columnIndex)