Class DITATableCellInfoProvider
java.lang.Object
ro.sync.ecss.extensions.api.AuthorTableColumnWidthProviderBase
ro.sync.ecss.extensions.commons.table.support.DITATableCellInfoProvider
- All Implemented Interfaces:
AuthorTableCellSpanProvider,AuthorTableColumnWidthProvider,Extension
@API(type=INTERNAL,
src=PUBLIC)
public class DITATableCellInfoProvider
extends AuthorTableColumnWidthProviderBase
implements AuthorTableCellSpanProvider
Provides information about the column width for DITA tables.
-
Field Summary
Fields inherited from class ro.sync.ecss.extensions.api.AuthorTableColumnWidthProviderBase
errorsListener -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, String tableCellsTagName) Updates the column widths in the document and in the column layout model.voidcommitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, String tableCellsTagName) Commit the table width modification.Get all with representations defined in all colspecs.getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan) Get the width representation for the cell represented by thecellElement.getColSpan(AuthorElement cellElement) Get the number of columns the given cell spans across.getRowSpan(AuthorElement cellElement) Get the number of rows that the given cell spans across.getTableWidth(String tableCellsTagName) Returns a non nullWidthRepresentationif the table width is currently known.booleanhasColumnSpecifications(AuthorElement tableElement) This method tells if the table contains column specifications.voidinit(AuthorElement tableElement) This method is called when starting to compute the layout for a table.booleanisAcceptingFixedColumnWidths(String tableCellsTagName) Check if the table column widths can be represented as fixed values.booleanisAcceptingPercentageColumnWidths(String tableCellsTagName) Check if the table column widths can be represented as percentage values.booleanisAcceptingProportionalColumnWidths(String tableCellsTagName) Check if the table column widths can be represented as proportional values.booleanisTableAcceptingWidth(String tableCellsTagName) Used to determine if the table accepts width specification.booleanisTableAndColumnsResizable(String tableCellsTagName) This method is used to check if the table and/or table columns can be resized.Methods inherited from class ro.sync.ecss.extensions.api.AuthorTableColumnWidthProviderBase
getErrorsListener, isPreferPercentageColumnWidths, setErrorsListener
-
Constructor Details
-
DITATableCellInfoProvider
public DITATableCellInfoProvider()
-
-
Method Details
-
init
Description copied from interface:AuthorTableCellSpanProviderThis method is called when starting to compute the layout for a table. Its intended to extract information from the element representing the table only once, not on every getColSpan() or getRowSpan() call. Example: for a DocBook table we identify and cache thecolspecandspanspecelements 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..- Specified by:
initin interfaceAuthorTableCellSpanProvider- Specified by:
initin interfaceAuthorTableColumnWidthProvider- Parameters:
tableElement- TheAuthorElementrepresenting a table (it has the CSS display property set on 'table').- See Also:
-
getColSpan
Description copied from interface:AuthorTableCellSpanProviderGet the number of columns the given cell spans across. For example, for the DocBook CALS tables the number of columns the cell spans across is computed by looking at thespanspecattribute. In case thespanspecattribute is missing then the column span is defined by thenamestandnameendattribute.- Specified by:
getColSpanin interfaceAuthorTableCellSpanProvider- Parameters:
cellElement- The node that represents a table cell in CSS.- Returns:
- The number of columns this cell spans across (the minimum returned value must be 1)
or
nullif not specified. - See Also:
-
getRowSpan
Description copied from interface:AuthorTableCellSpanProviderGet the number of rows that the given cell spans across. For example, for the DocBook CALS tables this value is computed by looking at themorerowsattribute.- Specified by:
getRowSpanin interfaceAuthorTableCellSpanProvider- Parameters:
cellElement- TheAuthorElementthat represents a table cell in CSS.- Returns:
- The number of rows this cell spans across (the minimum returned value must be 1)
or
nullif not specified. - See Also:
-
hasColumnSpecifications
Description copied from interface:AuthorTableCellSpanProviderThis method tells if the table contains column specifications. For example the CALS table model requirescolspecelements to be present.- Specified by:
hasColumnSpecificationsin interfaceAuthorTableCellSpanProvider- Parameters:
tableElement- TheAuthorElementthat is rendered as a table.- Returns:
trueif some column specification info is present or if the table doesn't require any column specification info.- See Also:
-
getDescription
- Specified by:
getDescriptionin interfaceExtension- Returns:
- The description of the extension.
- See Also:
-
getCellWidth
public List<WidthRepresentation> getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan) Description copied from interface:AuthorTableColumnWidthProviderGet the width representation for the cell represented by thecellElement.
For example for a CALS table cell the list with the width representations is obtained by computing the column span and then determining theWidthRepresentationfor each column the cell spans across.- Specified by:
getCellWidthin interfaceAuthorTableColumnWidthProvider- Parameters:
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.- Returns:
- The list with the
WidthRepresentationof the specified cell element ornullif the cell width cannot be computed. If the cell spans over multiple columns then the returned list will contain oneWidthRepresentationfor each column the cell spans over. - See Also:
-
commitColumnWidthModifications
public void commitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, String tableCellsTagName) throws AuthorOperationException Description copied from interface:AuthorTableColumnWidthProviderUpdates the column widths in the document and in the column layout model.
For example, for the DocBook CALS tables the method updates the columns width specifications in the source document by setting thecolwidthattribute value of thecolspecelements. Newcolspecelements will be added if needed.- Specified by:
commitColumnWidthModificationsin interfaceAuthorTableColumnWidthProvider- Parameters:
authorDocumentController- TheAuthorDocumentControllerused to commit the table modifications in the document.colWidths- The new columnWidthRepresentationto 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).- Throws:
AuthorOperationException- If the operation fails.- See Also:
-
commitTableWidthModification
public void commitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, String tableCellsTagName) throws AuthorOperationException Description copied from interface:AuthorTableColumnWidthProviderCommit the table width modification.
For example in the case of DocBook HTML tables sets thewidthattribute value of thetableelement.- Specified by:
commitTableWidthModificationin interfaceAuthorTableColumnWidthProvider- Parameters:
authorDocumentController- TheAuthorDocumentControllerused to commit the table width modifications in the document.newTableWidth- The new tableWidthRepresentationto 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).- Throws:
AuthorOperationException- If the operation fails.- See Also:
-
getTableWidth
Description copied from interface:AuthorTableColumnWidthProviderReturns a non nullWidthRepresentationif the table width is currently known.
For the DocBook HTML tables it returns theWidthRepresentationobtained by analyzing thewidthattribute value of thetableelement.- Specified by:
getTableWidthin interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).- Returns:
- A non
nullvalue if the table width is specified. Otherwisenull. - See Also:
-
isTableAcceptingWidth
Description copied from interface:AuthorTableColumnWidthProviderUsed to determine if the table accepts width specification.
For example, for the DocBook CALS tables which do not accept anwidthattribute the method will returnfalse.- Specified by:
isTableAcceptingWidthin interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).- Returns:
trueif the table type denoted by thetableCellsTagNameaccepts width specification of any kind.- See Also:
-
isTableAndColumnsResizable
Description copied from interface:AuthorTableColumnWidthProviderThis method is used to check if the table and/or table columns can be resized.
For example in the case of the DocBook CALS tables will returntrueonly if the given table cells tag name is equal to'entry'.- Specified by:
isTableAndColumnsResizablein interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
trueif the size of the table or the table cells can be adjusted.- See Also:
-
isAcceptingFixedColumnWidths
Description copied from interface:AuthorTableColumnWidthProviderCheck if the table column widths can be represented as fixed values.- Specified by:
isAcceptingFixedColumnWidthsin interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
trueif the table column widths can be represented in fixed values.- See Also:
-
isAcceptingPercentageColumnWidths
Description copied from interface:AuthorTableColumnWidthProviderCheck if the table column widths can be represented as percentage values.- Specified by:
isAcceptingPercentageColumnWidthsin interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
trueif the table column widths can be represented in percentage values.- See Also:
-
isAcceptingProportionalColumnWidths
Description copied from interface:AuthorTableColumnWidthProviderCheck if the table column widths can be represented as proportional values.- Specified by:
isAcceptingProportionalColumnWidthsin interfaceAuthorTableColumnWidthProvider- Parameters:
tableCellsTagName- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
trueif the table column widths can be represented in proportional values.- See Also:
-
getAllColspecWidthRepresentations
Description copied from class:AuthorTableColumnWidthProviderBaseGet all with representations defined in all colspecs. If a colspec does not specify a width, it is supposed to be 1*. If the table group specifies more columns than colspecs, those widths are supposed to be 1*.- Specified by:
getAllColspecWidthRepresentationsin classAuthorTableColumnWidthProviderBase- Returns:
- All width representations from the defined colspecs.
- See Also:
-