01: //** Copyright Statement ***************************************************
02: //The Salmon Open Framework for Internet Applications (SOFIA)
03: // Copyright (C) 1999 - 2002, Salmon LLC
04: //
05: // This program is free software; you can redistribute it and/or
06: // modify it under the terms of the GNU General Public License version 2
07: // as published by the Free Software Foundation;
08: //
09: // This program is distributed in the hope that it will be useful,
10: // but WITHOUT ANY WARRANTY; without even the implied warranty of
11: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: // GNU General Public License for more details.
13: //
14: // You should have received a copy of the GNU General Public License
15: // along with this program; if not, write to the Free Software
16: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17: //
18: // For more information please visit http://www.salmonllc.com
19: //** End Copyright Statement ***************************************************
20:
21: package com.salmonllc.html;
22:
23: /**
24: * A renderer for the Page Selector for JSPDataTable, HtmlDataTable, HtmlDataTable2D and JspList
25: */
26:
27: public abstract class DataTablePageSelectRenderer {
28: public abstract String generateRowSelector(HtmlComponent comp,
29: String theme, String pageLabel, String pageOfLabel,
30: int page, int firstSubmitButton, int noButtons,
31: int maxPagingButtons, String imageURL);
32:
33: public static DataTablePageSelectRenderer getSubmitButtonRenderer() {
34: return new DataTablePageSelectRendererSubmit();
35: }
36:
37: public static DataTablePageSelectRenderer getImageButtonRenderer() {
38: return new DataTablePageSelectRendererImage();
39: }
40:
41: public static DataTablePageSelectRenderer getLinkRenderer() {
42: return new DataTablePageSelectRendererLink();
43: }
44:
45: protected void genLinkJavascript(HtmlComponent comp, StringBuffer sb) {
46: sb.append("<INPUT TYPE=\"HIDDEN\" NAME=\"" + comp.getFullName()
47: + "_page_selector\" value=\"\">");
48: sb.append("<SCRIPT LANGUAGE=\"javascript\">");
49: sb.append("function " + comp.getFullName()
50: + "_selectPage (value) {");
51: sb.append(comp.getFormString() + comp.getFullName()
52: + "_page_selector.value=value;");
53: sb.append(comp.getFormString() + "submit();");
54: sb.append("}");
55: sb.append("</SCRIPT>");
56:
57: }
58: }
|