001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.wicket.ajax.markup.html.navigation.paging;
018
019import org.apache.wicket.markup.html.link.Link;
020import org.apache.wicket.markup.html.navigation.paging.IPageable;
021import org.apache.wicket.markup.html.navigation.paging.IPagingLabelProvider;
022import org.apache.wicket.markup.html.navigation.paging.PagingNavigation;
023
024/**
025 * An ajaxified navigation for a PageableListView that holds links to other pages of the
026 * PageableListView.
027 * <p>
028 * Please
029 * 
030 * @see org.apache.wicket.markup.html.navigation.paging.PagingNavigation
031 * 
032 * @since 1.2
033 * 
034 * @author Martijn Dashorst
035 */
036public class AjaxPagingNavigation extends PagingNavigation
037{
038        private static final long serialVersionUID = 1L;
039
040        /**
041         * Constructor.
042         * 
043         * @param id
044         *            See Component
045         * @param pageable
046         *            The underlying pageable component to navigate
047         */
048        public AjaxPagingNavigation(final String id, final IPageable pageable)
049        {
050                this(id, pageable, null);
051        }
052
053        /**
054         * Constructor.
055         * 
056         * @param id
057         *            See Component
058         * @param pageable
059         *            The underlying pageable component to navigate
060         * @param labelProvider
061         *            The label provider for the text that the links should be displaying.
062         */
063        public AjaxPagingNavigation(final String id, final IPageable pageable,
064                final IPagingLabelProvider labelProvider)
065        {
066                super(id, pageable, labelProvider);
067        }
068
069        /**
070         * Factory method for creating ajaxian page number links.
071         * 
072         * @param id
073         *            link id
074         * @param pageable
075         *            the pageable
076         * @param pageIndex
077         *            the index the link points to
078         * @return the ajaxified page number link.
079         */
080        @Override
081        protected Link<?> newPagingNavigationLink(String id, IPageable pageable, long pageIndex)
082        {
083                return new AjaxPagingNavigationLink(id, pageable, pageIndex);
084        }
085}