Class TableStructElementIterator
- java.lang.Object
-
- com.itextpdf.pdfua.checkers.utils.tables.TableStructElementIterator
-
- All Implemented Interfaces:
ITableIterator<PdfStructElem>
public class TableStructElementIterator extends java.lang.Object implements ITableIterator<PdfStructElem>
Creates an iterator to iterate over the table structures.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<PdfStructElem>
all
private int
amountOfCols
private int
amountOfRowsBody
private int
amountOfRowsFooter
private int
amountOfRowsHeader
(package private) PdfUAValidationContext
context
private PdfStructElem
currentValue
private int
iterIndex
private java.util.HashMap<PdfStructElem,Tuple2<java.lang.Integer,java.lang.Integer>>
locationCache
-
Constructor Summary
Constructors Constructor Description TableStructElementIterator(PdfStructElem tableStructElem, PdfUAValidationContext context)
Creates a newTableStructElementIterator
instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
build2DRepresentationOfTagTreeStructures(java.util.List<PdfStructElem> rows)
private java.util.List<PdfStructElem>
extractAllTrTags(java.util.List<IStructureNode> possibleTrs)
private java.util.List<PdfStructElem>
extractCells(PdfStructElem row)
private java.util.List<PdfStructElem>
extractTableRows(PdfStructElem table)
private void
flattenElements(PdfStructElem table)
int
getAmountOfRowsBody()
Gets the number of rows in the body of the table.int
getAmountOfRowsFooter()
Gets the number of rows in the footer of the table.int
getAmountOfRowsHeader()
Gets the number of rows in the header of the table.int
getCol()
Gets the column index of current position.int
getColspan()
Gets the colspan of the current positionprivate static int
getColspan(PdfStructElem structElem)
private static int
getIntValueFromAttributes(PdfStructElem elem, PdfName name)
int
getNumberOfColumns()
Returns the amount of columns the table has.private PdfName
getRole(IStructureNode node)
int
getRow()
Gets the row index of the current position.int
getRowspan()
Gets the rowspan of current position.private static int
getRowspan(PdfStructElem structElem)
boolean
hasNext()
Checks if there is a next element in the iteration.PdfStructElem
next()
Gets the next element in the iteration.private void
setAmountOfCols(java.util.List<PdfStructElem> rows)
-
-
-
Field Detail
-
context
final PdfUAValidationContext context
-
all
private final java.util.List<PdfStructElem> all
-
locationCache
private final java.util.HashMap<PdfStructElem,Tuple2<java.lang.Integer,java.lang.Integer>> locationCache
-
amountOfCols
private int amountOfCols
-
amountOfRowsHeader
private int amountOfRowsHeader
-
amountOfRowsBody
private int amountOfRowsBody
-
amountOfRowsFooter
private int amountOfRowsFooter
-
iterIndex
private int iterIndex
-
currentValue
private PdfStructElem currentValue
-
-
Constructor Detail
-
TableStructElementIterator
public TableStructElementIterator(PdfStructElem tableStructElem, PdfUAValidationContext context)
Creates a newTableStructElementIterator
instance.- Parameters:
tableStructElem
- the root table struct element.context
- the validation context.
-
-
Method Detail
-
hasNext
public boolean hasNext()
Checks if there is a next element in the iteration.- Specified by:
hasNext
in interfaceITableIterator<PdfStructElem>
- Returns:
true
if there is a next element,false
otherwise.
-
next
public PdfStructElem next()
Gets the next element in the iteration.- Specified by:
next
in interfaceITableIterator<PdfStructElem>
- Returns:
- The next element.
-
getAmountOfRowsBody
public int getAmountOfRowsBody()
Gets the number of rows in the body of the table.- Specified by:
getAmountOfRowsBody
in interfaceITableIterator<PdfStructElem>
- Returns:
- The number of rows in the body of the table.
-
getAmountOfRowsHeader
public int getAmountOfRowsHeader()
Gets the number of rows in the header of the table.- Specified by:
getAmountOfRowsHeader
in interfaceITableIterator<PdfStructElem>
- Returns:
- The number of rows in the header of the table.
-
getAmountOfRowsFooter
public int getAmountOfRowsFooter()
Gets the number of rows in the footer of the table.- Specified by:
getAmountOfRowsFooter
in interfaceITableIterator<PdfStructElem>
- Returns:
- The number of rows in the footer of the table.
-
getNumberOfColumns
public int getNumberOfColumns()
Returns the amount of columns the table has. All rows in a table in UA specification must have the same column count. So return the max column count for correctly generated error messages.- Specified by:
getNumberOfColumns
in interfaceITableIterator<PdfStructElem>
- Returns:
- the amount of columns
-
getRow
public int getRow()
Gets the row index of the current position.- Specified by:
getRow
in interfaceITableIterator<PdfStructElem>
- Returns:
- The row index.
-
getCol
public int getCol()
Gets the column index of current position.- Specified by:
getCol
in interfaceITableIterator<PdfStructElem>
- Returns:
- The column index.
-
getRowspan
public int getRowspan()
Gets the rowspan of current position.- Specified by:
getRowspan
in interfaceITableIterator<PdfStructElem>
- Returns:
- the rowspan
-
getColspan
public int getColspan()
Gets the colspan of the current position- Specified by:
getColspan
in interfaceITableIterator<PdfStructElem>
- Returns:
- the colspan of current position
-
flattenElements
private void flattenElements(PdfStructElem table)
-
getRole
private PdfName getRole(IStructureNode node)
-
extractTableRows
private java.util.List<PdfStructElem> extractTableRows(PdfStructElem table)
-
build2DRepresentationOfTagTreeStructures
private void build2DRepresentationOfTagTreeStructures(java.util.List<PdfStructElem> rows)
-
setAmountOfCols
private void setAmountOfCols(java.util.List<PdfStructElem> rows)
-
extractCells
private java.util.List<PdfStructElem> extractCells(PdfStructElem row)
-
getColspan
private static int getColspan(PdfStructElem structElem)
-
getRowspan
private static int getRowspan(PdfStructElem structElem)
-
getIntValueFromAttributes
private static int getIntValueFromAttributes(PdfStructElem elem, PdfName name)
-
extractAllTrTags
private java.util.List<PdfStructElem> extractAllTrTags(java.util.List<IStructureNode> possibleTrs)
-
-