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

Examples of com.google.gwt.gen2.demo.datepicker.client.DatePickerDemo


   */
  public void testDistributePositiveWidth() {
    // Create some column info
    ColumnResizer resizer = new ColumnResizer();
    List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
    columns.add(new ColumnWidthInfo(100, 300, 200, 150));
    columns.add(new ColumnWidthInfo(0, 100, 50, 50));
    columns.add(new ColumnWidthInfo(0, 500, 300, 100));

    // Only the first column gets any width, goes to -50%
    {
      assertEquals(0, resizer.distributeWidth(columns, 50));
      assertEquals(150, columns.get(0).getNewWidth());
View Full Code Here


   * Verify that we can distribute a zero width.
   */
  public void testDistributeZeroWidth() {
    // Create some column info
    List<ColumnWidthInfo> columns = new ArrayList<ColumnWidthInfo>();
    columns.add(new ColumnWidthInfo(100, 300, 200, 150));
    columns.add(new ColumnWidthInfo(0, 100, 50, 50));
    columns.add(new ColumnWidthInfo(0, 500, 300, 200));

    // Distribute some width
    ColumnResizer resizer = new ColumnResizer();
    resizer.distributeWidth(columns, 0);

View Full Code Here

   * @param width the width in pixels
   * @return the new column width
   */
  public int setColumnWidth(int column, int width) {
    // Constrain the size of the column
    ColumnWidthInfo info = getColumnWidthInfo(column);
    if (info.hasMaximumWidth()) {
      width = Math.min(width, info.getMaximumWidth());
    }
    if (info.hasMinimumWidth()) {
      width = Math.max(width, info.getMinimumWidth());
    }

    // Try to constrain the size of the grid
    if (resizePolicy.isSacrificial()) {
      // Get the sacrifice columns
View Full Code Here

  private void applyNewColumnWidths(int startIndex,
      List<ColumnWidthInfo> infos, boolean forced) {
    int offset = getHeaderOffset();
    int numColumns = infos.size();
    for (int i = 0; i < numColumns; i++) {
      ColumnWidthInfo info = infos.get(i);
      int newWidth = info.getNewWidth();
      if (forced || info.getCurrentWidth() != newWidth) {
        dataTable.setColumnWidth(startIndex + i, newWidth);
        headerTable.setColumnWidth(startIndex + i + offset, newWidth);
        if (footerTable != null) {
          footerTable.setColumnWidth(startIndex + i + offset, newWidth);
        }
View Full Code Here

        idealWidth = Math.min(idealWidth, maxWidth);
      }
      minWidth = Math.max(minWidth, idealWidth);
    }

    return new ColumnWidthInfo(minWidth, maxWidth, preferredWidth, curWidth);
  }
View Full Code Here

    layout.setWidget(3, 0, highlightedRowLabel);
    layout.setWidget(2, 1, unhighlightedRowLabel);
    layout.setWidget(3, 1, unhighlightedCellLabel);

    // Add all of the listeners
    FixedWidthGrid dataTable = ScrollTableDemo.get().getDataTable();
    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) {
          column = sortList.getPrimaryColumn();
          ascending = sortList.isPrimaryAscending();
        }
        if (ascending) {
          addLogEntry("sorted column: " + column + " (ascending)", "black");
        } 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() + ")");
      }
    });
    dataTable.addCellUnhighlightHandler(new CellUnhighlightHandler() {
      public void onCellUnhighlight(CellUnhighlightEvent event) {
        Cell cell = event.getValue();
        unhighlightedCellLabel.setText("Last unhighlighted cell: ("
            + cell.getRowIndex() + "," + cell.getCellIndex() + ")");
      }
    });
    dataTable.addRowHighlightHandler(new RowHighlightHandler() {
      public void onRowHighlight(RowHighlightEvent event) {
        Row cell = event.getValue();
        highlightedRowLabel.setText("Highlighted row: (" + cell.getRowIndex()
            + ")");
      }
    });
    dataTable.addRowUnhighlightHandler(new RowUnhighlightHandler() {
      public void onRowUnhighlight(RowUnhighlightEvent event) {
        Row cell = event.getValue();
        unhighlightedRowLabel.setText("Last unhighlighted row: ("
            + cell.getRowIndex() + ")");
      }
    });
    dataTable.addRowSelectionHandler(new RowSelectionHandler() {
      public void onRowSelection(RowSelectionEvent event) {
        // Show the previously selected rows
        Set<Row> deselectedRows = event.getDeselectedRows();
        String previous = "Previously selected rows: ";
        for (Row row : event.getOldValue()) {
View Full Code Here

   * Test accessors.
   */
  public void testAccessor() {
    // Initialize the grid
    SortableGrid testGrid = getSortableGrid();
    ColumnSorter mySorter = new ColumnSorter() {
      @Override
      public void onSortColumn(SortableGrid grid, ColumnSortList sortList,
          ColumnSorterCallback callback) {
      }
    };
View Full Code Here

    // Sort the column with a column sorter
    {
      TestPageLoadHandler plh = new TestPageLoadHandler();
      scrollTable.addPageLoadHandler(plh);
      dataTable.setColumnSorter(new ColumnSorter() {
        @Override
        public void onSortColumn(SortableGrid grid, ColumnSortList sortList,
            ColumnSorterCallback callback) {
        }
      });
View Full Code Here

      }
    });

    // Override the column sorter
    if (dataTable.getColumnSorter() == null) {
      ColumnSorter sorter = new ColumnSorter() {
        @Override
        public void onSortColumn(SortableGrid grid, ColumnSortList sortList,
            ColumnSorterCallback callback) {
          reloadPage();
          callback.onSortingComplete();
View Full Code Here

    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());
View Full Code Here

TOP

Related Classes of com.google.gwt.gen2.demo.datepicker.client.DatePickerDemo

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.