Class DeferredImageReplacedElement

java.lang.Object
org.xhtmlrenderer.swing.ImageReplacedElement
org.xhtmlrenderer.swing.DeferredImageReplacedElement
All Implemented Interfaces:
ReplacedElement

public class DeferredImageReplacedElement extends ImageReplacedElement
An DeferredImageReplacedElement is a ReplacedElement that contains a Image which by default is simply a transparent image scaled to the size provided to the constructor. The DeferredImageReplacedElement also has a reference to an ImageResource which points to the image which will be returned for this replaced element. That Image may be loaded some time after this DeferredImageReplacedElement is created. Calling getImage() on instances of DeferredImageReplacedElement will return either the original dummy image, or the actual image loaded into the ImageResource.
  • Field Details

    • _location

      private Point _location
    • repaintListener

      private final RepaintListener repaintListener
    • _targetHeight

      private final int _targetHeight
    • _targetWidth

      private final int _targetWidth
    • _doScaleImage

      private final boolean _doScaleImage
    • _loaded

      private boolean _loaded
    • _imageResource

      private final ImageResource _imageResource
  • Constructor Details

    • DeferredImageReplacedElement

      public DeferredImageReplacedElement(ImageResource imageResource, RepaintListener repaintListener, int w, int h)
      Creates a new ImageReplacedElement and scales it to the size specified if either width or height has a valid value (values are greater than -1), otherwise original size is preserved. The idea is that the image was loaded at a certain size (that's the Image instance here) and that at the time we create the ImageReplacedElement we have a target W/H we want to use.
  • Method Details