Class SearchPanel.Results

    • Constructor Detail

      • Results

        public Results()
        Create a new Results object.
    • Method Detail

      • 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
        Parameters:
        text - the text to add, or zero to mean "finished adding"
      • clearResults

        public void clearResults()
        Clear the list of results
      • 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
      • 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