|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.Searchable com.jidesoft.swing.ComboBoxSearchable com.jidesoft.combobox.ExComboBoxSearchable com.jidesoft.combobox.TableExComboBoxSearchable
public class TableExComboBoxSearchable
TableExComboBoxSearchable
is an concrete implementation of Searchable
that
enables the search function in TableExComboBox.
It's very simple to use it. Assuming you have a TableExComboBox,
all you need to do is to call
Now the TableExComboBox will have the search function.
TableExComboBox tableExComboBox = ....;
TableExComboBoxSearchable searchable = new TableExComboBoxSearchable(tableExComboBox);
Converter
to convert the elements to strings
to search for.
Additional customization can be done on the base Searchable class such as background and foreground color,
keystrokes, case sensitivity.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.swing.Searchable |
---|
Searchable.SearchField, Searchable.SearchPopup |
Field Summary |
---|
Fields inherited from class com.jidesoft.swing.Searchable |
---|
_component, _componentListener, _focusListener, _keyListener, _matchCount, CLIENT_PROPERTY_SEARCHABLE, listenerList, PROPERTY_SEARCH_TEXT |
Constructor Summary | |
---|---|
TableExComboBoxSearchable(TableExComboBox tableExComboBox)
|
Method Summary | |
---|---|
protected void |
addTableSelection(JTable table,
int rowIndex,
int columnIndex,
boolean incremental)
Selects the cell at the specified row and column index. |
protected Object |
getElementAt(int row)
Gets the element at the specified index. |
protected int |
getElementCount()
Gets the total element count in the component. |
int |
getMainIndex()
Gets the index of the column to be searched. |
int[] |
getSearchColumnIndices()
Gets the indexes of the column to be searched. |
protected int |
getSelectedIndex()
Gets the selected index in the component. |
protected boolean |
isColumnSelectionAllowed(JTable table)
Is the column selection allowed? |
protected boolean |
isRowSelectionAllowed(JTable table)
Is the row selection allowed? |
void |
setMainIndex(int mainIndex)
Sets the main index. |
void |
setSearchColumnIndices(int[] columnIndices)
Sets the main indexes. |
protected void |
setSelectedIndex(int index,
boolean incremental)
Sets the selected index. |
void |
showPopup(String searchingText)
Shows the search popup. |
Methods inherited from class com.jidesoft.combobox.ExComboBoxSearchable |
---|
convertElementToString, getComboBox, popupMenuWillBecomeInvisible |
Methods inherited from class com.jidesoft.swing.ComboBoxSearchable |
---|
contentsChanged, intervalAdded, intervalRemoved, isRefreshPopupDuringSearching, isShowPopupDuringSearching, popupMenuCanceled, popupMenuWillBecomeVisible, propertyChange, setRefreshPopupDuringSearching, setShowPopupDuringSearching, uninstallListeners |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TableExComboBoxSearchable(TableExComboBox tableExComboBox)
Method Detail |
---|
public void showPopup(String searchingText)
Searchable
showPopup
in class Searchable
searchingText
- the searching textprotected void setSelectedIndex(int index, boolean incremental)
Searchable
setSelectedIndex
in class ComboBoxSearchable
index
- the index to be selectedincremental
- a flag to enable multiple selection. If the flag is true, the element at the index should be
added to current selection. If false, you should clear previous selection and then select the
element.protected Object getElementAt(int row)
Searchable
getElementAt
in class ComboBoxSearchable
row
- the index
protected int getElementCount()
Searchable
getElementCount
in class ComboBoxSearchable
protected int getSelectedIndex()
Searchable
Here are some examples. In the case of JList, the index is the row index. In the case of JTree, the index is the row index too. In the case of JTable, depending on the selection mode, the index could be row index (in row selection mode), could be column index (in column selection mode) or could the cell index (in cell selection mode).
getSelectedIndex
in class ComboBoxSearchable
protected void addTableSelection(JTable table, int rowIndex, int columnIndex, boolean incremental)
JTable.changeSelection(int, int, boolean, boolean)
method to
select the cell if the row and column index is in the range and the cell was not selected. The last two
parameters of changeSelection is true and false respectively.
table
- the tablerowIndex
- the row index of the cell.columnIndex
- the column index of the cellincremental
- false to clear all previous selection. True to keep the previous selection.protected boolean isColumnSelectionAllowed(JTable table)
table
- the table.
protected boolean isRowSelectionAllowed(JTable table)
table
- the table.
public int[] getSearchColumnIndices()
public int getMainIndex()
public void setSearchColumnIndices(int[] columnIndices)
columnIndices
- the index of the columns to be searched. If empty, all columns will be searched. If null,
TableExComboBox#getValueColumnIndex() will be searched.public void setMainIndex(int mainIndex)
mainIndex
- the index of the column to be searched. If -1, all columns will be searched.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |