com.ephox.editlive.model.table
Interface TableManager


public interface TableManager

Useful methods for dealing with tables in the document. Instance available via ELJBean.getTableManager().


Method Summary
 void convertCellsToPercentage(Element table)
          Converts all cells in the table to percentage widths.
 void convertCellsToPixel(Element table)
          Converts all cells in the table to pixel widths.
 Element getTableAncestor(Element element)
          Finds a table parent.
 Element getTableCellAncestor(Element element)
          Finds a table cell parent.
 EphoxTableModel<Element> getTableModel(Element element)
          Creates an EphoxTableModel from the supplied element.
 EphoxTableModel<View> getTableModel(View tableView)
          Creates an EphoxTableModel from the supplied view.
 boolean isATable(Element element)
          Checks if an element is a table
 boolean isATableCell(Element element)
          Checks if an element is a td or th
 boolean isATableRow(Element element)
          Checks if an element is a tr
 

Method Detail

isATable

boolean isATable(Element element)
Checks if an element is a table


isATableRow

boolean isATableRow(Element element)
Checks if an element is a tr


isATableCell

boolean isATableCell(Element element)
Checks if an element is a td or th


getTableAncestor

Element getTableAncestor(Element element)
Finds a table parent.

Parameters:
element - element to start searching from
Returns:
table element, or null if there is none in the given hierarchy

getTableCellAncestor

Element getTableCellAncestor(Element element)
Finds a table cell parent.

Parameters:
element - element to start searching from
Returns:
cell element (td or th), or null if there is none in the given hierarchy

getTableModel

EphoxTableModel<Element> getTableModel(Element element)
Creates an EphoxTableModel from the supplied element. Element does not have to be the table; it can be one of the cells or even some text inside a cell. getTableAncestor(Element) is used to find the table.

Throws:
IllegalArgumentException - if the element is not in a table

getTableModel

EphoxTableModel<View> getTableModel(View tableView)
Creates an EphoxTableModel from the supplied view. View does not have to be the table; it can be one of the cells or even some text inside a cell. getTableAncestor(Element) is used to find the table.

Throws:
IllegalArgumentException - if the view is not in a table

convertCellsToPercentage

void convertCellsToPercentage(Element table)
Converts all cells in the table to percentage widths.

Parameters:
table - element representing the table

convertCellsToPixel

void convertCellsToPixel(Element table)
Converts all cells in the table to pixel widths.

Parameters:
table - element representing the table

Copyright (c) 2005-2012 Ephox Pty Ltd. All rights reserved.