if (data == null) {
data = new TableData();
setLayoutData(widget, data);
}
TableCellElement td = DOM.createTD().cast();
td.setClassName("x-table-layout-cell");
td.setAttribute("role", "presentation");
int[] cell = getNextNonSpan(currentColumn, currentRow);
int curCol = currentColumn = cell[0];
int curRow = currentRow = cell[1];
for (int rowIndex = curRow; rowIndex < curRow
+ (data.getRowspan() != -1 ? data.getRowspan() : 1); rowIndex++) {
setupList(rowIndex);
for (int colIndex = curCol; colIndex < curCol
+ (data.getColspan() != -1 ? data.getColspan() : 1); colIndex++) {
cells.get(rowIndex).set(colIndex, true);
}
}
if (data.getColspan() != 1) {
td.setColSpan(data.getColspan());
}
if (data.getRowspan() != 1) {
td.setRowSpan(data.getRowspan());
}
if (data.getPadding() > 0) {
td.getStyle().setPropertyPx("padding", data.getPadding());
} else if (cellPadding > 0) {
td.getStyle().setPropertyPx("padding", cellPadding);
}
if (data.getStyleName() != null) {
fly(td).addStyleName(data.getStyleName());
}
if (data.horizontalAlign != null) {
td.setAlign(data.horizontalAlign.name());
} else if (cellHorizontalAlign != null) {
td.setAlign(cellHorizontalAlign.name());
}
if (data.verticalAlign != null) {
td.setVAlign(data.verticalAlign.name());
} else if (cellVerticalAlign != null) {
td.setVAlign(cellVerticalAlign.name());
}
if (data.getHeight() != null) {
td.setAttribute("height", data.getHeight());
}
if (data.getWidth() != null) {
td.setAttribute("width", data.getWidth());
}
if (data.getStyle() != null) {
fly(td).applyStyles(data.getStyle());
}
getRow(curRow).dom.appendChild(td);
return td.cast();
}