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

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

Introduction

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

Prototype

@Override
    public String getInnerHTML() 

Source Link

Usage

From source file:org.rstudio.studio.client.workbench.views.help.model.HelpInfo.java

License:Open Source License

private void parseArguments(HashMap<String, String> args, Element heading) {
    Element table = (Element) DomUtils.findNode(heading, true, true, new NodePredicate() {
        public boolean test(Node n) {
            if (n.getNodeType() != Node.ELEMENT_NODE)
                return false;

            Element el = (Element) n;

            return el.getTagName().toUpperCase().equals("TABLE")
                    && "R argblock".equals(el.getAttribute("summary"));
        }//  w w w .ja v a2  s  .  c o  m
    });

    if (table == null) {
        assert false : "Unexpected help format, no argblock table found";
        return;
    }

    TableElement t = (TableElement) table;
    NodeList<TableRowElement> rows = t.getRows();
    for (int i = 0; i < rows.getLength(); i++) {
        TableRowElement row = rows.getItem(i);
        NodeList<TableCellElement> cells = row.getCells();

        TableCellElement argNameCell = cells.getItem(0);
        TableCellElement argValueCell = cells.getItem(1);

        String argNameText = argNameCell.getInnerText();
        String argValueHtml = argValueCell.getInnerHTML();

        // argNameCell may be multiple comma-delimited arguments;
        // split them up if necessary (duplicate the help across args)
        String[] argNameTextSplat = argNameText.split("\\s*,\\s*");
        for (int j = 0; j < argNameTextSplat.length; j++)
            args.put(argNameTextSplat[j], argValueHtml);

    }
}