Oxygen XML Editor 11.2 Author API

ro.sync.ecss.extensions.commons.table.support
Class CALSandHTMLTableCellInfoProvider

java.lang.Object
  extended by ro.sync.ecss.extensions.commons.table.support.CALSandHTMLTableCellInfoProvider
All Implemented Interfaces:
AuthorTableCellSpanProvider, AuthorTableColumnWidthProvider, Extension
Direct Known Subclasses:
CALSandHTMLTableCellSpanProvider

public class CALSandHTMLTableCellInfoProvider
extends Object
implements AuthorTableCellSpanProvider, AuthorTableColumnWidthProvider

A table cell span and column width info provider used for frameworks that have both CALS and HTML tables.


Constructor Summary
CALSandHTMLTableCellInfoProvider()
           
 
Method Summary
 void commitColumnWidthModifications(AuthorDocumentController authorDocumentController, WidthRepresentation[] colWidths, String tableCellsTagName)
          Updates the column widths in the document and in the column layout model.
 void commitTableWidthModification(AuthorDocumentController authorDocumentController, int newTableWidth, String tableCellsTagName)
          Commit the table width modification.
 AuthorTableCellSpanProvider getCALSTableCellSpanProvider()
          Get the table span provider for the CALS table model.
 List<WidthRepresentation> getCellWidth(AuthorElement cellElement, int colNumberStart, int colSpan)
          Get the width representation for the cell represented by the cellElement.
 Integer getColSpan(AuthorElement cellElement)
          Get the number of columns the given cell spans across.
 String getDescription()
           
 Integer getRowSpan(AuthorElement cellElement)
          Get the number of rows that the given cell spans across.
 WidthRepresentation getTableWidth(String tableCellsTagName)
          Returns a non null WidthRepresentation if the table width is currently known.
 AuthorTableCellSpanProvider getXHTMLTableCellSpanProvider()
          Get the table span provider for the HTML table model.
 boolean hasColumnSpecifications(AuthorElement tableElement)
          This method tells if the table contains column specifications.
 void init(AuthorElement tableNode)
          This method is called when starting to compute the layout for a table.
 boolean isAcceptingFixedColumnWidths(String tableCellsTagName)
          Check if the table column widths can be represented as fixed values.
 boolean isAcceptingPercentageColumnWidths(String tableCellsTagName)
          Check if the table column widths can be represented as percentage values.
 boolean isAcceptingProportionalColumnWidths(String tableCellsTagName)
          Check if the table column widths can be represented as proportional values.
 boolean isTableAcceptingWidth(String tableCellsTagName)
          Used to determine if the table accepts width specification.
 boolean isTableAndColumnsResizable(String tableCellsTagName)
          This method is used to check if the table and/or table columns can be resized.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CALSandHTMLTableCellInfoProvider

public CALSandHTMLTableCellInfoProvider()
Method Detail

getColSpan

public Integer getColSpan(AuthorElement cellElement)
Description copied from interface: AuthorTableCellSpanProvider
Get 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 the spanspec attribute. In case the spanspec attribute is missing then the column span is defined by the namest and nameend attribute.

Specified by:
getColSpan in interface AuthorTableCellSpanProvider
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 null if not specified.
See Also:
AuthorTableCellSpanProvider.getColSpan(AuthorElement)

getRowSpan

public Integer getRowSpan(AuthorElement cellElement)
Description copied from interface: AuthorTableCellSpanProvider
Get the number of rows that the given cell spans across. For example, for the DocBook CALS tables this value is computed by looking at the morerows attribute.

Specified by:
getRowSpan in interface AuthorTableCellSpanProvider
Parameters:
cellElement - The AuthorElement that represents a table cell in CSS.
Returns:
The number of rows this cell spans across (the minimum returned value must be 1) or null if not specified.
See Also:
AuthorTableCellSpanProvider.getRowSpan(AuthorElement)

init

public void init(AuthorElement tableNode)
Description copied from interface: AuthorTableCellSpanProvider
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 cell span provider is used for every table in a document so cached data cannot be used between different tables..

Specified by:
init in interface AuthorTableCellSpanProvider
Specified by:
init in interface AuthorTableColumnWidthProvider
Parameters:
tableNode - The AuthorElement representing a table (it has the CSS display property set on 'table').
See Also:
AuthorTableCellSpanProvider.init(AuthorElement)

getDescription

public String getDescription()
Specified by:
getDescription in interface Extension
Returns:
The description of the extension.
See Also:
Extension.getDescription()

getCALSTableCellSpanProvider

public AuthorTableCellSpanProvider getCALSTableCellSpanProvider()
Get the table span provider for the CALS table model.

Returns:
The table span provider for the CALS table model.

getXHTMLTableCellSpanProvider

public AuthorTableCellSpanProvider getXHTMLTableCellSpanProvider()
Get the table span provider for the HTML table model.

Returns:
The table span provider for the HTML table model.

hasColumnSpecifications

public boolean hasColumnSpecifications(AuthorElement tableElement)
Description copied from interface: AuthorTableCellSpanProvider
This method tells if the table contains column specifications. For example the CALS table model requires colspec elements to be present.

Specified by:
hasColumnSpecifications in interface AuthorTableCellSpanProvider
Parameters:
tableElement - The AuthorElement that is rendered as a table.
Returns:
true if some column specification info is present or if the table doesn't require any column specification info.
See Also:
AuthorTableCellSpanProvider.hasColumnSpecifications(ro.sync.ecss.extensions.api.node.AuthorElement)

getCellWidth

public List<WidthRepresentation> getCellWidth(AuthorElement cellElement,
                                              int colNumberStart,
                                              int colSpan)
Description copied from interface: AuthorTableColumnWidthProvider
Get the width representation for the cell represented by the cellElement.
For example for a CALS table cell the list with the width representations is obtained by computing the column span and then determining the WidthRepresentation for each column the cell spans across.

Specified by:
getCellWidth in interface AuthorTableColumnWidthProvider
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. If the cell spans over multiple columns then the returned list will contain one WidthRepresentation for each column the cell spans over.
See Also:
AuthorTableColumnWidthProvider.getCellWidth(ro.sync.ecss.extensions.api.node.AuthorElement, int, int)

commitColumnWidthModifications

public void commitColumnWidthModifications(AuthorDocumentController authorDocumentController,
                                           WidthRepresentation[] colWidths,
                                           String tableCellsTagName)
                                    throws AuthorOperationException
Description copied from interface: AuthorTableColumnWidthProvider
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 the colwidth attribute value of the colspec elements. New colspec elements will be added if needed.

Specified by:
commitColumnWidthModifications in interface AuthorTableColumnWidthProvider
Parameters:
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).
Throws:
AuthorOperationException - If the operation fails.
See Also:
AuthorTableColumnWidthProvider.commitColumnWidthModifications(AuthorDocumentController, ro.sync.ecss.extensions.api.WidthRepresentation[], java.lang.String)

commitTableWidthModification

public void commitTableWidthModification(AuthorDocumentController authorDocumentController,
                                         int newTableWidth,
                                         String tableCellsTagName)
                                  throws AuthorOperationException
Description copied from interface: AuthorTableColumnWidthProvider
Commit the table width modification.
For example in the case of DocBook HTML tables sets the width attribute value of the table element.

Specified by:
commitTableWidthModification in interface AuthorTableColumnWidthProvider
Parameters:
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).
Throws:
AuthorOperationException - If the operation fails.
See Also:
AuthorTableColumnWidthProvider.commitTableWidthModification(AuthorDocumentController, int, java.lang.String)

getTableWidth

public WidthRepresentation getTableWidth(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
Returns a non null WidthRepresentation if the table width is currently known.
For the DocBook HTML tables it returns the WidthRepresentation obtained by analyzing the width attribute value of the table element.

Specified by:
getTableWidth in interface AuthorTableColumnWidthProvider
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. Otherwise null.
See Also:
AuthorTableColumnWidthProvider.getTableWidth(java.lang.String)

isTableAcceptingWidth

public boolean isTableAcceptingWidth(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
Used to determine if the table accepts width specification.
For example, for the DocBook CALS tables which do not accept an width attribute the method will return false.

Specified by:
isTableAcceptingWidth in interface AuthorTableColumnWidthProvider
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 the tableCellsTagName accepts width specification of any kind.
See Also:
AuthorTableColumnWidthProvider.isTableAcceptingWidth(java.lang.String)

isTableAndColumnsResizable

public boolean isTableAndColumnsResizable(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
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 return true only if the given table cells tag name is equal to 'entry'.

Specified by:
isTableAndColumnsResizable in interface AuthorTableColumnWidthProvider
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.
See Also:
AuthorTableColumnWidthProvider.isTableAndColumnsResizable(java.lang.String)

isAcceptingFixedColumnWidths

public boolean isAcceptingFixedColumnWidths(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
Check if the table column widths can be represented as fixed values.

Specified by:
isAcceptingFixedColumnWidths in interface AuthorTableColumnWidthProvider
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.
See Also:
AuthorTableColumnWidthProvider.isAcceptingFixedColumnWidths(java.lang.String)

isAcceptingPercentageColumnWidths

public boolean isAcceptingPercentageColumnWidths(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
Check if the table column widths can be represented as percentage values.

Specified by:
isAcceptingPercentageColumnWidths in interface AuthorTableColumnWidthProvider
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.
See Also:
AuthorTableColumnWidthProvider.isAcceptingPercentageColumnWidths(java.lang.String)

isAcceptingProportionalColumnWidths

public boolean isAcceptingProportionalColumnWidths(String tableCellsTagName)
Description copied from interface: AuthorTableColumnWidthProvider
Check if the table column widths can be represented as proportional values.

Specified by:
isAcceptingProportionalColumnWidths in interface AuthorTableColumnWidthProvider
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.
See Also:
AuthorTableColumnWidthProvider.isAcceptingProportionalColumnWidths(java.lang.String)

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.