01: /*
02: * Created on Apr 5, 2004
03: *
04: * To change the template for this generated file go to
05: * Window>Preferences>Java>Code Generation>Code and Comments
06: */
07: //** Copyright Statement ***************************************************
08: //The Salmon Open Framework for Internet Applications (SOFIA)
09: //Copyright (C) 1999 - 2002, Salmon LLC
10: //
11: //This program is free software; you can redistribute it and/or
12: //modify it under the terms of the GNU General Public License version 2
13: //as published by the Free Software Foundation;
14: //
15: //This program is distributed in the hope that it will be useful,
16: //but WITHOUT ANY WARRANTY; without even the implied warranty of
17: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: //GNU General Public License for more details.
19: //
20: //You should have received a copy of the GNU General Public License
21: //along with this program; if not, write to the Free Software
22: //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23: //
24: //For more information please visit http://www.salmonllc.com
25: //** End Copyright Statement ***************************************************
26: package com.salmonllc.html;
27:
28: import com.salmonllc.properties.Props;
29:
30: /**
31: * A renderer for the Page Selector for JSPDataTable, HtmlDataTable, HtmlDataTable2D and JspList, that renders as dynamically generated submit images
32: */
33: public class DataTablePageSelectRendererImage extends
34: DataTablePageSelectRenderer {
35: protected String _font = Props.FONT_BUTTON;
36:
37: public String generateRowSelector(HtmlComponent comp, String theme,
38: String pageLabel, String pageOfLabel, int page,
39: int firstSubmitButton, int noButtons, int maxPagingButtons,
40: String imageURL) {
41: Props pr = comp.getPage().getPageProperties();
42: String fontStart = pr.getThemeProperty(theme, _font
43: + Props.TAG_START);
44: String fontEnd = pr.getThemeProperty(theme, _font
45: + Props.TAG_END);
46: if (fontStart == null) {
47: fontStart = "";
48: fontEnd = "";
49: }
50: StringBuffer sb = new StringBuffer();
51:
52: sb.append(fontStart + pageLabel + ": " + page + " "
53: + pageOfLabel + " " + noButtons + " ");
54:
55: if (noButtons > maxPagingButtons && firstSubmitButton > 0) {
56: if (noButtons > 2)
57: sb.append("<INPUT TYPE=\"IMAGE\" name=\""
58: + comp.getFullName() + "_page_first\" src=\""
59: + imageURL + "first.dgif\">");
60: sb.append("<INPUT TYPE=\"IMAGE\" name=\""
61: + comp.getFullName() + "_page_prior\" src=\""
62: + imageURL + "prior.dgif\">");
63: }
64: for (int i = 0; (i < noButtons) && (i < maxPagingButtons); i++) {
65: sb.append("<INPUT TYPE=\"IMAGE\" name=\""
66: + comp.getFullName() + "_page_"
67: + (i + firstSubmitButton) + "\" src=\"" + imageURL
68: + (i + firstSubmitButton) + ".dgif\">");
69: }
70: if ((firstSubmitButton + (maxPagingButtons == 0 ? 1
71: : maxPagingButtons)) < noButtons) {
72: sb.append("<INPUT TYPE=\"IMAGE\" name=\""
73: + comp.getFullName() + "_page_next\" src=\""
74: + imageURL + "next.dgif\">");
75: if (noButtons > 2)
76: sb.append("<INPUT TYPE=\"IMAGE\" name=\""
77: + comp.getFullName() + "_page_last\" src=\""
78: + imageURL + "last.dgif\">");
79: }
80: sb.append(fontEnd);
81: return sb.toString();
82: }
83: }
|