Example usage for com.google.gwt.dom.client TableRowElement addClassName

List of usage examples for com.google.gwt.dom.client TableRowElement addClassName

Introduction

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

Prototype

@Override
    public boolean addClassName(String className) 

Source Link

Usage

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

License:Open Source License

@Override
public TableRowElement getRowForItem(SourceMarker entry) {
    TableRowElement tr = Document.get().createTRElement();
    tr.addClassName(ThemeResources.INSTANCE.themeStyles().fixedWidthFont());
    FontSizer.applyNormalFontSize(tr);// w  ww .  j a v a 2 s  .  c o  m

    tr.setAttribute(DATA_PATH, entry.getPath());
    tr.setAttribute(DATA_LINE, entry.getLine() + "");
    tr.setAttribute(DATA_COLUMN, entry.getColumn() + "");
    tr.setAttribute(LOG_PATH, entry.getLogPath());
    tr.setAttribute(LOG_LINE, entry.getLogLine() + "");

    TableCellElement tdIcon = Document.get().createTDElement();
    tdIcon.setClassName(resources_.styles().iconCell());
    DivElement iconDiv = Document.get().createDivElement();
    iconDiv.setClassName(
            entry.getType() == SourceMarker.ERROR ? resources_.styles().errorIcon()
                    : entry.getType() == SourceMarker.WARNING ? resources_.styles().warningIcon()
                            : entry.getType() == SourceMarker.BOX ? resources_.styles().boxIcon()
                                    : entry.getType() == SourceMarker.INFO ? resources_.styles().infoIcon()
                                            : entry.getType() == SourceMarker.STYLE
                                                    ? resources_.styles().styleIcon()
                                                    : "");
    tdIcon.appendChild(iconDiv);
    if (entry.getType() == SourceMarker.USAGE)
        tdIcon.addClassName(resources_.styles().noIcon());
    tr.appendChild(tdIcon);

    TableCellElement tdLine = Document.get().createTDElement();
    tdLine.setClassName(resources_.styles().lineCell());
    if (entry.getLine() >= 0)
        tdLine.setInnerText("Line " + entry.getLine());
    tr.appendChild(tdLine);

    TableCellElement tdMsg = Document.get().createTDElement();
    tdMsg.setClassName(resources_.styles().messageCell());
    tdMsg.setInnerHTML(entry.getMessage());
    tr.appendChild(tdMsg);

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

    return tr;

}