Package com.inmethod.grid.examples.contact

Examples of com.inmethod.grid.examples.contact.ContactsDatabase


  /**
   * {@inheritDoc}
   */
  public void query(IQuery query, IQueryResult result) {
    ContactsDatabase database = DatabaseLocator.getDatabase();
   
    String sortProperty = null;
    boolean sortAsc = true;
   
    // is there any sorting
    if (query.getSortState().getColumns().size() > 0) {
      // get the most relevant column
      ISortStateColumn state = query.getSortState().getColumns().get(0);
     
      // get the column sort properties
      sortProperty = state.getPropertyName();
      sortAsc = state.getDirection() == IGridSortState.Direction.ASC;
    }
   
    // since we don't know the actual item count we try to load one item more than requested
    // if there are n+1 items we know there will be something on the next page
   
    // get the actual items
    List<Contact> resultList = database.find(query.getFrom(), query.getCount() + 1, sortProperty, sortAsc);
    result.setItems(resultList.iterator());
   
    if (resultList.size() == query.getCount() + 1) {
      // if we managed to load n + 1 items (thus there will be another page)
      result.setTotalCount(IQueryResult.MORE_ITEMS);
View Full Code Here


  /**
   * {@inheritDoc}
   */
  public void query(IQuery query, IQueryResult result) {
    ContactsDatabase database = DatabaseLocator.getDatabase();
   
    String sortProperty = null;
    boolean sortAsc = true;
   
    // is there any sorting
    if (query.getSortState().getColumns().size() > 0) {
      // get the most relevant column
      ISortStateColumn state = query.getSortState().getColumns().get(0);
     
      // get the column sort properties
      sortProperty = state.getPropertyName();
      sortAsc = state.getDirection() == IGridSortState.Direction.ASC;
    }
   
    // determine the total count
    result.setTotalCount(database.getCount());
   
    // get the actual items
    List<Contact> resultList = database.find(query.getFrom(), query.getCount(), sortProperty, sortAsc);
    result.setItems(resultList.iterator());
   
  }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void query(IQuery query, IQueryResult<Contact> result)
  {
    ContactsDatabase database = DatabaseLocator.getDatabase();

    String sortProperty = null;
    boolean sortAsc = true;

    // is there any sorting
    if (query.getSortState().getColumns().size() > 0)
    {
      // get the most relevant column
      ISortStateColumn<Object> state = (ISortStateColumn<Object>) query.getSortState().getColumns().get(0);

      // get the column sort properties
      sortProperty = state.getPropertyName().toString();
      sortAsc = state.getDirection() == IGridSortState.Direction.ASC;
    }

    // since we don't know the actual item count we try to load one item more than requested
    // if there are n+1 items we know there will be something on the next page

    // get the actual items
    List<Contact> resultList = database.find(query.getFrom(), query.getCount() + 1,
      sortProperty, sortAsc);
    result.setItems(resultList.iterator());

    if (resultList.size() == query.getCount() + 1)
    {
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public void query(IQuery query, IQueryResult<Contact> result)
  {
    ContactsDatabase database = DatabaseLocator.getDatabase();

    String sortProperty = null;
    boolean sortAsc = true;

    // is there any sorting
    if (query.getSortState().getColumns().size() > 0)
    {
      // get the most relevant column
      ISortStateColumn<Object> state = (ISortStateColumn<Object>) query.getSortState().getColumns().get(0);

      // get the column sort properties
      sortProperty = state.getPropertyName().toString();
      sortAsc = state.getDirection() == IGridSortState.Direction.ASC;
    }

    // determine the total count
    result.setTotalCount(database.getCount());

    // get the actual items
    List<Contact> resultList = database.find(query.getFrom(), query.getCount(), sortProperty,
      sortAsc);
    result.setItems(resultList.iterator());

  }
View Full Code Here

TOP

Related Classes of com.inmethod.grid.examples.contact.ContactsDatabase

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.