package com.bitmechanic.listlib; import javax.servlet.jsp.PageContext; import java.util.*; /** * Dummy example class that creates an ArrayList of HashMaps.. In a real * application, implementations of ListCreator would do more interesting things * like load data from a database or something. * * @version $Id: ExampleCreator.java,v 1.1 2002/03/29 22:08:59 pixel Exp $ */ public class ExampleCreator implements ListCreator { private static final int SIZE = 125; public ListContainer execute(PageContext context, int offset, int max) throws Exception { ArrayList list = new ArrayList(); for (int i = offset; list.size() < max && i < SIZE; i++) { HashMap map = new HashMap(); list.add(map); map.put("firstName", "John " + (i+1)); map.put("lastName", "Doe " + (i+1)); map.put("city", "San Francisco"); } ListContainer lc = new ListContainer(list.iterator(), SIZE); return lc; } }