fr.opensagres.xdocreport.document.preprocessor.sax
Class TransformedBufferedDocumentContentHandler<Document extends TransformedBufferedDocument>

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler<Document>
          extended by fr.opensagres.xdocreport.document.preprocessor.sax.TransformedBufferedDocumentContentHandler<Document>
All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler
Direct Known Subclasses:
DocXBufferedDocumentContentHandler, ODTBufferedDocumentContentHandler, PPTXSlideContentHandler

public abstract class TransformedBufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
extends BufferedDocumentContentHandler<Document>

Document transformed to manage lazy loop for row table and dynamic image.


Field Summary
 
Fields inherited from class fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler
bufferedDocument, CDATA_TYPE
 
Constructor Summary
protected TransformedBufferedDocumentContentHandler(String entryName, FieldsMetadata fieldsMetadata, IDocumentFormatter formater, Map<String,Object> sharedContext)
           
 
Method Summary
protected abstract  Document createDocument()
           
 void doEndElement(String uri, String localName, String name)
           
 boolean doStartElement(String uri, String localName, String name, Attributes attributes)
           
 int extractListDirectiveInfo(String characters)
           
 int extractListDirectiveInfo(String characters, boolean dontRemoveListDirectiveInfo)
           
protected  void flushCharacters(String characters)
           
 String formatDirective(String directive)
           
static String generateKey(long variableIndex)
           
protected  String getAfterRowToken()
          Returns the after row token.
protected  String getAfterTableCellToken()
          Returns the after row token.
protected  String getBeforeRowToken()
          Returns the before row token.
protected  String getBeforeTableCellToken()
          Returns the before row token.
 DirectivesStack getDirectives()
           
 String getEndNoParse()
           
 String getEntryName()
           
 FieldMetadata getFieldAsTextStyling(String content)
           
 FieldsMetadata getFieldsMetadata()
           
 IDocumentFormatter getFormatter()
           
 ProcessRowResult getProcessRowResult(String content, boolean forceAsField)
          If a row parsing, replace fields name with well script to manage lazy loop for table row.
 Map<String,Object> getSharedContext()
           
 String getStartNoParse()
           
protected abstract  String getTableCellName()
           
protected abstract  String getTableRowName()
           
 long getVariableIndex()
           
 boolean hasSharedContext()
           
protected  boolean isTable(String uri, String localName, String name)
          Returns true if current element is a table and false otherwise.
protected  boolean isTableRow(String uri, String localName, String name)
          Returns true if current element is a table row and false otherwise.
 String processRowIfNeeded(String content)
           
 String processRowIfNeeded(String content, boolean forceAsField)
          If a row parsing, replace fields name with well script to manage lazy loop for table row.
 boolean processScriptAfter(String fieldName)
           
 boolean processScriptBefore(String fieldName)
           
 String registerBufferedElement(long variableIndex, BufferedElement element)
           
 
Methods inherited from class fr.opensagres.xdocreport.document.preprocessor.sax.BufferedDocumentContentHandler
characters, endElement, findParentElementInfo, findParentElementInfo, getBufferedDocument, getCurrentElement, getElementIndex, mustEncodeCharachers, printEscaped, resetCharacters, startDocument, startElement, startPrefixMapping, toAttributesImpl
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransformedBufferedDocumentContentHandler

protected TransformedBufferedDocumentContentHandler(String entryName,
                                                    FieldsMetadata fieldsMetadata,
                                                    IDocumentFormatter formater,
                                                    Map<String,Object> sharedContext)
Method Detail

doStartElement

public boolean doStartElement(String uri,
                              String localName,
                              String name,
                              Attributes attributes)
                       throws SAXException
Overrides:
doStartElement in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
Throws:
SAXException

flushCharacters

protected void flushCharacters(String characters)
Overrides:
flushCharacters in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>

processRowIfNeeded

public String processRowIfNeeded(String content)

processRowIfNeeded

public String processRowIfNeeded(String content,
                                 boolean forceAsField)
If a row parsing, replace fields name with well script to manage lazy loop for table row.

Parameters:
content -
Returns:

getProcessRowResult

public ProcessRowResult getProcessRowResult(String content,
                                            boolean forceAsField)
If a row parsing, replace fields name with well script to manage lazy loop for table row.

Parameters:
content -
Returns:

getSharedContext

public Map<String,Object> getSharedContext()

hasSharedContext

public boolean hasSharedContext()

getFieldsMetadata

public FieldsMetadata getFieldsMetadata()

getFormatter

public IDocumentFormatter getFormatter()

getDirectives

public DirectivesStack getDirectives()

getBeforeRowToken

protected String getBeforeRowToken()
Returns the before row token.

Returns:

getAfterRowToken

protected String getAfterRowToken()
Returns the after row token.

Returns:

getBeforeTableCellToken

protected String getBeforeTableCellToken()
Returns the before row token.

Returns:

getAfterTableCellToken

protected String getAfterTableCellToken()
Returns the after row token.

Returns:

extractListDirectiveInfo

public int extractListDirectiveInfo(String characters,
                                    boolean dontRemoveListDirectiveInfo)

extractListDirectiveInfo

public int extractListDirectiveInfo(String characters)

isTable

protected boolean isTable(String uri,
                          String localName,
                          String name)
Returns true if current element is a table and false otherwise.

Parameters:
uri -
localName -
name -
Returns:

getTableRowName

protected abstract String getTableRowName()

getTableCellName

protected abstract String getTableCellName()

isTableRow

protected boolean isTableRow(String uri,
                             String localName,
                             String name)
Returns true if current element is a table row and false otherwise.

Parameters:
uri -
localName -
name -
Returns:

processScriptBefore

public boolean processScriptBefore(String fieldName)

processScriptAfter

public boolean processScriptAfter(String fieldName)

doEndElement

public void doEndElement(String uri,
                         String localName,
                         String name)
                  throws SAXException
Overrides:
doEndElement in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>
Throws:
SAXException

getFieldAsTextStyling

public FieldMetadata getFieldAsTextStyling(String content)

registerBufferedElement

public String registerBufferedElement(long variableIndex,
                                      BufferedElement element)

generateKey

public static String generateKey(long variableIndex)

getVariableIndex

public long getVariableIndex()

getEntryName

public String getEntryName()

formatDirective

public String formatDirective(String directive)

getStartNoParse

public String getStartNoParse()

getEndNoParse

public String getEndNoParse()

createDocument

protected abstract Document createDocument()
Overrides:
createDocument in class BufferedDocumentContentHandler<Document extends TransformedBufferedDocument>


Copyright © 2013. All rights reserved.