Package ro.sync.ecss.extensions.api
Interface AuthorTableColumnWidthProvider
-
- All Superinterfaces:
Extension
- All Known Implementing Classes:
AuthorTableColumnWidthProviderBase
,CALSandHTMLTableCellInfoProvider
,CALSandHTMLTableCellSpanProvider
,CALSTableCellInfoProvider
,CALSTableCellSpanProvider
,DITACALSTableCellInfoProvider
,DITATableCellInfoProvider
,DITATableCellSepInfoProvider
,DocbookTableCellSepInfoProvider
,HTMLTableCellInfoProvider
,HTMLTableCellSpanProvider
@API(type=EXTENDABLE, src=PUBLIC) public interface AuthorTableColumnWidthProvider extends Extension
This is an interface for classes which are responsible for providing information and handling modifications regarding table and column widths. It should be implemented when the author extension being developed offers support for editing data in tabular form.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
commitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, java.lang.String tableCellsTagName)
Updates the column widths in the document and in the column layout model.void
commitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, java.lang.String tableCellsTagName)
Commit the table width modification.java.util.List<WidthRepresentation>
getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan)
Get the width representation for the cell represented by thecellElement
.WidthRepresentation
getTableWidth(java.lang.String tableCellsTagName)
Returns a non nullWidthRepresentation
if the table width is currently known.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)
Used to determine if the table accepts width specification.boolean
isTableAndColumnsResizable(java.lang.String tableCellsTagName)
This method is used to check if the table and/or table columns can be resized.-
Methods inherited from interface ro.sync.ecss.extensions.api.Extension
getDescription
-
-
-
-
Method Detail
-
getCellWidth
java.util.List<WidthRepresentation> getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan)
Get 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 theWidthRepresentation
for each column the cell spans across.- 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
WidthRepresentation
of the specified cell element ornull
if the cell width cannot be computed. If the cell spans over multiple columns then the returned list will contain oneWidthRepresentation
for each column the cell spans over.
-
init
void init(AuthorElement tableElement)
This 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 the 'colspec' and 'spanspec' elements from that table. A new instance of the table column width provider is used for every table in a document so cached data cannot be reused between different tables.- Parameters:
tableElement
- The element representing a table (it has the CSS display property set on 'table').
-
commitColumnWidthModifications
void commitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, java.lang.String tableCellsTagName) throws AuthorOperationException
Updates 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 thecolwidth
attribute value of thecolspec
elements. Newcolspec
elements will be added if needed.- Parameters:
authorDocumentController
- TheAuthorDocumentController
used to commit the table modifications in the document.colWidths
- The new columnWidthRepresentation
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).- Throws:
AuthorOperationException
- If the operation fails.
-
commitTableWidthModification
void commitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, java.lang.String tableCellsTagName) throws AuthorOperationException
Commit the table width modification.
For example in the case of DocBook HTML tables sets thewidth
attribute value of thetable
element.- Parameters:
authorDocumentController
- TheAuthorDocumentController
used to commit the table width modifications in the document.newTableWidth
- The new tableWidthRepresentation
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).- Throws:
AuthorOperationException
- If the operation fails.
-
isTableAcceptingWidth
boolean isTableAcceptingWidth(java.lang.String tableCellsTagName)
Used to determine if the table accepts width specification.
For example, for the DocBook CALS tables which do not accept anwidth
attribute the method will returnfalse
.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).- Returns:
true
if the table type denoted by thetableCellsTagName
accepts width specification of any kind.
-
getTableWidth
WidthRepresentation getTableWidth(java.lang.String tableCellsTagName)
Returns a non nullWidthRepresentation
if the table width is currently known.
For the DocBook HTML tables it returns theWidthRepresentation
obtained by analyzing thewidth
attribute value of thetable
element.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. 'entry' for CALS or 'td' for HTML).- Returns:
- A non
null
value if the table width is specified. Otherwisenull
.
-
isTableAndColumnsResizable
boolean isTableAndColumnsResizable(java.lang.String tableCellsTagName)
This 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 returntrue
only if the given table cells tag name is equal to'entry'
.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
true
if the size of the table or the table cells can be adjusted.
-
isAcceptingFixedColumnWidths
boolean isAcceptingFixedColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as fixed values.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
true
if the table column widths can be represented in fixed values.
-
isAcceptingProportionalColumnWidths
boolean isAcceptingProportionalColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as proportional values.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
true
if the table column widths can be represented in proportional values.
-
isAcceptingPercentageColumnWidths
boolean isAcceptingPercentageColumnWidths(java.lang.String tableCellsTagName)
Check if the table column widths can be represented as percentage values.- Parameters:
tableCellsTagName
- The cells tag name. Used to identify the table type (e.g. CALS or HTML).- Returns:
true
if the table column widths can be represented in percentage values.
-
-