Package org.xhtmlrenderer.swt
Class SWTReplacedElementFactory
- java.lang.Object
-
- org.xhtmlrenderer.swt.SWTReplacedElementFactory
-
- All Implemented Interfaces:
ReplacedElementFactory
- Direct Known Subclasses:
SWTXhtmlReplacedElementFactory
public class SWTReplacedElementFactory extends Object implements ReplacedElementFactory
- Author:
- Vianney le Clément
-
-
Constructor Summary
Constructors Constructor Description SWTReplacedElementFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclean()Dispose missing image if created.ReplacedElementcreateReplacedElement(LayoutContext c, BlockBox box, UserAgentCallback uac, int cssWidth, int cssHeight)protected ReplacedElementlookupImageReplacedElement(Element e)Retrieves a ReplacedElement for an image from cache, or null if not found.voidremove(Element e)protected ReplacedElementreplaceImage(UserAgentCallback uac, LayoutContext context, Element elem, int cssWidth, int cssHeight)Handles replacement of image elements in the document.voidreset()voidsetFormSubmissionListener(FormSubmissionListener listener)protected voidstoreImageReplacedElement(Element e, ReplacedElement cc)Adds a ReplacedElement containing an image to a cache of images for quick lookup.
-
-
-
Method Detail
-
clean
public void clean()
Dispose missing image if created.
-
createReplacedElement
public ReplacedElement createReplacedElement(LayoutContext c, BlockBox box, UserAgentCallback uac, int cssWidth, int cssHeight)
- Specified by:
createReplacedElementin interfaceReplacedElementFactory
-
replaceImage
protected ReplacedElement replaceImage(UserAgentCallback uac, 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 referencecssWidth- Target width of the imagecssHeight- Target height of the image- Returns:
- A ReplacedElement for the image; will not be null.
-
storeImageReplacedElement
protected void storeImageReplacedElement(Element e, 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 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:
removein interfaceReplacedElementFactory
-
setFormSubmissionListener
public void setFormSubmissionListener(FormSubmissionListener listener)
- Specified by:
setFormSubmissionListenerin interfaceReplacedElementFactory
-
reset
public void reset()
- Specified by:
resetin interfaceReplacedElementFactory
-
-