Package com.google.gwt.gen2.table.override.client

Examples of com.google.gwt.gen2.table.override.client.HTMLTable$RowFormatter


   * Test ghost row count with spans.
   */
  public void testGhostRowSpans() {
    // Initialize the table
    FixedWidthFlexTable testTable = getFixedWidthFlexTable();
    FlexCellFormatter cellFormatter = testTable.getFlexCellFormatter();
    for (int row = 0; row < 3; row++) {
      for (int cell = 0; cell < 3; cell++) {
        testTable.setHTML(row, cell, "");
      }
    }

    // Set colspan
    assertGhostCount(3, testTable);
    cellFormatter.setColSpan(0, 1, 3);
    assertGhostCount(5, testTable);
    cellFormatter.setColSpan(0, 1, 2);
    assertGhostCount(4, testTable);
    cellFormatter.setColSpan(0, 1, 1);
    assertGhostCount(3, testTable);
    cellFormatter.setColSpan(0, 1, 0);
    assertGhostCount(3, testTable);

    // Set rowspan
    assertGhostCount(3, testTable);
    cellFormatter.setRowSpan(0, 1, 3);
    assertGhostCount(4, testTable);
    cellFormatter.setRowSpan(0, 1, 2);
    assertGhostCount(4, testTable);
    cellFormatter.setRowSpan(0, 1, 1);
    assertGhostCount(3, testTable);
  }
View Full Code Here


   */
  private FixedWidthFlexTable createHeaderTable() {
    FixedWidthFlexTable headerTable = new FixedWidthFlexTable();

    // Level 1 headers
    FlexCellFormatter headerFormatter = headerTable.getFlexCellFormatter();
    headerTable.setHTML(0, 0, "User Information");
    headerFormatter.setColSpan(0, 0, 13);

    // Create the select all checkbox
    final CheckBox selectAll = new CheckBox();
    selectAll.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        if (selectAll.getValue()) {
          getDataTable().selectAllRows();
        } else {
          getDataTable().deselectAllRows();
        }
      }
    });

    // Level 2 headers
    headerTable.setWidget(1, 0, selectAll);
    headerFormatter.setRowSpan(1, 0, 2);
    headerFormatter.setHorizontalAlignment(1, 0,
        HasHorizontalAlignment.ALIGN_CENTER);
    headerTable.setHTML(1, 1, "First and Last Name");
    headerFormatter.setColSpan(1, 1, 2);
    headerFormatter.setRowSpan(1, 1, 2);
    headerTable.setHTML(1, 2, "General Info");
    headerFormatter.setColSpan(1, 2, 3);
    headerTable.setHTML(1, 3, "Favorite Color");
    headerFormatter.setColSpan(1, 3, 1);
    headerFormatter.setRowSpan(1, 3, 2);
    headerTable.setHTML(1, 4, "Preferred Sport");
    headerFormatter.setColSpan(1, 4, 1);
    headerFormatter.setRowSpan(1, 4, 2);
    headerTable.setHTML(1, 5, "School Info");
    headerFormatter.setColSpan(1, 5, 3);
    headerTable.setHTML(1, 6, "Login Info");
    headerFormatter.setColSpan(1, 6, 2);

    // Level 3 headers
    headerTable.setHTML(2, 0, "Age");
    headerTable.setHTML(2, 1, "Gender");
    headerTable.setHTML(2, 2, "Race");
View Full Code Here

  public void testAccept() {
    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);
View Full Code Here

  public void testCancelled() {
    // Initialize the cell editor
    InlineCellEditor<String> editor = createCellEditor();

    // Create the edit info
    Grid grid = new Grid(1, 1);
    CellEditInfo cellEditInfo = new CellEditInfo(grid, 0, 0);

    // Create the callback
    TestCallback<String> callback = new TestCallback<String>(cellEditInfo);
View Full Code Here

  /**
   * Test the {@link CellEditInfo} inner class.
   */
  public void testCellEditInfo() {
    Grid grid = new Grid(1, 1);
    CellEditInfo info = new CellEditInfo(grid, 1, 2);
    assertEquals(grid, info.getTable());
    assertEquals(1, info.getRowIndex());
    assertEquals(2, info.getCellIndex());
  }
View Full Code Here

public class GridBulkRendererTest extends TableBulkRendererTestBase {

  @Override
  protected <RowType> TableRendererPair<RowType> createTableAndRenderer(
      int numColumns) {
    Grid table = new Grid();
    DefaultTableDefinition<RowType> tcr = new DefaultTableDefinition<RowType>();
    for (int i = 0; i < numColumns; i++) {
      tcr.addColumnDefinition(new CustomColumnDefinition<RowType, Object>());
    }
    GridBulkRenderer<RowType> renderer = new GridBulkRenderer<RowType>(table,
View Full Code Here

*/
public class GridTest extends HTMLTableTestBase {

  @Override
  public HTMLTable getTable(int row, int column) {
    return new Grid(row, column);
  }
View Full Code Here

  }

  public abstract HTMLTable getTable(int row, int column);

  public void testBoundsOnEmptyTable() {
    HTMLTable t = getTable(0, 0);
    try {
      t.getCellFormatter().getElement(4, 5);
    } catch (IndexOutOfBoundsException e) {
      return;
    }
    fail("should have throw an index out of bounds");
  }
View Full Code Here

    }
    fail("should have throw an index out of bounds");
  }

  public void testDoubleSet() {
    HTMLTable t = getTable(4, 4);
    t.setWidget(0, 0, new Label());
    Widget s = new Label();
    t.setWidget(0, 0, s);
    assertEquals(s, t.getWidget(0, 0));
  }
View Full Code Here

    assertEquals(s, t.getWidget(0, 0));
  }

  public void testIterator() {
    // Check remove.
    HTMLTable t = getTable(5, 5);
    Label l = new Label("hello");
    t.setWidget(0, 0, l);
    Iterator iter = t.iterator();
    assertEquals(l, iter.next());
    iter.remove();
    Iterator iter2 = t.iterator();
    assertFalse(iter2.hasNext());

    // Check put after remove.
    Widget w = new Label("bo");
    t.setWidget(0, 0, w);
    Iterator iter3 = t.iterator();
    assertEquals(w, iter3.next());
    assertFalse(iter3.hasNext());

    // Check swapping widgets.
    Widget w2 = new Label("ba");
    t.setWidget(0, 0, w2);
    Iterator iter4 = t.iterator();
    assertEquals(w2, iter4.next());
    assertFalse(iter4.hasNext());

    // Check put after put.
    Widget w3 = new Label("be");
    t.setWidget(1, 1, w3);
    Iterator iter5 = t.iterator();
    assertEquals(w2, iter5.next());
    assertEquals(w3, iter5.next());
    assertFalse(iter5.hasNext());
  }
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.table.override.client.HTMLTable$RowFormatter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.