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

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

Introduction

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

Prototype

public void setColSpan(int colSpan) 

Source Link

Document

Number of columns spanned by 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>>();
    }//ww w  .  jav  a  2s. c o  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();
}

From source file:com.google.speedtracer.client.visualizations.view.JavaScriptProfileRenderer.java

License:Apache License

private void dumpNodeChildrenFlat(Container container, JavaScriptProfileNode profileRoot) {
    final List<JavaScriptProfileNode> children = profileRoot.getChildren();
    if (children == null) {
        return;/*from   w  w w .  jav a2  s  .  c  om*/
    }
    Collections.sort(children, JavaScriptProfileModel.nodeTimeComparator);
    final Table profileTable = new Table(container);
    int rowIndex = 0;
    profileTable.appendRow();
    profileTable.appendCell(rowIndex).setInnerHTML("<b>Symbol</b>");
    profileTable.appendCell(rowIndex).setInnerHTML("<b>Resource</b>");
    profileTable.appendCell(rowIndex).setInnerHTML("<b>Self Time</b>");
    profileTable.appendCell(rowIndex).setInnerHTML("<b>Time</b>");

    for (int length = children.size(); rowIndex < length; ++rowIndex) {
        JavaScriptProfileNode child = children.get(rowIndex);
        // Truncate the display by default to show only nodes where self time
        // occurred.
        if (child.getSelfTime() <= 0 && (length - rowIndex > 4) || rowIndex > FLAT_PROFILE_PAGE_SIZE) {
            break;
        }
        addFlatChild(child, profileTable);
    }

    // Profile terminated early, add a "show more" indicator
    if (rowIndex < children.size()) {
        profileTable.appendRow();
        TableCellElement cell = profileTable.appendCell(rowIndex + 1);
        cell.setColSpan(4);
        Anchor anchor = new Anchor(new DefaultContainerImpl(cell));
        anchor.setText("More...");
        anchor.setHref("javascript:;");
        cell.appendChild(anchor.getElement());
        final int moreRowIndex = rowIndex;
        listenerManager.manageEventListener(anchor.addClickListener(new ClickListener() {

            public void onClick(ClickEvent event) {
                profileTable.deleteRow(moreRowIndex + 1);
                for (int i = moreRowIndex; i < children.size(); ++i) {
                    JavaScriptProfileNode child = children.get(i);
                    addFlatChild(child, profileTable);
                }
                if (resizeCallback != null) {
                    resizeCallback.onResize();
                }
            }
        }));
    }
}

From source file:com.xemantic.tadedon.gwt.user.client.ui.TableData.java

License:Apache License

public void setColspan(int colspan) {
    TableCellElement cellElement = getElement().cast();
    cellElement.setColSpan(colspan);
}

From source file:org.rstudio.studio.client.common.compile.errorlist.CompileErrorItemCodec.java

License:Open Source License

@Override
protected int addBreak(TableRowElement row) {
    TableRowElement headerRow = Document.get().createTRElement();
    headerRow.setClassName(resources_.styles().headerRow());

    TableCellElement cell = Document.get().createTDElement();
    cell.setColSpan(3);

    String path = row.getAttribute(DATA_PATH);
    if (fileHeaderBasePath_ != null) {
        if (path.startsWith(fileHeaderBasePath_))
            path = path.substring(fileHeaderBasePath_.length());
    }/* w  ww. j ava 2  s.com*/
    cell.setInnerText(path);

    headerRow.appendChild(cell);

    row.getParentElement().insertBefore(headerRow, row);

    return 1;
}

From source file:org.rstudio.studio.client.common.compilepdf.CompilePdfErrorItemCodec.java

License:Open Source License

@Override
protected int addBreak(TableRowElement row) {
    TableRowElement headerRow = Document.get().createTRElement();
    headerRow.setClassName(resources_.styles().headerRow());

    TableCellElement cell = Document.get().createTDElement();
    cell.setColSpan(3);
    cell.setInnerText(row.getAttribute(DATA_PATH));

    headerRow.appendChild(cell);/*from   w  w  w .  j  a va  2 s. co m*/

    row.getParentElement().insertBefore(headerRow, row);

    return 1;
}

From source file:org.rstudio.studio.client.common.sourcemarkers.SourceMarkerItemCodec.java

License:Open Source License

@Override
protected int addBreak(TableRowElement row) {
    TableRowElement headerRow = Document.get().createTRElement();
    headerRow.setClassName(resources_.styles().headerRow());

    TableCellElement cell = Document.get().createTDElement();
    cell.setColSpan(3);

    String path = row.getAttribute(DATA_PATH);
    if (!StringUtil.isNullOrEmpty(fileHeaderBasePath_)) {
        if (path.startsWith(fileHeaderBasePath_))
            path = path.substring(fileHeaderBasePath_.length());
    }//from w  w  w .j  a  va 2s .c o m
    cell.setInnerText(path);

    headerRow.appendChild(cell);

    row.getParentElement().insertBefore(headerRow, row);

    return 1;
}

From source file:org.rstudio.studio.client.workbench.views.history.view.HistoryEntryItemCodec.java

License:Open Source License

public TableRowElement getRowForItem(HistoryEntry entry) {
    TableRowElement tr = Document.get().createTRElement();
    tr.setAttribute("data-entry-id", entry.getIndex() + "");
    tr.setAttribute("data-timestamp", entry.getTimestamp().getTime() + "");

    TableCellElement td = Document.get().createTDElement();
    td.setColSpan(2);
    td.setClassName(commandClass_);//from  w ww  . java2 s  .c  om

    DivElement div = Document.get().createDivElement();
    div.setInnerText(addBreaks(entry.getCommand()));

    td.appendChild(div);
    tr.appendChild(td);
    TableCellElement tdDiscButton = maybeCreateDisclosureButton(entry);
    if (tdDiscButton != null)
        tr.appendChild(tdDiscButton);

    return tr;
}

From source file:org.rstudio.studio.client.workbench.views.history.view.HistoryEntryItemCodec.java

License:Open Source License

private int addTimestampCell(TableRowElement row, String formatted) {
    TableCellElement cell = row.getCells().getItem(0);
    cell.setColSpan(1);
    TableCellElement tsCell = Document.get().createElement("td").cast();
    tsCell.setClassName(timestampClass_);
    tsCell.setInnerText(formatted);/*w  ww.  j a v a  2 s  .  co m*/
    row.insertAfter(tsCell, cell);
    return 0;
}

From source file:org.rstudio.studio.client.workbench.views.output.find.FindOutputCodec.java

License:Open Source License

@Override
public TableRowElement getRowForItem(FindResult entry) {
    if (entry == null) {
        // Overflow message
        TableRowElement tr = Document.get().createTRElement();
        TableCellElement td = Document.get().createTDElement();
        td.setClassName(styles_.overflowWarning());
        td.setColSpan(2);
        td.setInnerText("More than 1000 matching lines were found. " + "Only the first 1000 lines are shown.");
        tr.appendChild(td);/*from   w w  w.j a v  a 2s .  com*/
        return tr;
    }

    TableRowElement tr = Document.get().createTRElement();
    tr.setAttribute(DATA_FILE, entry.getFile());
    tr.setAttribute(DATA_LINE, entry.getLine() + "");

    TableCellElement td1 = Document.get().createTDElement();
    td1.setClassName(styles_.line());
    td1.setInnerText(entry.getLine() + ":\u00A0");
    tr.appendChild(td1);

    TableCellElement td2 = Document.get().createTDElement();
    td2.setClassName(styles_.lineValue());
    td2.setInnerHTML(entry.getLineHTML().asString());
    tr.appendChild(td2);

    return tr;
}

From source file:org.rstudio.studio.client.workbench.views.output.find.FindOutputCodec.java

License:Open Source License

@Override
protected int addBreak(TableRowElement row) {
    TableRowElement tr = Document.get().createTRElement();
    tr.setClassName(styles_.headerRow());

    TableCellElement td = Document.get().createTDElement();
    td.setColSpan(2);
    td.setInnerText(row.getAttribute(DATA_FILE));
    tr.appendChild(td);/*  w ww.ja  va  2  s .c  o  m*/

    row.getParentElement().insertBefore(tr, row);
    return 1;
}