Example usage for com.google.gwt.dom.client TableCellElement setAlign

List of usage examples for com.google.gwt.dom.client TableCellElement setAlign

Introduction

In this page you can find the example usage for com.google.gwt.dom.client TableCellElement setAlign.

Prototype

public void setAlign(String align) 

Source Link

Document

Horizontal alignment of data in cell.

Usage

From source file:com.extjs.gxt.ui.client.widget.layout.TableLayout.java

License:sencha.com license

protected Element getNextCell(Component widget) {
    if (cells == null) {
        cells = new ArrayList<List<Boolean>>();
    }/*from   w w w . j  av  a  2 s .  co  m*/

    TableData data = (TableData) getLayoutData(widget);
    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();
}