Class SearchField
- java.lang.Object
-
- org.faceless.pdf2.viewer2.ViewerFeature
-
- org.faceless.pdf2.viewer2.ViewerWidget
-
- org.faceless.pdf2.viewer2.feature.SearchField
-
- All Implemented Interfaces:
DocumentPanelListener
public class SearchField extends ViewerWidget implements DocumentPanelListener
Create a widget that displays a Search field in the Toolbar. When activated, this widget will select or create aSearchPanel.Resultsand display the search results. The name of this feature is SearchFieldThe following initialization parameters can be specified to configure this feature.regex trueorfalseforsetUseRegex(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
-
-
Field Summary
-
Fields inherited from class org.faceless.pdf2.viewer2.ViewerWidget
propertyChangeSupport
-
-
Constructor Summary
Constructors Constructor Description SearchField()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddocumentUpdated(DocumentPanelEvent event)Called when anDocumentPanelEventis raisedintgetMinLength()Return the minimum length a search term has to be before it's a valid termvoidinitialize(PDFViewer viewer)Called when the feature is first added to a viewerbooleanisSearchValid(String text)Return true if the specified value is a valid search term.voidsetMerged(boolean merged)Set whether to merge search results on a single page into one entry, which will highlight all results on that page when selected.voidsetMinLength(int length)Set the minimum length a search term has to be before it's a valid termvoidsetUseRegex(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.ViewerWidget
action, addPropertyChangeListener, createActionListener, firePropertyChange, getComponent, getIcon, getViewer, isButtonEnabledByDefault, isDocumentRequired, isMenuEnabledByDefault, removePropertyChangeListener, setButton, setComponent, setDocumentRequired, setMenu, setMenu, setToolBarEnabled, setToolBarEnabledAlways, setToolBarFloatable, setToolBarFloating, 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:ViewerFeatureCalled when the feature is first added to a viewer- Overrides:
initializein classViewerWidget
-
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
-
setMerged
public void setMerged(boolean merged)
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
-
getMinLength
public int getMinLength()
Return the minimum length a search term has to be before it's a valid term- Since:
- 2.29.1
-
setMinLength
public void setMinLength(int length)
Set the minimum length a search term has to be before it's a valid term- Parameters:
length- the minimum length- Since:
- 2.29.1
-
isSearchValid
public boolean isSearchValid(String text)
Return true if the specified value is a valid search term. Invalid terms will be rejected by the search fields, although they will still be accepted if you pass them directly to the#searchmethod. The default implementation returnstext.length() >= getMinLength()- Parameters:
text- the text value- Returns:
- whether the term is valid
- Since:
- 2.29.1
-
documentUpdated
public void documentUpdated(DocumentPanelEvent event)
Description copied from interface:DocumentPanelListenerCalled when anDocumentPanelEventis raised- Specified by:
documentUpdatedin interfaceDocumentPanelListener
-
-