Package com.google.gwt.gen2.demo.scrolltable.client

Examples of com.google.gwt.gen2.demo.scrolltable.client.DataSourceTableModel


    // Get the table model
    TableModel<CustomRowValue> tableModel = getTableModel(false);

    // Request some rows without sorting
    TestCallback<CustomRowValue> callback1 = new TestCallback<CustomRowValue>(10, 20, null);
    Request request1 = new Request(10, 20);
    tableModel.requestRows(request1, callback1);
    assertTrue(callback1.isExecuted());
    assertFalse(callback1.isFailed());

    // Request some rows with sorting
    ColumnSortList sortList = new ColumnSortList();
    sortList.add(new ColumnSortInfo(5, true));
    TestCallback<CustomRowValue> callback2 = new TestCallback<CustomRowValue>(5, 6, sortList);
    Request request2 = new Request(5, 6, sortList);
    tableModel.requestRows(request2, callback2);
    assertTrue(callback2.isExecuted());
    assertFalse(callback2.isFailed());

    // Request some rows with sorting descending
    sortList.add(new ColumnSortInfo(5, false));
    TestCallback<CustomRowValue> callback3 = new TestCallback<CustomRowValue>(5, 6, sortList);
    Request request3 = new Request(5, 6, sortList);
    tableModel.requestRows(request3, callback3);
    assertTrue(callback3.isExecuted());
    assertFalse(callback3.isFailed());

    // Request some rows and fail to return them
    TableModel<CustomRowValue> failureModel = getTableModel(true);
    TestCallback<CustomRowValue> callback4 = new TestCallback<CustomRowValue>(-1, -1, null);
    Request request4 = new Request(5, 6, sortList);
    failureModel.requestRows(request4, callback4);
    assertFalse(callback4.isExecuted());
    assertTrue(callback4.isFailed());
  }
View Full Code Here


  /**
   * Test the accessors in {@link Request}.
   */
  public void testRequest() {
    // Without sort index
    Request request1 = new Request(10, 20);
    assertEquals(request1.getStartRow(), 10);
    assertEquals(request1.getNumRows(), 20);
    assertNull(request1.getColumnSortList());

    // With sort index
    ColumnSortList sortList = new ColumnSortList();
    Request request2 = new Request(5, 10, sortList);
    assertEquals(request2.getStartRow(), 5);
    assertEquals(request2.getNumRows(), 10);
    assertEquals(request2.getColumnSortList(), sortList);
  }
View Full Code Here

        assertEquals(NUM_ROWS, row);
      }
    };

    // Send a request
    Request request = new Request(0, NUM_ROWS);
    tableModel.requestRows(request, callback);
  }
View Full Code Here

        }
        dataTable.clearAll();
      }

      // Request the new data from the table model
      lastRequest = new Request(currentPage * pageSize, pageSize,
          dataTable.getColumnSortList());
      tableModel.requestRows(lastRequest, pagingCallback);
    }
  }
View Full Code Here

        } else {
          addLogEntry("sorted column: " + column, "black");
        }
      }
    });
    dataTable.addCellHighlightHandler(new CellHighlightHandler() {
      public void onCellHighlight(CellHighlightEvent event) {
        Cell cell = event.getValue();
        highlightedCellLabel.setText("Highlighted cell: (" + cell.getRowIndex()
            + "," + cell.getCellIndex() + ")");
      }
View Full Code Here

        Cell cell = event.getValue();
        highlightedCellLabel.setText("Highlighted cell: (" + cell.getRowIndex()
            + "," + cell.getCellIndex() + ")");
      }
    });
    dataTable.addCellUnhighlightHandler(new CellUnhighlightHandler() {
      public void onCellUnhighlight(CellUnhighlightEvent event) {
        Cell cell = event.getValue();
        unhighlightedCellLabel.setText("Last unhighlighted cell: ("
            + cell.getRowIndex() + "," + cell.getCellIndex() + ")");
      }
View Full Code Here

    DOM.setEventListener(headerWrapper, this);
    DOM.sinkEvents(headerWrapper, Event.ONMOUSEMOVE | Event.ONMOUSEDOWN
        | Event.ONMOUSEUP | Event.ONCLICK);

    // Listen for sorting events in the data table
    dataTable.addColumnSortHandler(new ColumnSortHandler() {
      public void onColumnSorted(ColumnSortEvent event) {
        // Get the primary column and sort order
        int column = -1;
        boolean ascending = true;
        ColumnSortList sortList = event.getColumnSortList();
View Full Code Here

    dataTable.addTableListener(new TableListener() {
      public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
        addLogEntry("cell clicked: (" + row + "," + cell + ")", "#ff00ff");
      }
    });
    dataTable.addColumnSortHandler(new ColumnSortHandler() {
      public void onColumnSorted(ColumnSortEvent event) {
        ColumnSortList sortList = event.getColumnSortList();
        int column = -1;
        boolean ascending = true;
        if (sortList != null) {
View Full Code Here

      // Deselect rows when switching pages
      FixedWidthGrid dataTable = getDataTable();
      dataTable.deselectAllRows();

      // Fire listeners
      fireEvent(new PageChangeEvent(oldPage, currentPage));

      // Clear out existing data if we aren't bulk rendering
      if (bulkRenderer == null) {
        int rowCount = getAbsoluteLastRowIndex() - getAbsoluteFirstRowIndex()
            + 1;
View Full Code Here

    // Paging specific options
    if (PagingScrollTableDemo.get() != null) {
      PagingScrollTable<Student> pagingScrollTable = PagingScrollTableDemo.get().getPagingScrollTable();
      if (pagingScrollTable != null) {
        pagingScrollTable.addPageChangeHandler(new PageChangeHandler() {
          public void onPageChange(PageChangeEvent event) {
            pageLoadDuration = new Duration();
          }
        });
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.demo.scrolltable.client.DataSourceTableModel

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.