Class SWTReplacedElementFactory

java.lang.Object
org.xhtmlrenderer.swt.SWTReplacedElementFactory
All Implemented Interfaces:
org.xhtmlrenderer.extend.ReplacedElementFactory
Direct Known Subclasses:
SWTXhtmlReplacedElementFactory

public class SWTReplacedElementFactory extends Object implements org.xhtmlrenderer.extend.ReplacedElementFactory
Author:
Vianney le Clément
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Dispose missing image if created.
    org.xhtmlrenderer.extend.ReplacedElement
    createReplacedElement(org.xhtmlrenderer.layout.LayoutContext c, org.xhtmlrenderer.render.BlockBox box, org.xhtmlrenderer.extend.UserAgentCallback uac, int cssWidth, int cssHeight)
     
    protected org.xhtmlrenderer.extend.ReplacedElement
    Retrieves a ReplacedElement for an image from cache, or null if not found.
    void
     
    protected org.xhtmlrenderer.extend.ReplacedElement
    replaceImage(org.xhtmlrenderer.extend.UserAgentCallback uac, org.xhtmlrenderer.layout.LayoutContext context, Element elem, int cssWidth, int cssHeight)
    Handles replacement of image elements in the document.
    void
     
    void
    setFormSubmissionListener(org.xhtmlrenderer.simple.extend.FormSubmissionListener listener)
     
    protected void
    storeImageReplacedElement(Element e, org.xhtmlrenderer.extend.ReplacedElement cc)
    Adds a ReplacedElement containing an image to a cache of images for quick lookup.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SWTReplacedElementFactory

      public SWTReplacedElementFactory()
  • Method Details

    • clean

      public void clean()
      Dispose missing image if created.
    • createReplacedElement

      public org.xhtmlrenderer.extend.ReplacedElement createReplacedElement(org.xhtmlrenderer.layout.LayoutContext c, org.xhtmlrenderer.render.BlockBox box, org.xhtmlrenderer.extend.UserAgentCallback uac, int cssWidth, int cssHeight)
      Specified by:
      createReplacedElement in interface org.xhtmlrenderer.extend.ReplacedElementFactory
    • replaceImage

      protected org.xhtmlrenderer.extend.ReplacedElement replaceImage(org.xhtmlrenderer.extend.UserAgentCallback uac, org.xhtmlrenderer.layout.LayoutContext context, Element elem, int cssWidth, int cssHeight)
      Handles replacement of image elements in the document. May return the same ReplacedElement for a given image on multiple calls. Image will be automatically scaled to cssWidth and cssHeight assuming these are non-zero positive values. The element is assumed to have a src attribute (e.g. it's a <img> element)
      Parameters:
      uac - Used to retrieve images on demand from some source.
      elem - The element with the image reference
      cssWidth - Target width of the image
      cssHeight - Target height of the image
      Returns:
      A ReplacedElement for the image; will not be null.
    • storeImageReplacedElement

      protected void storeImageReplacedElement(Element e, org.xhtmlrenderer.extend.ReplacedElement cc)
      Adds a ReplacedElement containing an image to a cache of images for quick lookup.
      Parameters:
      e - The element under which the image is keyed.
      cc - The replaced element containing the image, or another ReplacedElement to be used in its place (like a placeholder if the image can't be loaded).
    • lookupImageReplacedElement

      protected org.xhtmlrenderer.extend.ReplacedElement lookupImageReplacedElement(Element e)
      Retrieves a ReplacedElement for an image from cache, or null if not found.
      Parameters:
      e - The element by which the image is keyed
      Returns:
      The ReplacedElement for the image, or null if there is none.
    • remove

      public void remove(Element e)
      Specified by:
      remove in interface org.xhtmlrenderer.extend.ReplacedElementFactory
    • setFormSubmissionListener

      public void setFormSubmissionListener(org.xhtmlrenderer.simple.extend.FormSubmissionListener listener)
      Specified by:
      setFormSubmissionListener in interface org.xhtmlrenderer.extend.ReplacedElementFactory
    • reset

      public void reset()
      Specified by:
      reset in interface org.xhtmlrenderer.extend.ReplacedElementFactory