Examples of ColumnSortInfo


Examples of com.google.gwt.gen2.table.client.TableModelHelper.ColumnSortInfo

    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

Examples of com.google.gwt.gen2.table.client.TableModelHelper.ColumnSortInfo

  /**
   * Test the {@link ColumnSortInfo} class.
   */
  public void testSortInfo() {
    // Test constructor
    ColumnSortInfo sortInfo = new ColumnSortInfo(3, true);
    assertEquals(3, sortInfo.getColumn());
    assertTrue(sortInfo.isAscending());

    // Test modifiers
    sortInfo.setColumn(5);
    sortInfo.setAscending(false);
    assertEquals(5, sortInfo.getColumn());
    assertFalse(sortInfo.isAscending());

    // Test equals
    assertTrue(sortInfo.equals(new ColumnSortInfo(5, false)));
    assertFalse(sortInfo.equals(new ColumnSortInfo(4, false)));
    assertFalse(sortInfo.equals(new ColumnSortInfo(5, true)));
  }
View Full Code Here

Examples of com.google.gwt.gen2.table.client.TableModelHelper.ColumnSortInfo

    // Create a new list
    ColumnSortList sortList = new ColumnSortList();
    assertEquals(0, sortList.size());

    // Add one item
    sortList.add(new ColumnSortInfo(4, false));
    assertEquals(1, sortList.size());
    assertEquals(4, sortList.getPrimaryColumn());
    assertFalse(sortList.isPrimaryAscending());
    assertTrue(sortList.getPrimaryColumnSortInfo().equals(new ColumnSortInfo(4, false)));

    // Add more items
    sortList.add(new ColumnSortInfo(6, false));
    sortList.add(new ColumnSortInfo(8, true));
    sortList.add(new ColumnSortInfo(10, true));
    assertEquals(4, sortList.size());
    assertEquals(10, sortList.getPrimaryColumn());
    assertTrue(sortList.isPrimaryAscending());

    // Check all of the entries in the sort lise
    int count = 0;
    for (ColumnSortInfo info : sortList) {
      switch (count) {
        case 0:
          assertTrue(info.equals(new ColumnSortInfo(10, true)));
          break;
        case 1:
          assertTrue(info.equals(new ColumnSortInfo(8, true)));
          break;
        case 2:
          assertTrue(info.equals(new ColumnSortInfo(6, false)));
          break;
        case 3:
          assertTrue(info.equals(new ColumnSortInfo(4, false)));
          break;
      }
      count++;
    }

    // Add an existing item
    sortList.add(new ColumnSortInfo(6, false));
    assertEquals(4, sortList.size());
    assertEquals(6, sortList.getPrimaryColumn());
    assertFalse(sortList.isPrimaryAscending());

    // Add an existing column, different order
    sortList.add(new ColumnSortInfo(8, false));
    assertEquals(4, sortList.size());
    assertEquals(8, sortList.getPrimaryColumn());
    assertFalse(sortList.isPrimaryAscending());

    // Compare two lists
    ColumnSortList sortList1 = new ColumnSortList();
    sortList1.add(new ColumnSortInfo(1, true));
    sortList1.add(new ColumnSortInfo(2, false));
    sortList1.add(new ColumnSortInfo(3, true));
    ColumnSortList sortList2 = new ColumnSortList();
    sortList2.add(new ColumnSortInfo(1, true));
    sortList2.add(new ColumnSortInfo(2, false));
    sortList2.add(new ColumnSortInfo(3, true));
    ColumnSortList sortList3 = new ColumnSortList();
    sortList3.add(new ColumnSortInfo(1, true));
    sortList3.add(new ColumnSortInfo(4, false));
    sortList3.add(new ColumnSortInfo(3, true));
    ColumnSortList sortList4 = new ColumnSortList();
    sortList4.add(new ColumnSortInfo(1, true));
    sortList4.add(new ColumnSortInfo(2, true));
    sortList4.add(new ColumnSortInfo(3, true));
    assertTrue(sortList1.equals(sortList2));
    assertFalse(sortList1.equals(sortList3));
    assertFalse(sortList1.equals(sortList4));
    assertFalse(sortList3.equals(sortList4));
  }
View Full Code Here

Examples of com.google.gwt.gen2.table.client.TableModelHelper.ColumnSortInfo

      throw new IndexOutOfBoundsException("Column index: " + column
          + ", Column size: " + numColumns);
    }

    // Add the sorting to the list of sorted columns
    columnSortList.add(new ColumnSortInfo(column, ascending));

    // Use the onSort method to actually sort the column
    Element[] selectedRows = getSelectedRowsMap().values().toArray(
        new Element[0]);
    deselectAllRows();
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

     */
    public void setDisplaySortColumn(ISearchCriteriaWithSort<T, S> criteria) {
        ColumnWithName<T, ?> column = this.getColumn(criteria.getColumnName(criteria.getSortColumn()));
        if (column != null) {
            boolean ascending = criteria.getSortOrder() == ASCENDING ? true : false;
            ColumnSortInfo sortInfo = new ColumnSortInfo(column, ascending);
            this.getColumnSortList().push(sortInfo);
        }
    }
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

    public void setCriteriaSortColumn(ISearchCriteriaWithSort<T, S> criteria) {
        if (this.getColumnSortList().size() <= 0) {
            criteria.setSortOrder(criteria.getDefaultSortOrder());
            criteria.setSortColumn(criteria.getDefaultSortColumn());
        } else {
            ColumnSortInfo sortInfo = this.getColumnSortList().get(0);
            criteria.setSortOrder(sortInfo.isAscending() ? ASCENDING : DESCENDING);
            ColumnWithName column = (ColumnWithName) sortInfo.getColumn();
            try {
                S sortColumn = criteria.getSortColumn(column.getName());
                if (sortColumn != null) {
                    criteria.setSortColumn(sortColumn);
                } else {
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

        table.setCriteriaSortColumn(criteria2);
        assertEquals(SortOrder.DESCENDING, criteria2.getSortOrder());
        assertEquals(WhateverColumn.TWO, criteria2.getSortColumn());

        // now, confirm that a bogus column (not in the enumeration) gets the default value
        ColumnSortInfo sortInfo = new ColumnSortInfo(column3, false);
        table.getColumnSortList().push(sortInfo);
        ISearchCriteriaWithSort<Whatever, WhateverColumn> criteria3 = new WhateverCriteria();
        table.setCriteriaSortColumn(criteria3);
        assertEquals(SortOrder.DESCENDING, criteria3.getSortOrder());
        assertEquals(WhateverColumn.ONE, criteria3.getSortColumn());

        // now, confirm that a bogus column (null column  name) gets the default value
        sortInfo = new ColumnSortInfo(column4, true);
        table.getColumnSortList().push(sortInfo);
        ISearchCriteriaWithSort<Whatever, WhateverColumn> criteria4 = new WhateverCriteria();
        table.setCriteriaSortColumn(criteria4);
        assertEquals(SortOrder.ASCENDING, criteria4.getSortOrder());
        assertEquals(WhateverColumn.ONE, criteria4.getSortColumn());
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

      return false;
    }

    // Get information about the sorted column.
    ColumnSortList sortList = table.getColumnSortList();
    ColumnSortInfo sortedInfo = (sortList.size() == 0) ? null : sortList.get(0);
    Column<?, ?> sortedColumn = (sortedInfo == null) ? null : sortedInfo.getColumn();
    boolean isSortAscending = (sortedInfo == null) ? false : sortedInfo.isAscending();

    // Get the common style names.
    Style style = getTable().getResources().style();
    String className = isBuildingFooter() ? style.footer() : style.header();
    String sortableStyle = " " + style.sortableHeader();
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

    assertTrue(list0.equals(list1));
    assertTrue(list1.equals(list0));
    assertEquals(list0.hashCode(), list1.hashCode());

    // Compare with one item.
    ColumnSortInfo info0 = createColumnSortInfo();
    list0.push(info0);
    list1.push(info0);
    assertTrue(list0.equals(list1));
    assertTrue(list1.equals(list0));
    assertEquals(list0.hashCode(), list1.hashCode());

    // Compare different sizes.
    ColumnSortInfo info1 = createColumnSortInfo();
    list0.push(info1);
    assertFalse(list0.equals(list1));
    assertFalse(list1.equals(list0));
    assertFalse(list0.hashCode() == list1.hashCode());
    list1.push(info1); // Make the lists equal again.

    // Compare with different items that equals each other.
    ColumnSortInfo info2a = createColumnSortInfo();
    ColumnSortInfo info2b = new ColumnSortInfo(info2a.getColumn(), info2a.isAscending());
    list0.push(info2a);
    list1.push(info2b);
    assertTrue(list0.equals(list1));
    assertTrue(list1.equals(list0));
    assertEquals(list0.hashCode(), list1.hashCode());
View Full Code Here

Examples of com.google.gwt.user.cellview.client.ColumnSortList.ColumnSortInfo

  public void testInsert() {
    ColumnSortList list = new ColumnSortList();
    assertEquals(0, list.size());

    // Insert into an empty list.
    ColumnSortInfo info0 = createColumnSortInfo();
    list.insert(0, info0);
    assertEquals(1, list.size());
    assertEquals(info0, list.get(0));

    // Insert null.
    try {
      list.insert(0, (ColumnSortInfo) null);
      fail("Expected IllegalArgumentException.");
    } catch (IllegalArgumentException e) {
      // Expected.
    }

    // Insert the same item.
    list.insert(0, info0);
    assertEquals(1, list.size());
    assertEquals(info0, list.get(0));

    // Insert a second item at index 0.
    ColumnSortInfo info1 = createColumnSortInfo();
    list.insert(0, info1);
    assertEquals(2, list.size());
    assertEquals(info1, list.get(0));
    assertEquals(info0, list.get(1));

    // Insert a third item at the last index.
    ColumnSortInfo info2 = createColumnSortInfo();
    list.insert(list.size(), info2);
    assertEquals(3, list.size());
    assertEquals(info1, list.get(0));
    assertEquals(info0, list.get(1));
    assertEquals(info2, list.get(2));
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.