Examples of RowFormatter


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

   */
  public void testCheckboxSelection() {
    // Initialize the grid
    SelectionGrid testGrid = getSelectionGrid();
    testGrid.resize(3, 4);
    RowFormatter rowFormatter = testGrid.getRowFormatter();
    CellFormatter cellFormatter = testGrid.getCellFormatter();

    // Verify the column count before setting the checkbox policy
    assertEquals(4, testGrid.getColumnCount());
    for (int i = 0; i < 3; i++) {
      Element tr = rowFormatter.getElement(i);
      assertEquals(4, tr.getChildNodes().getLength());
    }

    // Verify the column count after setting the checkbox policy
    testGrid.setSelectionPolicy(SelectionPolicy.CHECKBOX);
    assertEquals(4, testGrid.getColumnCount());
    for (int i = 0; i < 3; i++) {
      Element tr = rowFormatter.getElement(i);
      assertEquals(5, tr.getChildNodes().getLength());
    }

    // Set html and verify
    testGrid.setText(0, 0, "test");
    assertEquals("test", testGrid.getText(0, 0));
    assertEquals("test", cellFormatter.getElement(0, 0).getInnerText());
    assertEquals("test",
        DOM.getChild(rowFormatter.getElement(0), 1).getInnerText());
  }
View Full Code Here

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

   * Test that highlighting a cell correctly sets the style.
   */
  public void testHighlight() {
    // Initialize the grid
    SelectionGrid testGrid = getSelectionGrid();
    RowFormatter rowFormatter = testGrid.getRowFormatter();
    CellFormatter cellFormatter = testGrid.getCellFormatter();

    // Highlight a cell
    assertEquals(rowFormatter.getStyleName(1), "");
    assertEquals(cellFormatter.getStyleName(1, 1), "");
    testGrid.highlightCell(cellFormatter.getElement(1, 1));
    assertEquals(rowFormatter.getStyleName(1), "highlighted");
    assertEquals(cellFormatter.getStyleName(1, 1), "highlighted");

    // Highlight a cell in the same row
    testGrid.highlightCell(cellFormatter.getElement(1, 3));
    assertEquals(rowFormatter.getStyleName(1), "highlighted");
    assertEquals(cellFormatter.getStyleName(1, 1), "");
    assertEquals(cellFormatter.getStyleName(1, 3), "highlighted");

    // Highlight a cell in a different row
    testGrid.highlightCell(cellFormatter.getElement(2, 4));
    assertEquals(rowFormatter.getStyleName(1), "");
    assertEquals(cellFormatter.getStyleName(1, 3), "");
    assertEquals(rowFormatter.getStyleName(2), "highlighted");
    assertEquals(cellFormatter.getStyleName(2, 4), "highlighted");

    // Unhighlight the cell
    testGrid.highlightCell(null);
    assertEquals(rowFormatter.getStyleName(2), "");
    assertEquals(cellFormatter.getStyleName(2, 4), "");
  }
View Full Code Here

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

    // Visable Styles.
    t.getCellFormatter().setVisible(0, 0, false);
    assertTrue(t.getCellFormatter().isVisible(2, 2));
    assertFalse(t.getCellFormatter().isVisible(0, 0));
    RowFormatter formatter = t.getRowFormatter();
    formatter.setVisible(3, false);
    assertFalse(formatter.isVisible(3));
    assertTrue(formatter.isVisible(2));
    assertTrue(t.getCellFormatter().isVisible(2, 0));

    // Style name.
    assertEquals("goodbye hello", t.getCellFormatter().getStyleName(2, 2));
    t.getRowFormatter().setStyleName(3, "newStyle");
View Full Code Here

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

        // Visable Styles.
        t.getCellFormatter().setVisible(0, 0, false);
        assertTrue(t.getCellFormatter().isVisible(2, 2));
        assertFalse(t.getCellFormatter().isVisible(0, 0));
        RowFormatter formatter = t.getRowFormatter();
        formatter.setVisible(3, false);
        assertFalse(formatter.isVisible(3));
        assertTrue(formatter.isVisible(2));
        assertTrue(t.getCellFormatter().isVisible(2, 0));

        // Style name.
        assertEquals("goodbye hello", t.getCellFormatter().getStyleName(2, 2));
        t.getRowFormatter().setStyleName(3, "newStyle");
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

            formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_LEFT);
        } else {
            formatter.setHorizontalAlignment(1, 1, HasHorizontalAlignment.ALIGN_RIGHT);
        }

        RowFormatter rowFormatter = topPanel.getRowFormatter();

        // Align the content to the top
        rowFormatter.setVerticalAlign(0,
            HasVerticalAlignment.ALIGN_TOP);
        rowFormatter.setVerticalAlign(1,
            HasVerticalAlignment.ALIGN_TOP);
    }
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

    table.setWidth(cm.getTotalWidth() + "px");

    List<HeaderGroupConfig> configs = cm.getHeaderGroups();

    FlexCellFormatter cf = table.getFlexCellFormatter();
    RowFormatter rf = table.getRowFormatter();

    rows = 0;
    for (HeaderGroupConfig config : configs) {
      rows = Math.max(rows, config.getRow() + 1);
    }
    rows += 1;

    for (int i = 0; i < rows; i++) {
      rf.setStyleName(i, "x-grid3-hd-row");
      rf.getElement(i).setAttribute("role", "presentation");
    }

    int cols = cm.getColumnCount();

    for (HeaderGroupConfig config : cm.getHeaderGroups()) {
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

    DomHelper.insertHtml("afterBegin", tbody, renderHiddenHeaders(getColumnWidths()).asString());

    List<HeaderGroupConfig> configs = cm.getHeaderGroups();

    FlexCellFormatter cf = table.getFlexCellFormatter();
    RowFormatter rf = table.getRowFormatter();

    rows = 0;
    for (HeaderGroupConfig config : configs) {
      rows = Math.max(rows, config.getRow() + 1);
    }
    rows++;

    for (int i = 0; i < rows; i++) {
      rf.setStyleName(i, styles.headRow());
    }

    int cols = cm.getColumnCount();

    String cellClass = styles.header() + " " + styles.head();
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

    table.setWidth(cm.getTotalWidth() + "px");

    List<HeaderGroupConfig> configs = cm.getHeaderGroups();

    FlexCellFormatter cf = table.getFlexCellFormatter();
    RowFormatter rf = table.getRowFormatter();

    rows = 0;
    for (HeaderGroupConfig config : configs) {
      rows = Math.max(rows, config.getRow() + 1);
    }
    rows += 1;

    for (int i = 0; i < rows; i++) {
      rf.setStyleName(i, "x-grid3-hd-row");
      rf.getElement(i).setAttribute("role", "presentation");
    }

    int cols = cm.getColumnCount();

    for (HeaderGroupConfig config : cm.getHeaderGroups()) {
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

        DOM.sinkEvents(getElement(), events);
  }
 
  @Override
  public void addStyleDependentName(String styleSuffix) {
    final RowFormatter rowFormatter = table.getRowFormatter();
        final String newStyleName = rowFormatter.getStylePrimaryName(row)+"-"+styleSuffix;
        rowFormatter.addStyleName(row, newStyleName);
  }
View Full Code Here

Examples of com.google.gwt.user.client.ui.HTMLTable.RowFormatter

    table.setWidth(cm.getTotalWidth() + "px");

    List<HeaderGroupConfig> configs = cm.getHeaderGroups();

    FlexCellFormatter cf = table.getFlexCellFormatter();
    RowFormatter rf = table.getRowFormatter();

    rows = 0;
    for (HeaderGroupConfig config : configs) {
      rows = Math.max(rows, config.getRow() + 1);
    }
    rows += 1;

    for (int i = 0; i < rows; i++) {
      rf.setStyleName(i, styles.headRow());
    }

    int cols = cm.getColumnCount();

    String cellClass = styles.header() + " " + styles.head();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.