public class QuickSearch
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static interface |
QuickSearch.Callback |
Call back interface, that is notified with the submissions to the quick search field.
|
| Modifier and Type | Method | Description |
|---|---|---|
static QuickSearch |
attach(javax.swing.JComponent component,
java.lang.Object constraints,
QuickSearch.Callback callback) |
Attach quick search to a component with given constraints.
|
static QuickSearch |
attach(javax.swing.JComponent component,
java.lang.Object constraints,
QuickSearch.Callback callback,
boolean asynchronous) |
Attach quick search to a component with given constraints.
|
static QuickSearch |
attach(javax.swing.JComponent component,
java.lang.Object constraints,
QuickSearch.Callback callback,
boolean asynchronous,
javax.swing.JMenu popupMenu) |
Attach quick search to a component with given constraints.
|
static QuickSearch |
attach(javax.swing.JComponent component,
java.lang.Object constraints,
QuickSearch.Callback callback,
javax.swing.JMenu popupMenu) |
Attach quick search to a component with given constraints.
|
void |
detach() |
Detach the quick search from the component it was attached to.
|
static java.lang.String |
findMaxPrefix(java.lang.String str1,
java.lang.String str2,
boolean ignoreCase) |
Utility method, that finds a greatest common prefix of two supplied
strings.
|
boolean |
isAlwaysShown() |
Test whether the quick search field is always shown.
|
boolean |
isEnabled() |
Test whether the quick search is enabled.
|
protected void |
maybeShowPopup(java.awt.event.MouseEvent evt,
java.awt.Component comp) |
|
void |
processKeyEvent(java.awt.event.KeyEvent ke) |
Process this key event in addition to the key events obtained from the
component we're attached to.
|
void |
setAlwaysShown(boolean alwaysShown) |
Set whether the quick search field should always be shown.
|
void |
setEnabled(boolean enabled) |
Set the enabled state of the quick search.
|
public static QuickSearch attach(javax.swing.JComponent component, java.lang.Object constraints, QuickSearch.Callback callback)
component - The component to attach toconstraints - The constraints that are used to add the search field
to the component. It's passed to Container.add(java.awt.Component, java.lang.Object)
when adding the quick search UI to the component.callback - The call back implementation, which is notified from the
quick search field submissions.public static QuickSearch attach(javax.swing.JComponent component, java.lang.Object constraints, QuickSearch.Callback callback, boolean asynchronous)
component - The component to attach toconstraints - The constraints that are used to add the search field
to the component. It's passed to Container.add(java.awt.Component, java.lang.Object)
when adding the quick search UI to the component.callback - The call back implementation, which is notified from the
quick search field submissions.public static QuickSearch attach(javax.swing.JComponent component, java.lang.Object constraints, QuickSearch.Callback callback, javax.swing.JMenu popupMenu)
component - The component to attach toconstraints - The constraints that are used to add the search field
to the component. It's passed to Container.add(java.awt.Component, java.lang.Object)
when adding the quick search UI to the component.callback - The call back implementation, which is notified from the
quick search field submissions.popupMenu - A pop-up menu, that is displayed on the find icon, next to the search
field. This allows customization of the search criteria. The pop-up menu
is taken from JMenu.getPopupMenu().public static QuickSearch attach(javax.swing.JComponent component, java.lang.Object constraints, QuickSearch.Callback callback, boolean asynchronous, javax.swing.JMenu popupMenu)
component - The component to attach toconstraints - The constraints that are used to add the search field
to the component. It's passed to Container.add(java.awt.Component, java.lang.Object)
when adding the quick search UI to the component.callback - The call back implementation, which is notified from the
quick search field submissions.asynchronous - Set whether the quick search notifies the call back
asynchronously, or not.
By default, Callback is notified synchronously on EQ thread.
If true, three notification methods are called asynchronously
on a background thread. These are
QuickSearch.Callback.quickSearchUpdate(java.lang.String),
Callback#showNextSelection(javax.swing.text.Position.Bias),
QuickSearch.Callback.findMaxPrefix(java.lang.String).
If false all methods are called synchronously on EQ thread.popupMenu - A pop-up menu, that is displayed on the find icon, next to the search
field. This allows customization of the search criteria. The pop-up menu
is taken from JMenu.getPopupMenu().public void detach()
public boolean isAlwaysShown()
false by default.true when the search field is always shown,
false otherwise.public void setAlwaysShown(boolean alwaysShown)
alwaysShown - true to always show the search field,
false otherwise.public boolean isEnabled()
true
by default.true when the quick search is enabled,
false otherwise.public void setEnabled(boolean enabled)
enabled - true to enable the quick search,
false otherwise.public void processKeyEvent(java.awt.event.KeyEvent ke)
ke - a key event to process.protected void maybeShowPopup(java.awt.event.MouseEvent evt,
java.awt.Component comp)
public static java.lang.String findMaxPrefix(java.lang.String str1,
java.lang.String str2,
boolean ignoreCase)
str1 - The first stringstr2 - The second stringignoreCase - Whether to ignore case in the comparisonsBuilt on April 24 2018. | Portions Copyright 1997-2018 Oracle. All rights reserved.