/** * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.bricket.plugin.galleriffic.web; import java.util.Iterator; import java.util.List; import org.apache.wicket.extensions.markup.html.repeater.util.SortableDataProvider; import org.apache.wicket.model.IModel; import org.apache.wicket.model.Model; import org.bricket.plugin.picture.domain.Picture; /** * PictureDataProvider auf Basis einer Liste von Pictures * * @author Ingo Renner * */ public class ListPictureDataProviderImpl extends SortableDataProvider<Picture> implements PictureDataProvider { private List<Picture> pictures; public ListPictureDataProviderImpl(List<Picture> pictures) { super(); this.pictures = pictures; } @Override public Iterator<? extends Picture> iterator(int first, int count) { return pictures.subList(first, first + count).iterator(); } @Override public int size() { return pictures.size(); } @Override public IModel<Picture> model(Picture object) { return new Model<Picture>(object); } }