|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.itextpdf.tool.xml.html.AbstractTagProcessor
public abstract class AbstractTagProcessor
Abstract TagProcessor that allows setting the configuration object to a
protected member variable.
Implements TagProcessor.startElement(WorkerContext, Tag)
and
TagProcessor.endElement(WorkerContext, Tag, List)
to calculate font sizes and add
new pages if needed.
Extend from this class instead of implementing TagProcessor
to
benefit from auto fontsize metric conversion to pt and
page-break-before/after insertion. Override
start(WorkerContext, Tag)
and
end(WorkerContext, Tag, List)
in your extension.
Constructor Summary | |
---|---|
AbstractTagProcessor()
|
Method Summary | |
---|---|
List<Element> |
content(WorkerContext ctx,
Tag tag,
String content)
This method is called if there is text content encountered between the opening and closing tags this TagProcessor is mapped to. |
protected Paragraph |
createParagraph()
|
List<Element> |
currentContentToParagraph(List<Element> currentContent,
boolean addNewLines)
Default apply CSS to false and tag to null. |
List<Element> |
currentContentToParagraph(List<Element> currentContent,
boolean addNewLines,
boolean applyCSS,
Tag tag,
WorkerContext ctx)
Adds currentContent list to a paragraph element. |
protected void |
doRtlIndentCorrections(Indentable p)
|
List<Element> |
end(WorkerContext ctx,
Tag tag,
List<Element> currentContent)
Classes extending AbstractTagProcessor should override this method for actions that should be done in TagProcessor.endElement(WorkerContext, Tag, List) . |
List<Element> |
endElement(WorkerContext ctx,
Tag tag,
List<Element> currentContent)
Checks for CSS.Property.PAGE_BREAK_AFTER , if the
value is always a Chunk.NEXTPAGE is added to the
currentContentList after calling
end(WorkerContext, Tag, List) . |
CssAppliers |
getCssAppliers()
|
CSSResolver |
getCSSResolver(WorkerContext context)
Utility method that fetches the CSSResolver from the if any and if it uses the default key. |
HtmlPipelineContext |
getHtmlPipelineContext(WorkerContext context)
Utility method that fetches the HtmlPipelineContext used if any and if it uses the default key. |
protected int |
getRunDirection(Tag tag)
|
boolean |
isStackOwner()
Defaults to false. |
void |
setCssAppliers(CssAppliers cssAppliers)
|
List<Element> |
start(WorkerContext ctx,
Tag tag)
Classes extending AbstractTagProcessor should override this method for actions that should be done in TagProcessor.startElement(WorkerContext, Tag) . |
List<Element> |
startElement(WorkerContext ctx,
Tag tag)
Calculates any found font size to pt values and set it in the CSS before calling start(WorkerContext, Tag) . |
protected List<Element> |
textContent(WorkerContext ctx,
Tag tag,
String content)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTagProcessor()
Method Detail |
---|
public CSSResolver getCSSResolver(WorkerContext context) throws NoCustomContextException
context
- the WorkerContext
NoCustomContextException
- if the context of the
CssResolverPipeline
could not be found.public HtmlPipelineContext getHtmlPipelineContext(WorkerContext context) throws NoCustomContextException
context
- the WorkerContext
NoCustomContextException
- if the context of the
HtmlPipelineContext
could not be found.public final List<Element> startElement(WorkerContext ctx, Tag tag)
start(WorkerContext, Tag)
.CSS.Property.PAGE_BREAK_BEFORE
, if the
value is always a Chunk.NEXTPAGE
added before the
implementors start(WorkerContext, Tag)
method.
startElement
in interface TagProcessor
ctx
- the WorkerContexttag
- the tag encountered
public List<Element> start(WorkerContext ctx, Tag tag)
TagProcessor.startElement(WorkerContext, Tag)
. The startElement(WorkerContext, Tag)
calls this method
after or before doing certain stuff, (see it's description).
ctx
- the WorkerContexttag
- the tag
public List<Element> content(WorkerContext ctx, Tag tag, String content)
TagProcessor
content
in interface TagProcessor
ctx
- the WorkerContexttag
- the tag encounteredcontent
- the text content between the tags this TagProcessor is
mapped to.
protected int getRunDirection(Tag tag)
protected List<Element> textContent(WorkerContext ctx, Tag tag, String content)
public final List<Element> endElement(WorkerContext ctx, Tag tag, List<Element> currentContent)
CSS.Property.PAGE_BREAK_AFTER
, if the
value is always a Chunk.NEXTPAGE
is added to the
currentContentList after calling
end(WorkerContext, Tag, List)
.
endElement
in interface TagProcessor
ctx
- the WorkerContexttag
- the tag encounteredcurrentContent
- a list of content possibly created by TagProcessing
of inner tags, and by startElement
and
content
methods of this TagProcessor
.
public List<Element> end(WorkerContext ctx, Tag tag, List<Element> currentContent)
TagProcessor.endElement(WorkerContext, Tag, List)
.
The endElement(WorkerContext, Tag, List)
calls this method
after or before doing certain stuff, (see it's description).
ctx
- the WorkerContexttag
- the tagcurrentContent
- the content created from e.g. inner tags, inner content and not yet added to document.
public boolean isStackOwner()
isStackOwner
in interface TagProcessor
TagProcessor.isStackOwner()
public List<Element> currentContentToParagraph(List<Element> currentContent, boolean addNewLines, boolean applyCSS, Tag tag, WorkerContext ctx)
currentContent
- ListaddNewLines
- boolean to declare which paragraph element should be
returned, true if new line should be added or not.applyCSS
- true if CSS should be applied on the paragraph.tag
- the relevant tag.ctx
- the WorkerContext.
public final List<Element> currentContentToParagraph(List<Element> currentContent, boolean addNewLines)
currentContent
- ListaddNewLines
- boolean to declare which paragraph element should be
returned, true if new line should be added or not.
currentContentToParagraph(List, boolean, boolean, Tag, WorkerContext)
public void setCssAppliers(CssAppliers cssAppliers)
setCssAppliers
in interface CssAppliersAware
cssAppliers
- the CssApplierspublic CssAppliers getCssAppliers()
getCssAppliers
in interface CssAppliersAware
protected Paragraph createParagraph()
protected void doRtlIndentCorrections(Indentable p)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |