org.jdesktop.swingx.search
Class SearchFactory
- java.lang.Object
-
- org.jdesktop.swingx.search.SearchFactory
-
- All Implemented Interfaces:
- UIDependent
public class SearchFactory extends java.lang.Object implements 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description classSearchFactory.FindRemover
-
Constructor Summary
Constructors Constructor and Description SearchFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description JXFindBarcreateFindBar()Factory method to create a JXFindBar.JXFindPanelcreateFindPanel()Factory method to create a JXFindPanel.static SearchFactorygetInstance()Returns the shared SearchFactory.javax.swing.KeyStrokegetSearchAccelerator()Returns a common Keystroke for triggering a search.JXFindBargetSharedFindBar()Returns the shared JXFindBar.JXFindPanelgetSharedFindPanel()Returns the shared JXFindPanel.booleanisUseFindBar(javax.swing.JComponent target, Searchable searchable)Returns decision about using a batch- vs.static 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(javax.swing.JComponent target, Searchable searchable)Show a incremental-find widget targeted at the searchable.voidshowFindDialog(javax.swing.JComponent target, Searchable searchable)Show a batch-find widget targeted at the given Searchable.voidshowFindInput(javax.swing.JComponent target, Searchable searchable)Shows an appropriate find widget targeted at the searchable.voidupdateUI()Updates all internal visuals after changing a UI-delegate.
-
-
-
Method Detail
-
getInstance
public static SearchFactory getInstance()
Returns the shared SearchFactory.- Returns:
- the shared
SearchFactory
-
setInstance
public static void setInstance(SearchFactory factory)
Sets the shared SearchFactory.- Parameters:
factory-
-
getSearchAccelerator
public javax.swing.KeyStroke 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
public boolean isUseFindBar(javax.swing.JComponent target, Searchable searchable)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
public void showFindInput(javax.swing.JComponent target, Searchable searchable)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:
isUseFindBar(JComponent, Searchable),setUseFindBar(boolean)
-
showFindBar
public void showFindBar(javax.swing.JComponent target, Searchable searchable)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.
-
getSharedFindBar
public JXFindBar getSharedFindBar()
Returns the shared JXFindBar. Creates and configures on first call.- Returns:
- the shared
JXFindBar
-
createFindBar
public JXFindBar createFindBar()
Factory method to create a JXFindBar.- Returns:
- the
JXFindBar
-
showFindDialog
public void showFindDialog(javax.swing.JComponent target, Searchable searchable)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.
-
getSharedFindPanel
public JXFindPanel getSharedFindPanel()
Returns the shared JXFindPanel. Lazyly creates and configures on first call.- Returns:
- the shared
JXFindPanel
-
createFindPanel
public JXFindPanel createFindPanel()
Factory method to create a JXFindPanel.- Returns:
JXFindPanel
-
updateUI
public void updateUI()
Updates all internal visuals after changing a UI-delegate.- Specified by:
updateUIin interfaceUIDependent- See Also:
JComponent.updateUI()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG