com.itextpdf.tool.xml.svg
Class AbstractGraphicProcessor

java.lang.Object
  extended by com.itextpdf.tool.xml.svg.AbstractGraphicProcessor
All Implemented Interfaces:
TagProcessor
Direct Known Subclasses:
CircleTag, DefsTag, EllipseTag, GroupTag, LineTag, PathTag, PolyTag, RectangleTag, SymbolTag, TextSpanTag, TextTag, UseTag

public class AbstractGraphicProcessor
extends Object
implements TagProcessor


Constructor Summary
AbstractGraphicProcessor()
           
 
Method Summary
 void addElementsToMemoryWithId(WorkerContext ctx, Tag tag, List<Element> currentContent)
           
 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.
 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 AbstractTagProcessor.end(WorkerContext, Tag, List).
 CSSResolver getCSSResolver(WorkerContext context)
          Utility method that fetches the CSSResolver from the if any and if it uses the default key.
 SvgPipelineContext getSvgPipelineContext(WorkerContext context)
          Utility method that fetches the HtmlPipelineContext used if any and if it uses the default key.
 boolean isElementWithId()
           
 boolean isStackOwner()
          Defaults to false.
 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 AbstractTagProcessor.start(WorkerContext, Tag).
Checks for CSS.Property.PAGE_BREAK_BEFORE, if the value is always a Chunk.NEXTPAGE added before the implementors AbstractTagProcessor.start(WorkerContext, Tag) method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractGraphicProcessor

public AbstractGraphicProcessor()
Method Detail

getCSSResolver

public CSSResolver getCSSResolver(WorkerContext context)
                           throws NoCustomContextException
Utility method that fetches the CSSResolver from the if any and if it uses the default key.

Parameters:
context - the WorkerContext
Returns:
CSSResolver
Throws:
NoCustomContextException - if the context of the CssResolverPipeline could not be found.

getSvgPipelineContext

public SvgPipelineContext getSvgPipelineContext(WorkerContext context)
                                         throws NoCustomContextException
Utility method that fetches the HtmlPipelineContext used if any and if it uses the default key.

Parameters:
context - the WorkerContext
Returns:
a HtmlPipelineContext
Throws:
NoCustomContextException - if the context of the HtmlPipelineContext could not be found.

startElement

public final List<Element> startElement(WorkerContext ctx,
                                        Tag tag)
Calculates any found font size to pt values and set it in the CSS before calling AbstractTagProcessor.start(WorkerContext, Tag).
Checks for CSS.Property.PAGE_BREAK_BEFORE, if the value is always a Chunk.NEXTPAGE added before the implementors AbstractTagProcessor.start(WorkerContext, Tag) method.

Specified by:
startElement in interface TagProcessor
Parameters:
ctx - the WorkerContext
tag - the tag encountered
Returns:
Element an Element to add to the current content;

start

public 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). The AbstractTagProcessor.startElement(WorkerContext, Tag) calls this method after or before doing certain stuff, (see it's description).

Parameters:
ctx - the WorkerContext
tag - the tag
Returns:
an element to be added to current content, may be null

content

public List<Element> content(WorkerContext ctx,
                             Tag tag,
                             String content)
Description copied from interface: TagProcessor
This method is called if there is text content encountered between the opening and closing tags this TagProcessor is mapped to.

Specified by:
content in interface TagProcessor
Parameters:
ctx - the WorkerContext
tag - the tag encountered
content - the text content between the tags this TagProcessor is mapped to.
Returns:
the element to add to the currentContent list

addElementsToMemoryWithId

public void addElementsToMemoryWithId(WorkerContext ctx,
                                      Tag tag,
                                      List<Element> currentContent)

endElement

public final 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 AbstractTagProcessor.end(WorkerContext, Tag, List).

Specified by:
endElement in interface TagProcessor
Parameters:
ctx - the WorkerContext
tag - the tag encountered
currentContent - a list of content possibly created by TagProcessing of inner tags, and by startElement and content methods of this TagProcessor .
Returns:
the resulting element to add to the document or a content stack.

end

public 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). The AbstractTagProcessor.endElement(WorkerContext, Tag, List) calls this method after or before doing certain stuff, (see it's description).

Parameters:
ctx - the WorkerContext
tag - the tag
currentContent - the content created from e.g. inner tags, inner content and not yet added to document.
Returns:
a List containing iText Element objects

isStackOwner

public boolean isStackOwner()
Defaults to false.

Specified by:
isStackOwner in interface TagProcessor
Returns:
true if the tag implementation must keep it's own currentContent stack.
See Also:
TagProcessor.isStackOwner()

isElementWithId

public boolean isElementWithId()


Copyright © 2012. All Rights Reserved.