|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xhtmlrenderer.swing.SwingReplacedElementFactory
public class SwingReplacedElementFactory
A ReplacedElementFactory where Elements are replaced by Swing components.
| Field Summary | |
|---|---|
protected LinkedHashMap |
forms
Cache of XhtmlForms keyed by Element. |
protected Map |
imageComponents
Cache of image components (ReplacedElements) for quick lookup, keyed by Element. |
protected RepaintListener |
repaintListener
|
| Constructor Summary | |
|---|---|
SwingReplacedElementFactory()
|
|
SwingReplacedElementFactory(RepaintListener repaintListener)
|
|
SwingReplacedElementFactory(RepaintListener listener,
ImageResourceLoader irl)
|
|
| Method Summary | |
|---|---|
protected void |
addForm(Element e,
XhtmlForm f)
Adds a form to a local cache for quick lookup. |
ReplacedElement |
createReplacedElement(LayoutContext context,
BlockBox box,
UserAgentCallback uac,
int cssWidth,
int cssHeight)
NOTE: Only block equivalent elements can be replaced. |
protected XhtmlForm |
getForm(Element e)
Returns the XhtmlForm associated with an Element in cache, or null if not found. |
protected Element |
getParentForm(Element e,
LayoutContext context)
|
protected ReplacedElement |
lookupImageReplacedElement(Element e,
String uri)
Retrieves a ReplacedElement for an image from cache, or null if not found. |
protected ReplacedElement |
newIrreplaceableImageElement(int cssWidth,
int cssHeight)
Returns a ReplacedElement for some element in the stream which should be replaceable, but is not. |
void |
remove(Element e)
Removes any reference to Element e. |
protected ReplacedElement |
replaceImage(UserAgentCallback uac,
LayoutContext context,
Element elem,
int cssWidth,
int cssHeight)
Handles replacement of image elements in the document. |
void |
reset()
Clears out any references to elements or items created by this factory so far. |
void |
setFormSubmissionListener(FormSubmissionListener fsl)
Identifies the FSL which will be used for callbacks when a form submit action is executed; you can use a DefaultFormSubmissionListener if you don't want any action to be taken. |
protected void |
storeImageReplacedElement(Element e,
ReplacedElement cc,
String uri,
int cssWidth,
int cssHeight)
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 |
| Field Detail |
|---|
protected Map imageComponents
protected LinkedHashMap forms
protected final RepaintListener repaintListener
| Constructor Detail |
|---|
public SwingReplacedElementFactory()
public SwingReplacedElementFactory(RepaintListener repaintListener)
public SwingReplacedElementFactory(RepaintListener listener,
ImageResourceLoader irl)
| Method Detail |
|---|
public ReplacedElement createReplacedElement(LayoutContext context,
BlockBox box,
UserAgentCallback uac,
int cssWidth,
int cssHeight)
createReplacedElement in interface ReplacedElementFactorycssWidth - The CSS width of the element in dots (or -1 if
width is auto)cssHeight - The CSS height of the element in dots (or -1
if the height should be treated as auto)
ReplacedElement or null if no
ReplacedElement applies
protected ReplacedElement replaceImage(UserAgentCallback uac,
LayoutContext context,
Element elem,
int cssWidth,
int cssHeight)
uac - Used to retrieve images on demand from some source.context - elem - The element with the image referencecssWidth - Target width of the imagecssHeight - Target height of the image @return A ReplacedElement for the image; will not be null.
protected ReplacedElement newIrreplaceableImageElement(int cssWidth,
int cssHeight)
cssWidth - Target width for the element.cssHeight - Target height for the element
protected void storeImageReplacedElement(Element e,
ReplacedElement cc,
String uri,
int cssWidth,
int cssHeight)
e - The element under which the image is keyed.cc - The replaced element containing the image, or another ReplacedElement to be used in its placeuri - cssWidth - cssHeight -
protected ReplacedElement lookupImageReplacedElement(Element e,
String uri)
e - The element by which the image is keyeduri -
protected void addForm(Element e,
XhtmlForm f)
e - The element under which the form is keyed (e.g. "protected XhtmlForm getForm(Element e)
e - The Element to which the form is keyed
protected Element getParentForm(Element e,
LayoutContext context)
e - public void reset()
reset in interface ReplacedElementFactorypublic void remove(Element e)
ReplacedElementFactoryElement e.
remove in interface ReplacedElementFactorypublic void setFormSubmissionListener(FormSubmissionListener fsl)
ReplacedElementFactoryDefaultFormSubmissionListener if you don't want any action to be taken.
setFormSubmissionListener in interface ReplacedElementFactoryfsl - the listener instance to receive callbacks on form submission.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||