Package org.apache.wicket.extensions.markup.html.repeater.util

Examples of org.apache.wicket.extensions.markup.html.repeater.util.SortParam


        }

        @Override
        protected void onSortChanged() {
            final PageParameters params = new PageParameters();
            final SortParam sort = _stateLocator.getSort();
            params.add( "page", "1" );
            params.add( "orderby", sort.getProperty() );
            params.add( "asc", String.valueOf( sort.isAscending() ) );
            setResponsePage( ListLightPage.class, params );
        }
View Full Code Here


        /**
         * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int,
         *      int)
         */
        public Iterator<Contact> iterator( final int first, final int count ) {
            final SortParam sp = getSort();
            return getContactsDB().find( first, count, sp.getProperty(), sp.isAscending() ).iterator();
        }
View Full Code Here

      return new Model<RepositoryModel>(header);
    }

    @Override
    public Iterator<RepositoryModel> iterator(int first, int count) {
      SortParam sp = getSort();
      String prop = sp.getProperty();
      final boolean asc = sp.isAscending();

      if (prop == null || prop.equals(SortBy.date.name())) {
        Collections.sort(list, new Comparator<RepositoryModel>() {
          @Override
          public int compare(RepositoryModel o1, RepositoryModel o2) {
View Full Code Here

    this.serviceClazz = serviceClass;
  }

  public Iterator iterator(int first, int count)
  {
    final SortParam sp = getSort();

    if (sp != null)
    {
      return XRaceApplication.getService(serviceClazz).sortedList(
          sp.getProperty(), sp.isAscending(), first, count)
          .iterator();
    }

    return XRaceApplication.getService(serviceClazz).list(first, count)
        .iterator();
View Full Code Here

    this.detachable = detachable;
  }

  public Iterator iterator(final int first, final int count)
  {
    final SortParam sp = getSort();

    if (sp != null)
    {
      return this.find(first, count, sp.getProperty(), sp.isAscending())
          .iterator();
    }

    return this.getIndex(null, false).subList(first, first + count)
        .iterator();
View Full Code Here

    {
      @Override
      protected Iterator<IModel<Contact>> getItemModels()
      {
        // for simplicity we only show the first 10 contacts
        SortParam sort = new SortParam("firstName", true);
        Iterator<Contact> contacts = DatabaseLocator.getDatabase().find(0, 10, sort).iterator();

        // the iterator returns contact objects, but we need it to
        // return models, we use this handy adapter class to perform
        // on-the-fly conversion.
View Full Code Here

   *
   * @see org.apache.wicket.markup.repeater.data.IDataProvider#iterator(int, int)
   */
  public Iterator<Contact> iterator(int first, int count)
  {
    return getContactsDB().find(first, count, new SortParam("firstName", true)).iterator();
  }
View Full Code Here

            }
            return list.subList(first, toIndex).listIterator();
        }
        else
        {
            final SortParam sort = this.state.getSort();
            final SortInfo sortInfo = new SortInfo( sort.getProperty(), sort.isAscending()? SortOrder.asc: SortOrder.desc );
            if(sortInfo != null)
                QueryUtils.sortList( list, sortInfo );
            int toIndex = first + count;
            if (toIndex > list.size())
            {
View Full Code Here

  @Override
  public Iterator<? extends Person> iterator(int first, int count) {
    if(this.state == null || this.state.getSort() == null) {
      return super.iterator(first, count);
    } else {
      SortParam sort = this.state.getSort();
      SortInfo sortInfo = new SortInfo(sort.getProperty(), sort.isAscending()? SortOrder.asc: SortOrder.desc);
      if(sortInfo != null)
        QueryUtils.sortList(persons, sortInfo);
      int toIndex = first + count;
      if (toIndex > persons.size())
      {
View Full Code Here

    @SuppressWarnings("serial")
    final SortableDataProvider<AddressDO, String> sortableDataProvider = new SortableDataProvider<AddressDO, String>() {
      @Override
      public Iterator< ? extends AddressDO> iterator(final long first, final long count)
      {
        final SortParam sp = getSort();
        if (addresses == null) {
          return null;
        }
        final Comparator<AddressDO> comp = new MyBeanComparator<AddressDO>(sp.getProperty().toString(), sp.isAscending());
        Collections.sort(addresses, comp);
        return addresses.subList((int)first, (int)(first + count)).iterator();
      }

      public long size()
View Full Code Here

TOP

Related Classes of org.apache.wicket.extensions.markup.html.repeater.util.SortParam

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.