24.08.2015 Views

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

Oxygen XML Author plugin 13.2.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Author</strong> Developer Guide | 225Figure 110: Columns with custom widthsConfiguring a Table Cell Span ProviderIn the documentation framework the table element can have cells that span over multiple columns and rows. Asexplained in the Styling the Table Element section which describes the CSS properties needed for defining a table, youneed to indicate <strong>Oxygen</strong> <strong>XML</strong> <strong>Author</strong> <strong>plugin</strong> a method to determine the cell spanning. If you use the cell elementattributes rowspan and colspan or rows and cols, <strong>Oxygen</strong> <strong>XML</strong> <strong>Author</strong> <strong>plugin</strong> can determine the cell spanningautomatically. In our example the td element uses the attributes row_span and column_span that are not recognizedby default. You will need to implement a Java extension class for defining the cell spanning.Note: The Javadoc documentation of the <strong>Author</strong> API used in the example files is available on the <strong>Oxygen</strong> <strong>XML</strong>website. Also it can be downloaded as a zip archive from the website.1. Create the class simple.documentation.framework.TableCellSpanProvider. This class mustimplement the ro.sync.ecss.extensions.api.<strong>Author</strong>TableCellSpanProvider interface.import ro.sync.ecss.extensions.api.<strong>Author</strong>TableCellSpanProvider;import ro.sync.ecss.extensions.api.node.AttrValue;import ro.sync.ecss.extensions.api.node.<strong>Author</strong>Element;public class TableCellSpanProviderimplements <strong>Author</strong>TableCellSpanProvider {2. The init method is taking as argument the ro.sync.ecss.extensions.api.node.<strong>Author</strong>Elementthat represents the <strong>XML</strong> table element. In our case the cell span is specified for each of the cells so you leave thismethod empty. However there are cases like the table CALS model when the cell spanning is specified in the tableelement. In such cases you must collect the span information by analyzing the table element.public void init(<strong>Author</strong>Element table) {}3. The getColSpan method is taking as argument the table cell. The table layout engine will ask this<strong>Author</strong>TableSpanSupport implementation what is the column span and the row span for each <strong>XML</strong> elementfrom the table that was marked as cell in the CSS using the property display:table-cell. The implementationis simple and just parses the value of column_span attribute. The method must return null for all the cells that donot change the span specification.public Integer getColSpan(<strong>Author</strong>Element cell) {Integer colSpan = null;AttrValue attrValue = cell.getAttribute("column_span");if(attrValue != null) {// The attribute was found.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!