|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
com.jidesoft.swing.LabeledTextField
com.jidesoft.grid.QuickFilterField
com.jidesoft.grid.QuickTableFilterField
com.jidesoft.lucene.LuceneQuickTableFilterField
public class LuceneQuickTableFilterField
LuceneQuickTableFilterField
works along with any TableModel except TreeTableModel to provide
Lucene-equipped searching feature.
LuceneQuickTableFilterField field = new LuceneQuickTableFilterField(anyTableModel, new int[]{1, 2, 0,
5});
Later on, when you display the table, instead using your original table model, use QuickTableFilterField.getDisplayTableModel()
.
SortableTable table = new SortableTable(field.getDisplayTableModel());
Usually you place LuceneQuickTableFilterField
somewhere close to the JTable in the user interface. User
can type in any text in the text field, you will see the JTable automatically display the data that matches with the
text.
LuceneQuickTableFilterField
has two input mode.
One is normal input mode just like QuickTableFilterField
, which allows you to choose multiple columns to
search. By default, it will search for all columns. If you click on the icon before the text field, a popup menu will
be shown to allow you choose which columns to search. It could be All which means it will search for all columns. You
can control which columns to be listed in the popup menu using QuickTableFilterField.setColumnIndices(int[])
. The actual texts can
be set using QuickTableFilterField.setDisplayNames(String[])
. You can also set a text as searching text by calling QuickFilterField.setSearchingText(String)
. In this mode, we will parse the input text for you to accommodate Lucene syntax. Since we
still have to parse the input text, so some options valid in QuickTableFilterField
like case
sensitive/insensitive, wildcard flag will not valid any more.
Another is Lucene input mode. In this mode, we will just pass your input text directly to lucene QueryParser, so you
have to know exactly what Lucene syntax allows and not allows. We provided available input in the popup menu based on
Lucene 2.4.1, so you can get limited help from the menu. We also provided an link to Lucene help documents. You can
invoke LuceneFilterMenuSupport.setLuceneHelpURL(String)
to change the link if you have
better reference.
This component has a timer. If user types very fast, it will accumulate them together and generate only one searching
action. You can listen to property change event of QuickFilterField.PROPERTY_SEARCH_TEXT
to detect any text change
programmatically.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.grid.QuickTableFilterField |
---|
QuickTableFilterField.FieldTableFilter |
Nested classes/interfaces inherited from class com.jidesoft.grid.QuickFilterField |
---|
QuickFilterField.FieldFilter |
Nested classes/interfaces inherited from class com.jidesoft.swing.LabeledTextField |
---|
LabeledTextField.PopupMenuCustomizer |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary |
---|
Fields inherited from class com.jidesoft.grid.QuickTableFilterField |
---|
_actualSearchingColumnIndices, _table, _text, PROPERTY_SEARCHING_COLUMNS |
Fields inherited from class com.jidesoft.grid.QuickFilterField |
---|
_filter, _searchingText, PROPERTY_CASE_SENSITIVE, PROPERTY_FROM_END, PROPERTY_FROM_START, PROPERTY_REGEX_ENABLED, PROPERTY_SEARCH_TEXT, PROPERTY_WILDCARD_ENABLED |
Fields inherited from class com.jidesoft.swing.LabeledTextField |
---|
_button, _contextMenuKeyStroke, _customizer, _hintLabel, _hintText, _icon, _label, _labelText, _showHintTextWhenFocused, _textField |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
LuceneQuickTableFilterField()
Creates an empty LuceneQuickTableFilterField . |
|
LuceneQuickTableFilterField(TableModel tableModel)
Creates a LuceneQuickTableFilterField using the specified tableModel. |
|
LuceneQuickTableFilterField(TableModel tableModel,
int[] columnIndices)
Creates a LuceneQuickTableFilterField using the specified tableModel. |
|
LuceneQuickTableFilterField(TableModel tableModel,
int[] columnIndices,
String[] displayNames)
Creates a LuceneQuickTableFilterField using the specified tableModel. |
Method Summary | |
---|---|
void |
applyFilter(String text)
Applies the filter. |
protected JidePopupMenu |
createContextMenu()
Creates the context menu. |
protected IFilterableTableModel |
createFilterableTableModel(TableModel tableModel)
Creates LuceneFilterableTableModel which will be used by LuceneQuickTableFilterField to do the filter. |
com.jidesoft.lucene.LuceneDocumentProvider |
getLuceneDocumentProvider()
|
static String |
getLuceneHelpURL()
Deprecated. please use LuceneFilterMenuSupport.getLuceneHelpURL() instead |
String |
getResourceString(String key)
|
JTextField |
getTextField()
|
boolean |
isLuceneInputMode()
Get the flag if current input mode for JTextField is lucene input mode. |
void |
setFromEnd(boolean fromEnd)
Sets the fromEnd property. |
void |
setFromStart(boolean fromStart)
Sets the fromStart property. |
static void |
setLuceneHelpURL(String luceneHelpURL)
Deprecated. please use LuceneFilterMenuSupport.setLuceneHelpURL(String) instead |
void |
setLuceneInputMode(boolean luceneInputMode)
Set the flag if current input mode for JTextField is lucene input mode. |
void |
setTableModel(TableModel tableModel)
Sets the table model used by this component. |
Methods inherited from class com.jidesoft.swing.LabeledTextField |
---|
calculateContextMenuLocation, createLabel, createTextField, customizePopupMenu, getBaseline, getButton, getContextMenuKeyStroke, getHintText, getIcon, getLabel, getLabelText, getPopupMenuCustomizer, getText, getTextField, initLayout, isShowHintTextWhenFocused, setColumns, setContextMenuKeyStroke, setEnabled, setHintText, setIcon, setLabelText, setPopupMenuCustomizer, setShowHintTextWhenFocused, setText, showContextMenu, updateUI |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LuceneQuickTableFilterField()
LuceneQuickTableFilterField
. This method is useless since
LuceneQuickTableFilterField
has to have a table model in order to work correctly. So we have this
method in place mainly to make it JavaBean compatible. You must call setTableModel(javax.swing.table.TableModel)
after you create LuceneQuickTableFilterField
using this constructor.
public LuceneQuickTableFilterField(TableModel tableModel)
LuceneQuickTableFilterField
using the specified tableModel.
tableModel
- the TableModelpublic LuceneQuickTableFilterField(TableModel tableModel, int[] columnIndices)
LuceneQuickTableFilterField
using the specified tableModel.
tableModel
- the TableModelcolumnIndices
- the columns that you want to give user an option in the popup menu to limit the search.public LuceneQuickTableFilterField(TableModel tableModel, int[] columnIndices, String[] displayNames)
LuceneQuickTableFilterField
using the specified tableModel.
tableModel
- the TableModelcolumnIndices
- the columns that you want to give user an option in the popup menu to limit the search.displayNames
- the text appears on the popup menu.Method Detail |
---|
public void setTableModel(TableModel tableModel)
setTableModel
in class QuickTableFilterField
tableModel
- the TableModelprotected IFilterableTableModel createFilterableTableModel(TableModel tableModel)
createFilterableTableModel
in class QuickTableFilterField
tableModel
- the actual table model.
public com.jidesoft.lucene.LuceneDocumentProvider getLuceneDocumentProvider()
protected JidePopupMenu createContextMenu()
QuickFilterField
JideSwingUtilities.findFirstComponentByName(java.awt.Container, String)
. The names are "Filter.caseSensitive",
"Filter.caseInsensitive", "Filter.matchFromStart" and "Filter.matchAnywhere" respectively.
createContextMenu
in class QuickTableFilterField
public void applyFilter(String text)
QuickTableFilterField
applyFilter
in class QuickTableFilterField
text
- the searching text.public void setFromStart(boolean fromStart)
QuickFilterField
setFromStart
in class QuickFilterField
fromStart
- true if the comparison matches from the start of the text only. Otherwise false. The difference
is if true, it will use String's startWith
method to match. If false, it will use
indedxOf
method.public void setFromEnd(boolean fromEnd)
QuickFilterField
setFromEnd
in class QuickFilterField
fromEnd
- true if the comparison matches from the end of the text only. Otherwise false. The difference is
if true, it will use String's endWith
method to match. If false, it will use
indedxOf
method.public boolean isLuceneInputMode()
public void setLuceneInputMode(boolean luceneInputMode)
luceneInputMode
- the flag@Deprecated public static String getLuceneHelpURL()
LuceneFilterMenuSupport.getLuceneHelpURL()
instead
@Deprecated public static void setLuceneHelpURL(String luceneHelpURL)
LuceneFilterMenuSupport.setLuceneHelpURL(String)
instead
luceneHelpURL
- the URL linkpublic JTextField getTextField()
public String getResourceString(String key)
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |