Class SearchPanel.Results
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- org.faceless.pdf2.viewer2.feature.SearchPanel.Results
-
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,PropertyChangeListener
,Serializable
,EventListener
,Accessible
,DocumentPanelListener
,SidePanel
- Enclosing class:
- SearchPanel
public static class SearchPanel.Results extends JPanel implements SidePanel, DocumentPanelListener, PropertyChangeListener
This class is the SidePanel returned by the parent factory, and represents the search results panel. It may be created by the parent factory, or may be instantiated on it's own.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description Results()
Create a new Results object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(ChangeListener listener)
Add aChangeListener
to this panel.void
addResult(PageExtractor.Text text)
Add the specifiedPageExtractor.Text
to the list of resultsvoid
cancel()
Cancel any currently running searchvoid
clearResults()
Clear the list of resultsvoid
documentUpdated(DocumentPanelEvent event)
Called when anDocumentPanelEvent
is raisedIcon
getIcon()
Return the Icon to use when displaying this SidePanelString
getName()
Return the name of this tab - "Find"float
getSearchProgress()
Return the progress of the current search.protected void
indexPage(int pagenumber, PageExtractor extractor)
Index the page.protected boolean
mayContain(int pagenumber, String value)
Return whether the specified text may be found on the specified pagenumber.void
panelHidden()
Called when the panel is made hiddenvoid
panelVisible()
Called when the panel is made visiblevoid
propertyChange(PropertyChangeEvent event)
void
removeChangeListener(ChangeListener listener)
Remove aChangeListener
from this panel.void
search(String text)
Search for an item of text in the PDF currently displayed in thisDocumentPanel
.void
setDocumentPanel(DocumentPanel docpanel)
Set theDocumentPanel
this SidePanel is a member of.void
setTextTool(TextTool selection)
Set theTextTool
object this object will highlight its results on.-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Method Detail
-
getName
public String getName()
Return the name of this tab - "Find"
-
getIcon
public Icon getIcon()
Description copied from interface:SidePanel
Return the Icon to use when displaying this SidePanel
-
setTextTool
public void setTextTool(TextTool selection)
Set theTextTool
object this object will highlight its results on.
-
addResult
public void addResult(PageExtractor.Text text)
Add the specifiedPageExtractor.Text
to the list of results- Parameters:
text
- the text to add, or zero to mean "finished adding"
-
clearResults
public void clearResults()
Clear the list of results
-
addChangeListener
public void addChangeListener(ChangeListener listener)
Add aChangeListener
to this panel. AChangeEvent
will be raised when the status of the search is updated.
-
removeChangeListener
public void removeChangeListener(ChangeListener listener)
Remove aChangeListener
from this panel.
-
search
public void search(String text)
Search for an item of text in the PDF currently displayed in thisDocumentPanel
. If a search is currently running it is interrupted, and any previously found results are cleared.- Parameters:
text
- the text to search for
-
cancel
public void cancel()
Cancel any currently running search
-
getSearchProgress
public float getSearchProgress()
Return the progress of the current search. The returned value is 0 if no search is currently running (because it's been cancelled, completed or not yet started), or a value between 0 and 1.
-
indexPage
protected void indexPage(int pagenumber, PageExtractor extractor)
Index the page. The default implementation of this method is a no-op, but theoretically we could create an index with Lucene here for access inmayContain(int, java.lang.String)
- Parameters:
pagenumber
- the page numberextractor
- the extractor for that page
-
mayContain
protected boolean mayContain(int pagenumber, String value)
Return whether the specified text may be found on the specified pagenumber. If this method returns true, the page will havePageExtractor.getMatchingNormalizedText(java.lang.String[], boolean)
run on it to find and (possibly) return matching values. Although this method could theoretically use some sort of index created inindexPage(int, org.faceless.pdf2.PageExtractor)
to narrow down which pages to search, but the default implementation always returns true.- Parameters:
pagenumber
- the pagenumber to searchvalue
- the text to search for
-
setDocumentPanel
public void setDocumentPanel(DocumentPanel docpanel)
Description copied from interface:SidePanel
Set theDocumentPanel
this SidePanel is a member of. This method is called every time the DocumentPanel has it's document changed - the SidePanel should be reinitialized in this call. If the SidePanel is removed, this method will be called withnull
as it's argument.- Specified by:
setDocumentPanel
in interfaceSidePanel
-
documentUpdated
public void documentUpdated(DocumentPanelEvent event)
Description copied from interface:DocumentPanelListener
Called when anDocumentPanelEvent
is raised- Specified by:
documentUpdated
in interfaceDocumentPanelListener
-
propertyChange
public void propertyChange(PropertyChangeEvent event)
- Specified by:
propertyChange
in interfacePropertyChangeListener
-
panelVisible
public void panelVisible()
Description copied from interface:SidePanel
Called when the panel is made visible- Specified by:
panelVisible
in interfaceSidePanel
-
panelHidden
public void panelHidden()
Description copied from interface:SidePanel
Called when the panel is made hidden- Specified by:
panelHidden
in interfaceSidePanel
-
-