Example usage for com.google.gwt.user.client.ui HTMLTable getWidget

List of usage examples for com.google.gwt.user.client.ui HTMLTable getWidget

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HTMLTable getWidget.

Prototype

public Widget getWidget(int row, int column) 

Source Link

Document

Gets the widget in the specified cell.

Usage

From source file:org.jax.gwtutil.client.WidgetUtilities.java

License:Open Source License

/**
 * Get the row index of the widget// w ww.  j  a  v  a  2  s .  c  o  m
 * @param widget
 *      the widget
 * @param table
 *      the table
 * @return
 *      the row index or -1 if the widget isn't in the table
 */
public static int getRowIndexOf(Widget widget, HTMLTable table) {
    int rowCount = table.getRowCount();
    for (int row = 0; row < rowCount; row++) {
        int cellCount = table.getCellCount(row);
        for (int column = 0; column < cellCount; column++) {
            if (table.getWidget(row, column) == widget) {
                return row;
            }
        }
    }

    return -1;
}

From source file:org.sigmah.client.ui.view.project.logframe.grid.HTMLTableUtils.java

License:Open Source License

/**
 * Applies the CSS column-header styles to a cell.
 * //w w w.  java2  s.  c o m
 * @param table
 *          The GWT table.
 * @param row
 *          The row index.
 * @param column
 *          The column index.
 */
public static void applyColumnHeaderStyles(HTMLTable table, int row, int column) {
    table.getCellFormatter().addStyleName(row, column, "x-grid3-header");
    table.getCellFormatter().addStyleName(row, column, "x-grid3-hd");
    table.getCellFormatter().addStyleName(row, column, "x-grid3-hd-row");
    table.getCellFormatter().addStyleName(row, column, "x-grid3-td-favorite");
    table.getCellFormatter().addStyleName(row, column, "x-grid3-cell");

    final Widget w = table.getWidget(row, column);
    if (w != null) {
        w.addStyleName("x-grid3-hd-inner");
        w.addStyleName("x-grid3-hd-favorite ");
        w.addStyleName("x-component");
    }
}

From source file:org.sigmah.client.ui.view.project.logframe.grid.HTMLTableUtils.java

License:Open Source License

/**
 * Applies the CSS content style to a cell.
 * /* w w  w. j  av a  2  s  .co  m*/
 * @param table
 *          The GWT table.
 * @param row
 *          The row index.
 * @param column
 *          The column index.
 * @param first
 *          If the cell is the first of its row.
 * @param last
 *          If the cell is the last of its row.
 */
public static void applyCellStyles(HTMLTable table, int row, int column, boolean first, boolean last) {
    table.getCellFormatter().addStyleName(row, column, "x-grid3-col");
    table.getCellFormatter().addStyleName(row, column, "x-grid3-cell");
    table.getCellFormatter().addStyleName(row, column, "html-table-cell");

    if (first) {
        table.getCellFormatter().addStyleName(row, column, "x-grid3-cell-first");
    }

    if (last) {
        table.getCellFormatter().addStyleName(row, column, "x-grid3-cell-last");
        table.getCellFormatter().addStyleName(row, column, "html-table-cell-last");
    }

    final Widget w = table.getWidget(row, column);
    if (w != null) {
        w.addStyleName("x-grid3-cell-inner");
    }
}