org.faceless.pdf2.viewer2.feature

## Class TextSelection.Range

- java.lang.Object
- - org.faceless.pdf2.viewer2.feature.TextSelection.Range

- Enclosing class:
    TextSelection

      public abstract static class TextSelection.Range
      extends Object

  A Range represents a selected range of `PageExtractor.Text` items. The range may only cover a single page

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Range()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static TextSelection.Range` | `createRange(PageExtractor.Text text)` Create a new Range that matches the specified text item
    `static TextSelection.Range` | `createRange(PageExtractor.Text first, int firstposition, PageExtractor.Text last, int lastposition)` Create a new Range that covers the range of text from `first` character `firstposition`. to `last` character `lastposition` inclusive.
    `abstract PageExtractor.Text` | `getFirst()` Return the first `PageExtractor.Text` object that is selected
    `abstract int` | `getFirstPosition()` Return offset into the Text item returned by `getFirst()` that begins the selection.
    `abstract PageExtractor.Text` | `getLast()` Return the last `PageExtractor.Text` object that is selected
    `abstract int` | `getLastPosition()` Return offset into the Text item returned by `getLast()` that ends the selection.
    `PDFPage` | `getPage()` Return the `PDFPage` this range object relates to.
    `AttributedString` | `getStyledText()` Return the text this Range covers
    `StringBuffer` | `getText()` Return the text this Range covers
    `abstract boolean` | `isValid()` Return true if this Range is valid, false otherwise

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

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

- - ### Constructor Detail

    - #### Range

          public Range()

  - ### Method Detail

    - #### getPage

          public PDFPage getPage()

      Return the `PDFPage` this range object relates to.

    - #### getFirst

          public abstract PageExtractor.Text getFirst()

      Return the first `PageExtractor.Text` object that is selected

    - #### getLast

          public abstract PageExtractor.Text getLast()

      Return the last `PageExtractor.Text` object that is selected

    - #### getFirstPosition

          public abstract int getFirstPosition()

      Return offset into the Text item returned by `getFirst()` that begins the selection.

    - #### getLastPosition

          public abstract int getLastPosition()

      Return offset into the Text item returned by `getLast()` that ends the selection. Note this is the offset of the last selected character, not the first unselected character.

    - #### getText

          public StringBuffer getText()

      Return the text this Range covers

    - #### getStyledText

          public AttributedString getStyledText()

      Return the text this Range covers

    - #### isValid

          public abstract boolean isValid()

      Return true if this Range is valid, false otherwise

    - #### createRange

          public static TextSelection.Range createRange(PageExtractor.Text text)

      Create a new Range that matches the specified text item

    - #### createRange

          public static TextSelection.Range createRange(PageExtractor.Text first,
                                                        int firstposition,
                                                        PageExtractor.Text last,
                                                        int lastposition)

      Create a new Range that covers the range of text from `first` character `firstposition`. to `last` character `lastposition` inclusive.
      Parameters:
        `first` - the first text
        `firstposition` - the offset into the first text to start at
        `last` - the last text
        `lastposition` - the offset into the last text to end at

Copyright © 2001-2015 Big Faceless Organization