Package org.jdesktop.swingx.search
Class SearchFactory
java.lang.Object
org.jdesktop.swingx.search.SearchFactory
- All Implemented Interfaces:
UIDependent
Factory to create, configure and show application consistent
search and find widgets.
Typically a shared JXFindBar is used for incremental search, while
a shared JXFindPanel is used for batch search. This implementation
- JXFindBar - adds and shows it in the target's toplevel container's toolbar (assuming a JXRootPane)
- JXFindPanel - creates a JXDialog, adds and shows the findPanel in the Dialog
- Author:
- Jeanette Winzenburg
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected JXFindBar
the shared find widget for incremental-find.protected JXFindPanel
the shared find widget for batch-find.protected JComponent
this is a temporary hack: need to remove the useSearchHighlighter property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Configures the shared FindBar.protected void
Configures the shared FindPanel.Factory method to create a JXFindBar.Factory method to create a JXFindPanel.static SearchFactory
Returns the shared SearchFactory.Returns a common Keystroke for triggering a search.Returns the shared JXFindBar.Returns the shared JXFindPanel.protected Point
hideSharedFindPanel
(boolean dispose) Hides the findPanel's toplevel window and returns its location.protected void
installFindRemover
(Container target, Container findWidget) boolean
isUseFindBar
(JComponent target, Searchable searchable) Returns decision about using a batch- vs. incremental-find for the searchable.protected void
Pre: findbar !protected void
removeFromParent
(JComponent component) convenience method to remove a component from its parent and revalidate the parentstatic void
setInstance
(SearchFactory factory) Sets the shared SearchFactory.void
setUseFindBar
(boolean incremental) Sets the default search type to incremental or batch, for a true/false boolean.void
showFindBar
(JComponent target, Searchable searchable) Show a incremental-find widget targeted at the searchable.void
showFindDialog
(JComponent target, Searchable searchable) Show a batch-find widget targeted at the given Searchable.void
showFindInput
(JComponent target, Searchable searchable) Shows an appropriate find widget targeted at the searchable.protected void
void
updateUI()
-
Field Details
-
findPanel
the shared find widget for batch-find. -
findBar
the shared find widget for incremental-find. -
lastFindBarTarget
this is a temporary hack: need to remove the useSearchHighlighter property.
-
-
Constructor Details
-
SearchFactory
public SearchFactory()
-
-
Method Details
-
getInstance
Returns the shared SearchFactory.- Returns:
- the shared
SearchFactory
-
setInstance
Sets the shared SearchFactory.- Parameters:
factory
-
-
getSearchAccelerator
Returns a common Keystroke for triggering a search. Tries to be OS-specific.PENDING: this should be done in the LF and the keyStroke looked up in the UIManager.
- Returns:
- the keyStroke to register with a findAction.
-
isUseFindBar
Returns decision about using a batch- vs. incremental-find for the searchable. This implementation returns the useFindBar property directly.- Parameters:
target
- - the component associated with the searchablesearchable
- - the object to search.- Returns:
- true if a incremental-find should be used, false otherwise.
-
setUseFindBar
public void setUseFindBar(boolean incremental) Sets the default search type to incremental or batch, for a true/false boolean. The default value is false (== batch).- Parameters:
incremental
- a boolean to indicate the default search type, true for incremental and false for batch.
-
showFindInput
Shows an appropriate find widget targeted at the searchable. Opens a batch-find or incremental-find widget based on the return value ofisUseFindBar
.- Parameters:
target
- - the component associated with the searchablesearchable
- - the object to search.- See Also:
-
showFindBar
Show a incremental-find widget targeted at the searchable. This implementation uses a JXFindBar and inserts it into the target's toplevel container toolbar. PENDING: Nothing shown if there is no toolbar found.- Parameters:
target
- - the component associated with the searchablesearchable
- - the object to search.
-
createFindBar
Factory method to create a JXFindBar.- Returns:
- the
JXFindBar
-
installFindRemover
-
removeFromParent
convenience method to remove a component from its parent and revalidate the parent -
stopSearching
protected void stopSearching() -
releaseFindBar
protected void releaseFindBar()Pre: findbar != null. -
showFindDialog
Show a batch-find widget targeted at the given Searchable. This implementation uses a shared JXFindPanel contained JXDialog.- Parameters:
target
- - the component associated with the searchablesearchable
- - the object to search.
-
createFindPanel
Factory method to create a JXFindPanel.- Returns:
JXFindPanel
-
updateUI
public void updateUI()- Specified by:
updateUI
in interfaceUIDependent
-