/**
* Fetch cells information.
*/
private void fetchCells() throws Exception {
GwtState state = getState();
DOMUtils dom = getDOMUtils();
m_widgetToCells.clear();
// prepare map: Element -> Widget_Info
Map<Object, WidgetInfo> elementToWidgetMap = Maps.newHashMap();
for (WidgetInfo widget : getChildrenWidgets()) {
Object widgetObject = widget.getObject();
Object widgetElement = state.getUIObjectUtils().getElement(widgetObject);
elementToWidgetMap.put(widgetElement, widget);
}
// prepare cells used by each Widget_Info
m_columnIntervals = new Interval[m_status.getColumnCount()];
m_rowIntervals = new Interval[m_status.getRowCount()];
Map<Interval, Interval> spannedColumnIntervals = Maps.newHashMap();
Map<Interval, Interval> spannedRowIntervals = Maps.newHashMap();
for (int row = 0; row < m_status.getRowCount(); row++) {
for (int cell = 0, column = 0; column < m_status.getColumnCount(); cell++) {
// FlexTableHelper may remove cells in row below spanned
if (!m_status.isExistingCell(row, cell)) {
column++;
continue;
}
// prepare cell information
int fixedCell = m_status.fixCellAfterRowSpan(row, cell);
Object td = m_status.getElement(row, fixedCell);
int colSpan = m_status.getColSpan(row, cell);
int rowSpan = m_status.getRowSpan(row, cell);
// remember widget cells
if (dom.getChildCount(td) == 1) {
Object tdChild = dom.getChild(td, 0);
tdChild = dom.unwrapElement(tdChild);
WidgetInfo widget = elementToWidgetMap.get(tdChild);
if (widget != null) {
m_widgetToCells.put(widget, new Rectangle(column, row, colSpan, rowSpan));
}
}
// prepare row interval
if (m_rowIntervals[row] == null) {
Object trElement = dom.getParent(td);
Rectangle trBounds = state.getAbsoluteBounds(trElement);
absoluteToRelative(trBounds);
Interval trInterval = new Interval(trBounds.y, trBounds.height);
if (rowSpan == 1) {
m_rowIntervals[row] = trInterval;