/* * Copyright 2004-2007 the Seasar Foundation and the Others. * * 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 examples.teeda.web.foreach; import java.util.ArrayList; import java.util.List; public class ForeachPage extends AbstractF { private String foo; private String bar; public String initialize() { List itemsList = new ArrayList(); if ("0".equals(getPageNo())) { itemsList.add(createItem("a1", "b1", true)); itemsList.add(createItem("a2", "b2", false)); itemsList.add(createItem("a3", "b3", true)); } else if ("2".equals(getPageNo())) { itemsList.add(createItem("a4", "b4", true)); itemsList.add(createItem("a5", "b5", true)); itemsList.add(createItem("a6", "b6", true)); } else { itemsList.add(createItem("a7", "b7", false)); itemsList.add(createItem("a8", "b8", false)); itemsList.add(createItem("a9", "b9", true)); } setAaaItems(itemsList); return null; } public String prerender() { return null; } public String getLayout() { return null; } private FooItem createItem(String foo, String bar, boolean b) { final FooItem item = new FooItem(); item.setFoo(foo); item.setBar(bar); item.setUpdate(b); return item; } public Class doSearch() { List itemsList = new ArrayList(); itemsList.add(createItem("a7", "b7", false)); itemsList.add(createItem("a8", "b8", false)); itemsList.add(createItem("a9", "b9", true)); setAaaItems(itemsList); return null; } public Class doPrevious() { return ForeachPage.class; } public Class doNext() { return ForeachPage.class; } public String getBar() { return bar; } public void setBar(String bar) { this.bar = bar; } public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } public String getFooStyle() { return "background-color:yellow"; } public boolean isUpdate() { return getCurrentResultItem().isUpdate(); } /** * 前へのリンク * * @return */ public String getPrevHref() { return "http://localhost:8080/teeda-html-example/view/foreach/foreach.html?pageNo=0"; } /** * 次へのリンク * * @return */ public String getNextHref() { return "http://localhost:8080/teeda-html-example/view/foreach/foreach.html?pageNo=2"; } }