Configuring a Table Cell Row and Column Separator Provider

In a custom framework, the table element has separators between rows. As explained in Configuring Tables section that describes the CSS properties needed for defining a table, you need to indicate Oxygen XML Editor a method to determine the way rows and columns are separated. If you use the rowsep and colsep cell element attributes, or your table is conforming to the CALS table model, Oxygen XML Editor can determine the cell separators. In the example there are no attributes defining the separators but we still want the rows to be separated. You will need to implement a Java extension.
  1. Create the class simple.documentation.framework.TableCellSepProvider. This class must implement the ro.sync.ecss.extensions.api.AuthorTableCellSepProvider interface.
    import ro.sync.ecss.extensions.api.AuthorTableCellSepProvider;
    import ro.sync.ecss.extensions.api.node.AuthorElement;
    
    public class TableCellSepProvider implements AuthorTableCellSepProvider{
  2. The init method is taking as argument the ro.sync.ecss.extensions.api.node.AuthorElement that represents the XML table element. In our case the separator information is implicit, it does not depend on the current table, so you leave this method empty. However, there are cases (such as the CALS table model) when the cell separators are specified in the table element. In such cases, you should initialize your provider based on the given argument.
    public void init(AuthorElement table) {
    }
  3. The getColSep method is taking as argument the table cell. The table layout engine will ask this AuthorTableCellSepProvider implementation if there is a column separator for each XML element from the table that was marked as cell in the CSS using the property display:table-cell. In our case we choose to return false since we do not need column separators.
      /**
       * @return false - No column separator at the right of the cell.
       */
      @Override
      public boolean getColSep(AuthorElement cellElement, int columnIndex) {
        return false;
      }
  4. The row separators are determined in a similar manner. This time the method returns true, forcing a separator between the rows.
      /**
       * @return true - A row separator below each cell.
       */
      @Override
      public boolean getRowSep(AuthorElement cellElement, int columnIndex) {
        return true;
      }
    Note: The complete source code for the examples can be found in the Simple Documentation Framework project, included in the oxygen-sample-framework module of the Oxygen SDK , available as a Maven archetype on the Oxygen XML Editor website.
  5. In the listing below, the XML document contains the table element:
     <table>
          <header>
            <td>H1</td>
            <td>H2</td>
            <td>H3</td>
            <td>H4</td>
          </header>
          <tr>
            <td>C11</td>
            <td>C12</td>
            <td>C13</td>
            <td>C14</td>
          </tr>
          <tr>
            <td>C21</td>
            <td>C22</td>
            <td>C23</td>
            <td>C24</td>
          </tr>
          <tr>
            <td>C31</td>
            <td>C32</td>
            <td>C33</td>
            <td>C34</td>
          </tr>
        </table>

When the borders for the td element are removed from the CSS, the row separators become visible:

Figure: Row separators provided by the Java implementation.

Note: The complete source code for the examples can be found in the Simple Documentation Framework project, included in the oxygen-sample-framework module of the Oxygen SDK , available as a Maven archetype on the Oxygen XML Editor website.