Source Code Cross Referenced for TableTag.java in  » Portal » gridsphere » org » gridsphere » provider » portletui » tags » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » gridsphere » org.gridsphere.provider.portletui.tags 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * @author <a href="mailto:novotny@gridsphere.org">Jason Novotny</a>
003:         * @version $Id: TableTag.java 6385 2007-10-25 14:02:26Z wehrens $
004:         */package org.gridsphere.provider.portletui.tags;
005:
006:        import org.gridsphere.provider.portletui.beans.TableBean;
007:        import org.gridsphere.provider.portletui.model.DefaultTableModel;
008:
009:        import javax.portlet.PortletModeException;
010:        import javax.portlet.PortletURL;
011:        import javax.portlet.RenderRequest;
012:        import javax.portlet.RenderResponse;
013:        import javax.servlet.jsp.JspException;
014:        import javax.servlet.jsp.JspWriter;
015:
016:        /**
017:         * A <code>TableTag</code> represents a table element and is defined by a <code>DefaultTableModel</code>
018:         */
019:        public class TableTag extends BaseComponentTag {
020:
021:            protected TableBean tableBean = null;
022:            protected String title = null;
023:            protected String cellSpacing = null;
024:            protected String cellPadding = null;
025:            protected String border = null;
026:            protected String width = null;
027:            protected String align = null;
028:            protected String valign = null;
029:            protected String background = null;
030:            protected boolean sortable = false;
031:            protected boolean isZebra = false;
032:            protected int rowCount = 0;
033:            protected int maxRows = -1;
034:            protected int currentPage = 0;
035:            protected boolean isShowAll = false;
036:            protected boolean filter = false;
037:            protected int numEntries = 0;
038:
039:            /**
040:             * Sets the table model associated with this table
041:             *
042:             * @param tableModel the table model associated with this table
043:             */
044:            public void setTableModel(DefaultTableModel tableModel) {
045:                this .tableBean.setTableModel(tableModel);
046:            }
047:
048:            /**
049:             * Returns the table model associated with this table
050:             *
051:             * @return the table model associated with this table
052:             */
053:            public DefaultTableModel getTableModel() {
054:                return tableBean.getTableModel();
055:            }
056:
057:            /**
058:             * Sets the table bean
059:             *
060:             * @param tableBean the table bean
061:             */
062:            public void setTableBean(TableBean tableBean) {
063:                this .tableBean = tableBean;
064:            }
065:
066:            /**
067:             * Returns the table bean
068:             *
069:             * @return the table bean
070:             */
071:            public TableBean getTableBean() {
072:                return tableBean;
073:            }
074:
075:            /**
076:             * Sets the table alignment e.g. "left", "center" or "right"
077:             *
078:             * @param align the table alignment
079:             */
080:            public void setAlign(String align) {
081:                this .align = align;
082:            }
083:
084:            /**
085:             * Returns the table alignment e.g. "left", "center" or "right"
086:             *
087:             * @return the table alignment
088:             */
089:            public String getAlign() {
090:                return align;
091:            }
092:
093:            /**
094:             * Returns the horizontal table alignment e.g. "center" or "bottom"
095:             *
096:             * @return the table horizontal alignment
097:             */
098:            public String getValign() {
099:                return valign;
100:            }
101:
102:            /**
103:             * Returns the horizontal table alignment e.g. "center" or "bottom"
104:             *
105:             * @param valign alignment of the table
106:             */
107:            public void setValign(String valign) {
108:                this .valign = valign;
109:            }
110:
111:            /**
112:             * Sets the table cell spacing
113:             *
114:             * @param cellSpacing the table cell spacing
115:             */
116:            public void setCellspacing(String cellSpacing) {
117:                this .cellSpacing = cellSpacing;
118:            }
119:
120:            /**
121:             * Returns the table cell spacing
122:             *
123:             * @return the table cell spacing
124:             */
125:            public String getCellspacing() {
126:                return cellSpacing;
127:            }
128:
129:            /**
130:             * Sets the panel (table) cell spacing
131:             *
132:             * @param cellPadding the panel cell padding
133:             */
134:            public void setCellpadding(String cellPadding) {
135:                this .cellPadding = cellPadding;
136:            }
137:
138:            /**
139:             * Returns the panel (table) cell padding
140:             *
141:             * @return the panel cell padding
142:             */
143:            public String getCellpadding() {
144:                return cellPadding;
145:            }
146:
147:            /**
148:             * Sets the table border
149:             *
150:             * @param border the panel border
151:             */
152:            public void setBorder(String border) {
153:                this .border = border;
154:            }
155:
156:            /**
157:             * Returns the panel border
158:             *
159:             * @return the panel border
160:             */
161:            public String getBorder() {
162:                return border;
163:            }
164:
165:            /**
166:             * Sets the table background
167:             *
168:             * @param background the table background
169:             */
170:            public void setBackground(String background) {
171:                this .background = background;
172:            }
173:
174:            /**
175:             * Returns the table background
176:             *
177:             * @return the tabel background
178:             */
179:            public String getBackground() {
180:                return background;
181:            }
182:
183:            /**
184:             * Returns true if a query filter is associated with this table
185:             *
186:             * @return true if a query filter is associated with this table
187:             */
188:            public boolean getFilter() {
189:                return filter;
190:            }
191:
192:            public void setFilter(boolean filter) {
193:                this .filter = filter;
194:            }
195:
196:            public int getNumentries() {
197:                return numEntries;
198:            }
199:
200:            public void setNumentries(int numEntries) {
201:                this .numEntries = numEntries;
202:            }
203:
204:            /**
205:             * Sets the table width
206:             *
207:             * @param width the table width
208:             */
209:            public void setWidth(String width) {
210:                this .width = width;
211:            }
212:
213:            /**
214:             * Returns the table width
215:             *
216:             * @return the table width
217:             */
218:            public String getWidth() {
219:                return width;
220:            }
221:
222:            public void setSortable(boolean isSortable) {
223:                sortable = isSortable;
224:            }
225:
226:            public boolean getSortable() {
227:                return sortable;
228:            }
229:
230:            public String getTitle() {
231:                return title;
232:            }
233:
234:            public void setTitle(String title) {
235:                this .title = title;
236:            }
237:
238:            public void setZebra(boolean isZebra) {
239:                this .isZebra = isZebra;
240:            }
241:
242:            public boolean getZebra() {
243:                return isZebra;
244:            }
245:
246:            public void setMaxrows(int maxRows) {
247:                this .maxRows = maxRows;
248:            }
249:
250:            public int getMaxrows() {
251:                return maxRows;
252:            }
253:
254:            public void incrementRowCount() {
255:                this .rowCount++;
256:                tableBean.setRowCount(rowCount);
257:
258:            }
259:
260:            public int getRowCount() {
261:                return rowCount;
262:            }
263:
264:            public void setCurrentPage(int currentPage) {
265:                this .currentPage = currentPage;
266:            }
267:
268:            public int getCurrentPage() {
269:                return currentPage;
270:            }
271:
272:            public void release() {
273:                tableBean = null;
274:                cellSpacing = null;
275:                cellPadding = null;
276:                title = null;
277:                border = null;
278:                width = null;
279:                align = null;
280:                valign = null;
281:                background = null;
282:                sortable = false;
283:                isZebra = false;
284:                rowCount = 0;
285:                maxRows = -1;
286:                currentPage = 0;
287:                numEntries = 0;
288:                super .release();
289:            }
290:
291:            public int doStartTag() throws JspException {
292:
293:                super .doStartTag();
294:
295:                // get any parameter values if data is divided
296:
297:                if (!beanId.equals("")) {
298:                    tableBean = (TableBean) getTagBean();
299:                    if (tableBean == null) {
300:                        tableBean = new TableBean();
301:                        setBaseComponentBean(tableBean);
302:                    } else {
303:                        //includeBody = false;
304:                    }
305:                    maxRows = tableBean.getMaxRows();
306:                    numEntries = tableBean.getNumEntries();
307:                    filter = tableBean.getFilter();
308:                } else {
309:                    tableBean = new TableBean();
310:                    this .setBaseComponentBean(tableBean);
311:                }
312:
313:                if (maxRows > 0) {
314:                    String curPage = pageContext.getRequest().getParameter(
315:                            TableBean.CURRENT_PAGE);
316:                    if (curPage != null) {
317:                        currentPage = Integer.valueOf(curPage).intValue();
318:                        tableBean.setCurrentPage(currentPage);
319:                    }
320:                    String showAll = pageContext.getRequest().getParameter(
321:                            TableBean.SHOW_ALL);
322:                    if (showAll != null) {
323:                        maxRows = 0;
324:                        isShowAll = true;
325:                    }
326:                    String showpages = pageContext.getRequest().getParameter(
327:                            TableBean.SHOW_PAGES);
328:                    if (showpages != null) {
329:                        isShowAll = false;
330:                    }
331:                }
332:
333:                if (background != null)
334:                    tableBean.setBackground(background);
335:                if (align != null)
336:                    tableBean.setAlign(align);
337:                if (valign != null)
338:                    tableBean.setValign(valign);
339:                if (width != null)
340:                    tableBean.setWidth(width);
341:                if (cellSpacing != null)
342:                    tableBean.setCellSpacing(cellSpacing);
343:                if (cellPadding != null)
344:                    tableBean.setCellPadding(cellPadding);
345:                if (border != null)
346:                    tableBean.setBorder(border);
347:                if (cssStyle != null)
348:                    tableBean.setCssStyle(cssStyle);
349:                if (cssClass != null)
350:                    tableBean.setCssClass(cssClass);
351:                if (sortable) {
352:                    tableBean.setSortable(sortable);
353:                    tableBean.setSortableID("td"
354:                            + this .getUniqueId("gs_tableNum"));
355:                }
356:                if (title != null)
357:                    tableBean.setTitle(title);
358:
359:                tableBean.setRowCount(0);
360:                tableBean.setMaxRows(maxRows);
361:                tableBean.setZebra(isZebra);
362:                tableBean.setShowall(isShowAll);
363:                if (numEntries != 0)
364:                    tableBean.setNumEntries(numEntries);
365:
366:                try {
367:                    JspWriter out = pageContext.getOut();
368:                    out.print(tableBean.toStartString());
369:                } catch (Exception e) {
370:                    throw new JspException(e.getMessage());
371:                }
372:                //if (includeBody) {
373:                return EVAL_BODY_INCLUDE;
374:                //} else {
375:                //    return SKIP_BODY;
376:                //}
377:            }
378:
379:            public int doEndTag() throws JspException {
380:                tableBean.setRowCount(rowCount);
381:
382:                RenderResponse res = (RenderResponse) pageContext
383:                        .getAttribute("renderResponse");
384:                RenderRequest req = (RenderRequest) pageContext
385:                        .getAttribute("renderRequest");
386:                PortletURL url = res.createRenderURL();
387:                try {
388:                    url.setPortletMode(req.getPortletMode());
389:                } catch (PortletModeException e) {
390:                    throw new JspException(e);
391:                }
392:                tableBean.setURIString(url.toString());
393:
394:                try {
395:                    JspWriter out = pageContext.getOut();
396:                    out.print(tableBean.toEndString());
397:                    rowCount = 0;
398:                } catch (Exception e) {
399:                    throw new JspException(e);
400:                }
401:                super.doEndTag();
402:                release();
403:                return EVAL_PAGE;
404:            }
405:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.