Class SearchPanel
- java.lang.Object
-
- org.faceless.pdf2.viewer2.ViewerFeature
-
- org.faceless.pdf2.viewer2.SidePanelFactory
-
- org.faceless.pdf2.viewer2.feature.SearchPanel
-
public class SearchPanel extends SidePanelFactory
Creates aSidePanel
that displays search results. This panel may be used instead of or as well as theSearchField
- if no SearchField is found the panel will have a field placed at the top automatically (seesetCreateSearchField(boolean)
).The following initialization parameters can be specified to configure this feature.The name of this feature is SearchPanelcreateSearchField true
orfalse
forsetCreateSearchField(boolean)
regex true
orfalse
forsetUseRegex(boolean)
This code is copyright the Big Faceless Organization. You're welcome to use, modify and distribute it in any form in your own projects, provided those projects continue to make use of the Big Faceless PDF library.
- Since:
- 2.8
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SearchPanel.Field
A subclass of JTextField customized for searching - it has a setProgress() method to report the progress of the search, and an icon in the backgroundstatic class
SearchPanel.Results
This class is the SidePanel returned by the parent factory, and represents the search results panel.
-
Constructor Summary
Constructors Constructor Description SearchPanel()
Create a new SearchPanel
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SidePanel
createSidePanel()
Create and return a newSidePanel
.void
initialize(PDFViewer viewer)
Called when the feature is first added to a viewervoid
setCreateSearchField(boolean createfield)
Set whether to create aSearchPanel.Field
at the top of theSearchPanel.Results
panel.void
setMerged(boolean merge)
Set whether to merge search results on a single page into one entry, which will highlight all results on that page when selected.void
setTextTool(TextTool selection)
Set theTextTool
object that will display the selection when an item in this panel is clicked on.void
setUseRegex(boolean regex)
Set whether searches run through the Search Field created by this class use a regular-expression instead of a text value.-
Methods inherited from class org.faceless.pdf2.viewer2.SidePanelFactory
isSidePanelRequired, toString
-
Methods inherited from class org.faceless.pdf2.viewer2.ViewerFeature
getAllEnabledFeatures, getAllFeatures, getCustomJavaScript, getFeatureProperty, getFeatureURLProperty, getName, isEnabledByDefault, setFeatureName, teardown
-
-
-
-
Method Detail
-
initialize
public void initialize(PDFViewer viewer)
Description copied from class:ViewerFeature
Called when the feature is first added to a viewer- Overrides:
initialize
in classViewerFeature
-
setCreateSearchField
public void setCreateSearchField(boolean createfield)
Set whether to create aSearchPanel.Field
at the top of theSearchPanel.Results
panel. By default this is the case, although if aSearchField
is included in the feature list this is turned off.- Parameters:
createfield
- whether to create a Field object or not
-
setUseRegex
public void setUseRegex(boolean regex)
Set whether searches run through the Search Field created by this class use a regular-expression instead of a text value. The default is false.- Parameters:
regex
- whether to use a regular expression or not- Since:
- 2.18.3
-
setTextTool
public void setTextTool(TextTool selection)
Set theTextTool
object that will display the selection when an item in this panel is clicked on. A value ofnull
(the default) will cause the panel to use the first TextTool object it finds in the viewer, or if none exists a new one will be created.- Parameters:
selection
- the selection object that will be used to display the selected results
-
setMerged
public void setMerged(boolean merge)
Set whether to merge search results on a single page into one entry, which will highlight all results on that page when selected. By default this is set to false.- Parameters:
merge
- whether to merge the results as described- Since:
- 2.28.2
-
createSidePanel
public SidePanel createSidePanel()
Description copied from class:SidePanelFactory
Create and return a newSidePanel
.- Specified by:
createSidePanel
in classSidePanelFactory
-
-