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 JXFindBarthe shared find widget for incremental-find.protected JXFindPanelthe shared find widget for batch-find.protected JComponentthis is a temporary hack: need to remove the useSearchHighlighter property. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidConfigures the shared FindBar.protected voidConfigures the shared FindPanel.Factory method to create a JXFindBar.Factory method to create a JXFindPanel.static SearchFactoryReturns the shared SearchFactory.Returns a common Keystroke for triggering a search.Returns the shared JXFindBar.Returns the shared JXFindPanel.protected PointhideSharedFindPanel(boolean dispose) Hides the findPanel's toplevel window and returns its location.protected voidinstallFindRemover(Container target, Container findWidget) booleanisUseFindBar(JComponent target, Searchable searchable) Returns decision about using a batch- vs. incremental-find for the searchable.protected voidPre: findbar !protected voidremoveFromParent(JComponent component) convenience method to remove a component from its parent and revalidate the parentstatic voidsetInstance(SearchFactory factory) Sets the shared SearchFactory.voidsetUseFindBar(boolean incremental) Sets the default search type to incremental or batch, for a true/false boolean.voidshowFindBar(JComponent target, Searchable searchable) Show a incremental-find widget targeted at the searchable.voidshowFindDialog(JComponent target, Searchable searchable) Show a batch-find widget targeted at the given Searchable.voidshowFindInput(JComponent target, Searchable searchable) Shows an appropriate find widget targeted at the searchable.protected voidvoidupdateUI()
-
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:
updateUIin interfaceUIDependent
-