org.faceless.pdf2.viewer2.feature

## 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 and Description
    `Results()` Create a new Results object.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(ChangeListener listener)` Add a `ChangeListener` to this panel.
    `void` | `addResult(PageExtractor.Text text)` Add the specified `PageExtractor.Text` to the list of results
    `void` | `cancel()` Cancel any currently running search
    `void` | `clearResults()` Clear the list of results
    `void` | `documentUpdated(DocumentPanelEvent event)` Called when an `DocumentPanelEvent` is raised
    `Icon` | `getIcon()` Return the Icon to use when displaying this SidePanel
    `String` | `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 hidden
    `void` | `panelVisible()` Called when the panel is made visible
    `void` | `propertyChange(PropertyChangeEvent event)`
    `void` | `removeChangeListener(ChangeListener listener)` Remove a `ChangeListener` from this panel.
    `void` | `search(String text)` Search for an item of text in the PDF currently displayed in this `DocumentPanel`.
    `void` | `setDocumentPanel(DocumentPanel docpanel)` Set the `DocumentPanel` this SidePanel is a member of.
    `void` | `setTextTool(TextTool selection)` Set the `TextTool` 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Results

          public Results()

      Create a new Results object.

  - ### Method Detail

    - #### getName

          public String getName()

      Return the name of this tab - "Find"
      Specified by:
        `getName` in interface `SidePanel`
      Overrides:
        `getName` in class `Component`

    - #### getIcon

          public Icon getIcon()

      Description copied from interface: `SidePanel`
      Return the Icon to use when displaying this SidePanel
      Specified by:
        `getIcon` in interface `SidePanel`

    - #### setTextTool

          public void setTextTool(TextTool selection)

      Set the `TextTool` object this object will highlight its results on.

    - #### addResult

          public void addResult(PageExtractor.Text text)

      Add the specified `PageExtractor.Text` to the list of results

    - #### clearResults

          public void clearResults()

      Clear the list of results

    - #### addChangeListener

          public void addChangeListener(ChangeListener listener)

      Add a `ChangeListener` to this panel. A `ChangeEvent` will be raised when the status of the search is updated.

    - #### removeChangeListener

          public void removeChangeListener(ChangeListener listener)

      Remove a `ChangeListener` from this panel.

    - #### search

          public void search(String text)

      Search for an item of text in the PDF currently displayed in this `DocumentPanel`. 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 in `mayContain(int, java.lang.String)`
      Parameters:
        `pagenumber` - the page number
        `extractor` - 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 have `PageExtractor.getMatchingText(java.lang.String)` run on it to find and (possibly) return matching values. Although this method could theoretically use some sort of index created in `indexPage(int, org.faceless.pdf2.PageExtractor)` to narrow down which pages to search, but the default implementation always returns true.
      Parameters:
        `pagenumber` - the pagenumber to search
        `value` - the text to search for

    - #### setDocumentPanel

          public void setDocumentPanel(DocumentPanel docpanel)

      Description copied from interface: `SidePanel`
      Set the `DocumentPanel` 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 with `null` as it's argument.
      Specified by:
        `setDocumentPanel` in interface `SidePanel`

    - #### documentUpdated

          public void documentUpdated(DocumentPanelEvent event)

      Description copied from interface: `DocumentPanelListener`
      Called when an `DocumentPanelEvent` is raised
      Specified by:
        `documentUpdated` in interface `DocumentPanelListener`

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent event)

      Specified by:
        `propertyChange` in interface `PropertyChangeListener`

    - #### panelVisible

          public void panelVisible()

      Description copied from interface: `SidePanel`
      Called when the panel is made visible
      Specified by:
        `panelVisible` in interface `SidePanel`

    - #### panelHidden

          public void panelHidden()

      Description copied from interface: `SidePanel`
      Called when the panel is made hidden
      Specified by:
        `panelHidden` in interface `SidePanel`

Copyright © 2001-2015 Big Faceless Organization