@API(type=INTERNAL, src=PUBLIC) public class CALSTableCellInfoProvider extends AuthorTableColumnWidthProviderBase implements AuthorTableCellSpanProvider, CALSConstants, AuthorTableCellSepProvider
Modifier and Type | Field and Description |
---|---|
static WidthRepresentation |
DEFAULT_WIDTH_REPRESENTATION
The default width representation.
|
protected java.util.List<CALSColSpanSpec> |
spanspecInfos
The list with the
CALSColSpanSpec containing
information about the columns span specification for this table. |
ATTRIBUTE_NAME_ALIGN, ATTRIBUTE_NAME_COLNAME, ATTRIBUTE_NAME_COLNUM, ATTRIBUTE_NAME_COLS, ATTRIBUTE_NAME_COLSEP, ATTRIBUTE_NAME_COLWIDTH, ATTRIBUTE_NAME_ID, ATTRIBUTE_NAME_MOREROWS, ATTRIBUTE_NAME_NAMEEND, ATTRIBUTE_NAME_NAMEST, ATTRIBUTE_NAME_ROWSEP, ATTRIBUTE_NAME_SPANNAME, ATTRIBUTE_NAME_TABLE_WIDTH, ATTRIBUTE_NAME_XML_ID, ELEMENT_NAME_COLSPEC, ELEMENT_NAME_ENTRY, ELEMENT_NAME_INFORMALTABLE, ELEMENT_NAME_ROW, ELEMENT_NAME_SPANSPEC, ELEMENT_NAME_TABLE, ELEMENT_NAME_TGROUP
Constructor and Description |
---|
CALSTableCellInfoProvider()
Constructor.
|
CALSTableCellInfoProvider(boolean colsepAndRowSepAreVisibleByDefault)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
commitColumnWidthModifications(AuthorDocumentController authorDocumentController,
WidthRepresentation[] colWidths,
java.lang.String tableCellsTagName)
Updates the columns width specifications in the source document by
setting the
colwidth attribute value of the
colspec elements and by adding new colspec
elements if needed. |
void |
commitTableWidthModification(AuthorDocumentController authorDocumentController,
int newTableWidth,
java.lang.String tableCellsTagName)
Sets the
width attribute value of the table element. |
java.util.List<WidthRepresentation> |
getAllColspecWidthRepresentations()
Get all with representations defined in all colspecs.
|
CALSColSpanSpec |
getCellSpanSpec(AuthorAccess authorAccess,
AuthorElement cellElement)
Find the column span specification for a table cell.
|
java.util.List<WidthRepresentation> |
getCellWidth(AuthorElement cellElement,
int colNumberStart,
int colSpan)
The list with the width representations for the given cell is obtained by
computing the column span and then determining the
WidthRepresentation
for each column the cell spans across. |
boolean |
getColSep(AuthorElement cellElem,
int columnIndex)
Checks if a separator should be placed at the cell right.
|
java.lang.Integer |
getColSpan(AuthorElement cellElem)
Compute the number of columns the cell spans across by looking
at the 'spanspec' attribute.
|
CALSColSpec |
getColSpec(int columnNumber)
Find the column specification for the given column number.
|
AuthorElement |
getColSpecElement(CALSColSpec colspec)
Find a column specification element.
|
java.util.Set<CALSColSpec> |
getColSpecs()
Returns the column specification set corresponding to the CALS table.
|
java.lang.String |
getDescription() |
boolean |
getRowSep(AuthorElement cellElem,
int columnIndex)
Checks if a separator should be placed at the cell bottom.
|
java.lang.Integer |
getRowSpan(AuthorElement cellElement)
Compute the number of rows the cells span across by looking at the
morerows attribute. |
WidthRepresentation |
getTableWidth(java.lang.String tableCellsTagName)
Returns the
WidthRepresentation obtained by analyzing the
width attribute value of the table element. |
boolean |
hasColumnSpecifications(AuthorElement tableElement)
This method tells if the table contains column specifications.
|
void |
init(AuthorElement tableElement)
This method is called when starting to compute the layout for a table.
|
boolean |
isAcceptingFixedColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as fixed values.
|
boolean |
isAcceptingPercentageColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as percentage values.
|
boolean |
isAcceptingProportionalColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as proportional values.
|
boolean |
isTableAcceptingWidth(java.lang.String tableCellsTagName)
The DocBook CALS tables do not accept width specification.
|
boolean |
isTableAndColumnsResizable(java.lang.String tableCellsTagName)
It returns
true only if the given table cells tag name is
equal to 'entry' . |
protected boolean |
isTableCell(java.lang.String tableCellsTagName)
Check if the name of an element is a table cell.
|
protected boolean |
isTableElement(AuthorElement element)
Check if this element is a table element.
|
public static WidthRepresentation DEFAULT_WIDTH_REPRESENTATION
protected java.util.List<CALSColSpanSpec> spanspecInfos
CALSColSpanSpec
containing
information about the columns span specification for this table.public CALSTableCellInfoProvider(boolean colsepAndRowSepAreVisibleByDefault)
colsepAndRowSepAreVisibleByDefault
- The default visibility for the rowsep and
colsep. (i.e. if no colsep
or rowsep
attributes are present
in the table).public CALSTableCellInfoProvider()
colsep
or rowsep
attributes are present
in the table) is hidden.public java.lang.Integer getColSpan(AuthorElement cellElem)
getColSpan
in interface AuthorTableCellSpanProvider
cellElem
- The node that represents a table cell in CSS.null
if not specified.AuthorTableCellSpanProvider.getColSpan(AuthorElement)
public java.lang.Integer getRowSpan(AuthorElement cellElement)
morerows
attribute.getRowSpan
in interface AuthorTableCellSpanProvider
cellElement
- The AuthorElement
that represents a table cell in CSS.null
if not specified.AuthorTableCellSpanProvider.getRowSpan(AuthorElement)
public void init(AuthorElement tableElement)
AuthorTableCellSpanProvider
colspec
and spanspec
elements from that table.
A new instance of the table cell span provider is used for every table in a document so
cached data cannot be used between different tables..init
in interface AuthorTableCellSepProvider
init
in interface AuthorTableCellSpanProvider
init
in interface AuthorTableColumnWidthProvider
tableElement
- The AuthorElement
representing a table (it has the CSS display property
set on 'table').AuthorTableColumnWidthProvider.init(ro.sync.ecss.extensions.api.node.AuthorElement)
public java.lang.String getDescription()
getDescription
in interface Extension
Extension.getDescription()
public CALSColSpanSpec getCellSpanSpec(AuthorAccess authorAccess, AuthorElement cellElement)
authorAccess
- The author access.cellElement
- The table cell element.Null
when column specifications are
not defined.public CALSColSpec getColSpec(int columnNumber)
columnNumber
- The column number, one based.null
if no column specification is defined for
the given column number. 1 based.public AuthorElement getColSpecElement(CALSColSpec colspec)
colspec
- The column specification.null
if no column
corresponds to the given specification.public java.util.Set<CALSColSpec> getColSpecs()
public boolean hasColumnSpecifications(AuthorElement tableElement)
AuthorTableCellSpanProvider
colspec
elements to be present.hasColumnSpecifications
in interface AuthorTableCellSpanProvider
tableElement
- The AuthorElement
that is rendered as a table.true
if some column specification info is present or if the table doesn't
require any column specification info.AuthorTableCellSpanProvider.hasColumnSpecifications(ro.sync.ecss.extensions.api.node.AuthorElement)
public java.util.List<WidthRepresentation> getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan)
WidthRepresentation
for each column the cell spans across.getCellWidth
in interface AuthorTableColumnWidthProvider
cellElement
- The node that represents a table cell in CSS.colNumberStart
- The column number the cell starts at.colSpan
- The column span of the cell.WidthRepresentation
of the
specified cell element or null
if the cell width cannot be computed.
If the cell spans over multiple columns then the returned list will contain one WidthRepresentation
for each column the cell spans over.AuthorTableColumnWidthProvider.getCellWidth(ro.sync.ecss.extensions.api.node.AuthorElement, int, int)
public void commitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, java.lang.String tableCellsTagName) throws AuthorOperationException
colwidth
attribute value of the
colspec
elements and by adding new colspec
elements if needed.commitColumnWidthModifications
in interface AuthorTableColumnWidthProvider
authorDocumentController
- The AuthorDocumentController
used to commit the table modifications
in the document.colWidths
- The new column WidthRepresentation
to set. The column widths must be ordered
according to the corresponding column numbers.tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).AuthorOperationException
- If the operation fails.AuthorTableColumnWidthProvider.commitColumnWidthModifications(AuthorDocumentController, ro.sync.ecss.extensions.api.WidthRepresentation[], java.lang.String)
protected boolean isTableCell(java.lang.String tableCellsTagName)
tableCellsTagName
- The name of an element.true
if the name of an element is a table cell.public void commitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, java.lang.String tableCellsTagName) throws AuthorOperationException
width
attribute value of the table
element.commitTableWidthModification
in interface AuthorTableColumnWidthProvider
authorDocumentController
- The AuthorDocumentController
used to commit the table width modifications
in the document.newTableWidth
- The new table WidthRepresentation
to set. The value is given in pixels.tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).AuthorOperationException
- If the operation fails.AuthorTableColumnWidthProvider.commitTableWidthModification(AuthorDocumentController, int, java.lang.String)
public WidthRepresentation getTableWidth(java.lang.String tableCellsTagName)
WidthRepresentation
obtained by analyzing the
width
attribute value of the table
element.getTableWidth
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).null
value if the table width is specified. Otherwise null
.AuthorTableColumnWidthProvider.getTableWidth(java.lang.String)
public boolean isTableAcceptingWidth(java.lang.String tableCellsTagName)
isTableAcceptingWidth
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).true
if the table type denoted by the tableCellsTagName
accepts width specification
of any kind.AuthorTableColumnWidthProvider.isTableAcceptingWidth(java.lang.String)
public boolean isTableAndColumnsResizable(java.lang.String tableCellsTagName)
true
only if the given table cells tag name is
equal to 'entry'
.isTableAndColumnsResizable
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. CALS or HTML).true
if the size of the table or the table cells can be adjusted.AuthorTableColumnWidthProvider.isTableAndColumnsResizable(java.lang.String)
public boolean isAcceptingFixedColumnWidths(java.lang.String tableCellsTagName)
AuthorTableColumnWidthProvider
isAcceptingFixedColumnWidths
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type
(e.g. CALS or HTML).true
if the table column widths can be represented in
fixed values.AuthorTableColumnWidthProvider.isAcceptingFixedColumnWidths(java.lang.String)
public boolean isAcceptingPercentageColumnWidths(java.lang.String tableCellsTagName)
AuthorTableColumnWidthProvider
isAcceptingPercentageColumnWidths
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type
(e.g. CALS or HTML).true
if the table column widths can be represented in
percentage values.AuthorTableColumnWidthProvider.isAcceptingPercentageColumnWidths(java.lang.String)
public boolean isAcceptingProportionalColumnWidths(java.lang.String tableCellsTagName)
AuthorTableColumnWidthProvider
isAcceptingProportionalColumnWidths
in interface AuthorTableColumnWidthProvider
tableCellsTagName
- The cells tag name. Used to identify the table type
(e.g. CALS or HTML).true
if the table column widths can be represented in
proportional values.AuthorTableColumnWidthProvider.isAcceptingProportionalColumnWidths(java.lang.String)
public java.util.List<WidthRepresentation> getAllColspecWidthRepresentations()
AuthorTableColumnWidthProviderBase
getAllColspecWidthRepresentations
in class AuthorTableColumnWidthProviderBase
AuthorTableColumnWidthProviderBase.getAllColspecWidthRepresentations()
public boolean getColSep(AuthorElement cellElem, int columnIndex)
AuthorTableCellSepProvider
true
.getColSep
in interface AuthorTableCellSepProvider
cellElem
- The node that represents a table cell in CSS.columnIndex
- The index of the column, used to identify the colspec associated
to the cell. The colspec can give information about the colsep. 1 based.true
if a separator should be placed at its right, false
otherwise.AuthorTableCellSepProvider.getColSep(ro.sync.ecss.extensions.api.node.AuthorElement, int)
public boolean getRowSep(AuthorElement cellElem, int columnIndex)
AuthorTableCellSepProvider
true
.getRowSep
in interface AuthorTableCellSepProvider
cellElem
- The node that represents a table cell in CSS.columnIndex
- The index of the column, used to identify the rowspec associated
to the cell. The rowspec can give information about the colsep. 1 based.true
if a separator should be placed at its right, false
otherwise.AuthorTableCellSepProvider.getRowSep(ro.sync.ecss.extensions.api.node.AuthorElement, int)
protected boolean isTableElement(AuthorElement element)
element
- The analysed element.true
if this element is a table element.© Copyright SyncRO Soft SRL 2002 - 2014. All rights reserved.