Class ContentPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, HyperlinkListener, NavigationEventListener

public class ContentPane extends JPanel implements NavigationEventListener, HyperlinkListener
Displays a page
See Also:
  • Field Details

  • Constructor Details

    • ContentPane

      public ContentPane(Navigator navigator)
  • Method Details

    • initBook

      private void initBook(Book book)
    • matchesAny

      private static boolean matchesAny(String searchString, String... possibleValues)
      Whether the given searchString matches any of the possibleValues.
      Parameters:
      searchString -
      possibleValues -
      Returns:
      Whether the given searchString matches any of the possibleValues.
    • scrollToElement

      private static void scrollToElement(JEditorPane editorPane, HTMLDocument.Iterator elementIterator)
      Scrolls the editorPane to the startOffset of the current element in the elementIterator
      Parameters:
      editorPane -
      elementIterator -
      requestFragmentId -
      attributeValue -
    • scrollToNamedAnchor

      private void scrollToNamedAnchor(String fragmentId)
      Scrolls the editorPane to the first anchor element whose id or name matches the given fragmentId.
      Parameters:
      fragmentId -
    • createJEditorPane

      private JEditorPane createJEditorPane()
    • displayPage

      public void displayPage(Resource resource)
    • displayPage

      public void displayPage(Resource resource, int sectionPos)
    • scrollToCurrentPosition

      private void scrollToCurrentPosition(int sectionPos)
    • hyperlinkUpdate

      public void hyperlinkUpdate(HyperlinkEvent event)
      Specified by:
      hyperlinkUpdate in interface HyperlinkListener
    • gotoPreviousPage

      public void gotoPreviousPage()
    • gotoNextPage

      public void gotoNextPage()
    • calculateTargetHref

      private String calculateTargetHref(URL clickUrl)
      Transforms a link generated by a click on a link in a document to a resource href. Property handles http encoded spaces and such.
      Parameters:
      clickUrl -
      Returns:
      a link generated by a click on a link transformed into a document to a resource href.