Class BasicPanel

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, Scrollable, FSCanvas, UserInterface, FormSubmissionListener, RepaintListener
Direct Known Subclasses:
XHTMLPanel

@ParametersAreNonnullByDefault public abstract class BasicPanel extends RootPanel implements FormSubmissionListener
A Swing JPanel that encloses the Flying Saucer renderer for easy integration into Swing applications.
See Also:
  • Field Details

    • PAGE_PAINTING_CLEARANCE_WIDTH

      private static final int PAGE_PAINTING_CLEARANCE_WIDTH
      See Also:
    • PAGE_PAINTING_CLEARANCE_HEIGHT

      private static final int PAGE_PAINTING_CLEARANCE_HEIGHT
      See Also:
    • explicitlyOpaque

      private boolean explicitlyOpaque
    • mouseTracker

      private final MouseTracker mouseTracker
    • centeredPagedView

      private boolean centeredPagedView
    • formSubmissionListener

      protected FormSubmissionListener formSubmissionListener
  • Constructor Details

    • BasicPanel

      protected BasicPanel()
    • BasicPanel

      protected BasicPanel(UserAgentCallback uac)
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
      Overrides:
      paintComponent in class JComponent
    • doRender

      protected void doRender(RenderingContext c, Layer root)
    • paintDefaultBackground

      private void paintDefaultBackground(Graphics g)
    • paintPagedView

      private void paintPagedView(RenderingContext c, Layer root)
    • calcCenteredPageLeftOffset

      private int calcCenteredPageLeftOffset(int maxPageWidth)
    • paintPage

      public void paintPage(Graphics2D g, int pageNo)
    • assignPagePrintPositions

      public void assignPagePrintPositions(Graphics2D g)
    • printTree

      public void printTree()
    • printTree

      private void printTree(Box box, String tab)
    • setLayout

      public void setLayout(LayoutManager l)
      Sets the layout attribute of the BasicPanel object Overrides the method to do nothing, since you shouldn't have a LayoutManager on an FS panel.
      Overrides:
      setLayout in class Container
      Parameters:
      l - The new layout value
    • setSharedContext

      public void setSharedContext(SharedContext ctx)
    • setSize

      public void setSize(Dimension d)
      Overrides:
      setSize in class Component
    • setDocument

      public void setDocument(InputStream stream, String url, NamespaceHandler nsh)
    • setDocumentFromString

      public void setDocumentFromString(String content, @Nullable String url, NamespaceHandler nsh)
    • setDocument

      public void setDocument(Document doc, String url)
    • setDocument

      public void setDocument(String url)
    • setDocument

      public void setDocument(String url, NamespaceHandler nsh)
    • setDocument

      protected void setDocument(InputStream stream, String url)
    • setDocumentRelative

      protected void setDocumentRelative(String filename)
      Sets the new current document, where the new document is located relative, e.g. using a relative URL.
      Parameters:
      filename - The new document to load
    • reloadDocument

      public void reloadDocument(String URI)
      Reloads the document using the same base URL and namespace handler. Reloading will pick up changes to styles within the document.
      Parameters:
      URI - A URI for the Document to load, for example, file.toURL().toExternalForm().
    • reloadDocument

      public void reloadDocument(Document doc)
      Reloads the document using the same base URL and namespace handler. Reloading will pick up changes to styles within the document.
      Parameters:
      doc - The document to reload.
    • getURL

      public URL getURL()
    • getDocument

      public Document getDocument()
    • getDocumentTitle

      public String getDocumentTitle()
      Returns the title as reported by the NamespaceHandler assigned to the SharedContext in this panel. For an HTML document, this will be the contents of /html/head/title.
      Returns:
      the document title, or "" if the namespace handler cannot find a title, or if there is no current document in the panel.
    • loadDocument

      protected Document loadDocument(String uri)
    • isOpaque

      public boolean isOpaque()
      Returns whether the background of this BasicPanel will be painted when it is rendered.
      Overrides:
      isOpaque in class JComponent
      Returns:
      true if the background of this BasicPanel will be painted, false if it will not.
    • setOpaque

      public void setOpaque(boolean opaque)
      Specifies whether the background of this BasicPanel will be painted when it is rendered.
      Overrides:
      setOpaque in class JComponent
      Parameters:
      opaque - true if the background of this BasicPanel should be painted, false if it should not.
    • checkOpacityMethodClient

      private void checkOpacityMethodClient()
      Checks that the calling method of the method that calls this method is not in this class and throws a RuntimeException if it was. This is used to ensure that parts of this class that use the opacity to indicate something other than whether the background is painted do not interfere with the user's intentions regarding the background painting.
      Throws:
      IllegalStateException - if the method that called this method was itself called by a method in this same class.
    • isAnchorInCurrentDocument

      private boolean isAnchorInCurrentDocument(String str)
    • getAnchorId

      private String getAnchorId(String url)
    • scrollTo

      public void scrollTo(Point pt)
      Scroll the panel to make the specified point be on screen. Typically, this will scroll the screen down to the y component of the point.
    • isInteractive

      public boolean isInteractive()
    • setInteractive

      public void setInteractive(boolean interactive)
    • addMouseTrackingListener

      public void addMouseTrackingListener(FSMouseListener l)
    • removeMouseTrackingListener

      public void removeMouseTrackingListener(FSMouseListener l)
    • getMouseTrackingListeners

      public List<FSMouseListener> getMouseTrackingListeners()
    • resetMouseTracker

      protected void resetMouseTracker()
    • isCenteredPagedView

      public boolean isCenteredPagedView()
    • setCenteredPagedView

      public void setCenteredPagedView(boolean centeredPagedView)
    • submit

      public void submit(String url)
      Description copied from interface: FormSubmissionListener
      Called by XhtmlForm when a form is submitted.
      Specified by:
      submit in interface FormSubmissionListener
      Parameters:
      url - the entire query string as composed of form elements and the form's action URL
    • setFormSubmissionListener

      public void setFormSubmissionListener(FormSubmissionListener fsl)