Source Code Cross Referenced for JspTableCell.java in  » J2EE » Sofia » com » salmonllc » jsp » 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 » J2EE » Sofia » com.salmonllc.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        //** Copyright Statement ***************************************************
002:        //The Salmon Open Framework for Internet Applications (SOFIA)
003:        // Copyright (C) 1999 - 2002, Salmon LLC
004:        //
005:        // This program is free software; you can redistribute it and/or
006:        // modify it under the terms of the GNU General Public License version 2
007:        // as published by the Free Software Foundation;
008:        //
009:        // This program is distributed in the hope that it will be useful,
010:        // but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012:        // GNU General Public License for more details.
013:        //
014:        // You should have received a copy of the GNU General Public License
015:        // along with this program; if not, write to the Free Software
016:        // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:        //
018:        // For more information please visit http://www.salmonllc.com
019:        //** End Copyright Statement ***************************************************
020:        package com.salmonllc.jsp;
021:
022:        /////////////////////////
023:        //$Archive: /SOFIA/SourceCode/com/salmonllc/jsp/JspTableCell.java $
024:        //$Author: Dan $
025:        //$Revision: 19 $
026:        //$Modtime: 10/21/04 2:44p $
027:        /////////////////////////
028:
029:        import com.salmonllc.html.HtmlComponent;
030:        import com.salmonllc.html.HtmlRowHighlighter;
031:        import com.salmonllc.html.HtmlTable;
032:
033:        /**
034:         * This class is used to represent on cell &ltTD> in an JSP Table
035:         */
036:        public class JspTableCell extends JspContainer {
037:            private String _align = HtmlTable.ALIGN_NONE;
038:            private String _vAlign = HtmlTable.VALIGN_NONE;
039:            private String _bgcolor = null;
040:            private boolean _wrap = true;
041:            private int _colSpan = 1;
042:            private int _rowSpan = 1;
043:            //
044:            private String _cellWidth = null;
045:            private String _cellHeight = null;
046:            //
047:            private String _style = null;
048:            private String _onMouseOut = null;
049:            private String _onMouseOver = null;
050:            private String _onClick = null;
051:            private JspTableCell _sortTd = null;
052:            private String _clickSortAnchorClass = null;
053:            private boolean _clickSort = true;
054:
055:            public JspTableCell(String name, com.salmonllc.html.HtmlPage p) {
056:                super (name, p);
057:            }
058:
059:            public void generateHTML(TagWriter writer, String content,
060:                    String defaultBackgroundColor, String clickSortTable,
061:                    String defaultStyle, int rowNo) throws java.io.IOException {
062:                if (!getVisible())
063:                    return;
064:
065:                JspDataTable tab = getParentDataTable();
066:
067:                StringBuffer sb = new StringBuffer();
068:
069:                sb.append("<TD");
070:
071:                boolean underline = (clickSortTable != null && _sortTd != null
072:                        && !writer.getDreamWeaverConv() && _clickSort);
073:
074:                if (getAlign() != null)
075:                    if (!getAlign().equals(HtmlTable.ALIGN_NONE))
076:                        sb.append(" ALIGN=\"" + getAlign() + "\"");
077:
078:                if (getVertAlign() != null)
079:                    if (!getVertAlign().equals(HtmlTable.VALIGN_NONE))
080:                        sb.append(" VALIGN=\"" + getVertAlign() + "\"");
081:
082:                String bgColor = "";
083:                if (getBackgroundColor() != null) {
084:                    if (!getBackgroundColor().equals(""))
085:                        bgColor = getBackgroundColor();
086:                } else if (defaultBackgroundColor != null) {
087:                    if (!defaultBackgroundColor.equals(""))
088:                        bgColor = defaultBackgroundColor;
089:                }
090:
091:                if (tab != null && tab.getRowHighlighter() != null)
092:                    sb.append(" BGCOLOR=\""
093:                            + tab.getRowHighlighter().getBgColorForRow(rowNo,
094:                                    bgColor, this ) + "\"");
095:                else
096:                    sb.append(" BGCOLOR=\"" + bgColor + "\"");
097:
098:                if (getColSpan() != 1)
099:                    sb.append(" COLSPAN=\"" + getColSpan() + "\"");
100:
101:                if (getRowSpan() != 1)
102:                    sb.append(" ROWSPAN=\"" + getRowSpan() + "\"");
103:
104:                if (getHeight() != null)
105:                    sb.append(" HEIGHT=\"" + getHeight() + "\"");
106:
107:                if (getOnClick() != null)
108:                    sb.append(" ONCLICK=\"" + getOnClick() + "\"");
109:
110:                if (getOnMouseOver() != null)
111:                    sb.append(" ONMOUSEOVER=\"" + getOnMouseOver() + "\"");
112:
113:                if (getOnMouseOut() != null)
114:                    sb.append(" ONMOUSEOUT=\"" + getOnMouseOut() + "\"");
115:
116:                if (getWidth() != null)
117:                    sb.append(" WIDTH=\"" + getWidth() + "\"");
118:
119:                if (!getWrap())
120:                    sb.append(" NOWRAP");
121:
122:                if (_style != null)
123:                    sb.append(" CLASS=\"" + getStyle() + "\"");
124:                else if (defaultStyle != null)
125:                    sb.append(" CLASS=\"" + defaultStyle + "\"");
126:
127:                sb.append(">");
128:
129:                if (tab != null && tab.getRowHighlighter() != null) {
130:                    HtmlComponent comp = getParent();
131:                    if (comp instanceof  JspContainer) {
132:                        JspContainer cont = (JspContainer) comp;
133:                        int ndx = cont.getComponentIndex(this );
134:                        int type = cont.getComponentType(ndx);
135:                        if (type == TYPE_ROW) {
136:                            int trNo = -1;
137:                            if (comp instanceof  JspTableRow) {
138:                                int cnt = tab.getComponentCount();
139:                                for (int i = 0; i < cnt; i++) {
140:                                    HtmlComponent test = tab.getComponent(i);
141:                                    if (test instanceof  JspTableRow
142:                                            && tab.getComponentType(i) == TYPE_ROW)
143:                                        trNo++;
144:                                    if (test == comp)
145:                                        break;
146:                                }
147:                                if (trNo == -1)
148:                                    trNo = 0;
149:                            }
150:                            HtmlRowHighlighter rh = tab.getRowHighlighter();
151:                            if (!writer.getDreamWeaverConv())
152:                                sb.append(rh.generateHtmlForTd(rowNo, trNo,
153:                                        bgColor));
154:                        }
155:                    }
156:                }
157:
158:                if (underline) {
159:                    sb.append("<A HREF=\"javascript:" + clickSortTable
160:                            + "ClickSort('" + _sortTd.getName() + "');\"");
161:                    if (_clickSortAnchorClass != null) {
162:                        sb.append(" CLASS=\"" + _clickSortAnchorClass + "\"");
163:                    }
164:                    sb.append(">");
165:                }
166:
167:                writer.print(sb.toString(), TagWriter.TYPE_BEGIN_TAG);
168:                writer.print(content, TagWriter.TYPE_CONTENT);
169:
170:                sb.setLength(0);
171:                if (underline)
172:                    sb.append("</A>");
173:                sb.append("</TD>");
174:
175:                writer.print(sb.toString(), TagWriter.TYPE_END_TAG);
176:
177:            }
178:
179:            /**
180:             * This method gets the alignment for a table cell
181:             */
182:            public String getAlign() {
183:                return _align;
184:            }
185:
186:            /**
187:             * This method gets the background color for a table cell
188:             */
189:            public String getBackgroundColor() {
190:                return _bgcolor;
191:            }
192:
193:            /**
194:             * This method gets the column span for a table cell
195:             */
196:            public int getColSpan() {
197:                return _colSpan;
198:            }
199:
200:            /**
201:             * This method gets the height of the table cell.
202:             */
203:            public String getHeight() {
204:                return _cellHeight;
205:            }
206:
207:            /**
208:             * Use this method to get the javascript that will be executed when the user
209:             * clicks on one of the components in the link.
210:             */
211:            public String getOnClick() {
212:                return _onClick;
213:            }
214:
215:            /**
216:             * Use this method to get the javascript that will be executed when the
217:             * mouse passes over out of all the components
218:             */
219:            public String getOnMouseOut() {
220:                return _onMouseOut;
221:            }
222:
223:            /**
224:             * Use this method to get the javascript that will be executed when the
225:             * mouse passes over any component in the link
226:             */
227:            public String getOnMouseOver() {
228:                return _onMouseOver;
229:            }
230:
231:            /**
232:             * This method gets the column span for a table cell
233:             */
234:            public int getRowSpan() {
235:                return _rowSpan;
236:            }
237:
238:            /**
239:             * This method returns the style for a table cell
240:             */
241:            public String getStyle() {
242:                return _style;
243:            }
244:
245:            /**
246:             * This method gets the vertival alignment for a table cell
247:             */
248:            public String getVertAlign() {
249:                return _vAlign;
250:            }
251:
252:            /**
253:             * This method gets the width of the table cell.
254:             */
255:            public String getWidth() {
256:                return _cellWidth;
257:            }
258:
259:            /**
260:             * This method gets whether or not the items in the cell will word wrap
261:             */
262:            public boolean getWrap() {
263:                return _wrap;
264:            }
265:
266:            /**
267:             * This method sets the alignment for a table cell
268:             */
269:            public void setAlign(String value) {
270:                _align = value;
271:            }
272:
273:            /**
274:             * This method sets the background color for a table cell
275:             */
276:            public void setBackgroundColor(String color) {
277:                _bgcolor = color;
278:            }
279:
280:            /**
281:             * This method sets which JspTableCell will be sorted when the user clicks
282:             * on the text in this cell. Generally it is only called from other
283:             * framework classes and is only relavant in the JSPDataTable
284:             */
285:
286:            public void setCellToSort(JspTableCell cell) {
287:                _sortTd = cell;
288:            }
289:
290:            /**
291:             * This method sets the column span for a table cell
292:             * 
293:             * @param colSpan
294:             *            the number of columns to span
295:             */
296:            public void setColSpan(int colSpan) {
297:                _colSpan = colSpan;
298:            }
299:
300:            /**
301:             * This method sets the height of the table cell. Overerides table column
302:             * height.
303:             * 
304:             * @param cellHeight
305:             *            the height of the cell
306:             */
307:            public void setHeight(String cellHeight) {
308:                _cellHeight = cellHeight;
309:            }
310:
311:            /**
312:             * Use this method to set the javascript that will be executed when the user
313:             * clicks on one of the components in the link.
314:             */
315:            public void setOnClick(String onClick) {
316:                _onClick = onClick;
317:            }
318:
319:            /**
320:             * Use this method to set the javascript that will be executed when the
321:             * mouse passes over out of all the components
322:             */
323:            public void setOnMouseOut(String onMouseOut) {
324:                _onMouseOut = onMouseOut;
325:            }
326:
327:            /**
328:             * Use this method to set the javascript that will be executed when the
329:             * mouse passes over any component in the link
330:             */
331:            public void setOnMouseOver(String onMouseOver) {
332:                _onMouseOver = onMouseOver;
333:            }
334:
335:            /**
336:             * This method sets the column span for a table cell
337:             * 
338:             * @param colSpan
339:             *            the number of columns to span
340:             */
341:            public void setRowSpan(int rowSpan) {
342:                _rowSpan = rowSpan;
343:            }
344:
345:            /**
346:             * This method was created in VisualAge.
347:             * 
348:             * @param style
349:             *            com.salmonllc.html.HtmlStyle
350:             */
351:            public void setStyle(String style) {
352:                _style = style;
353:            }
354:
355:            /**
356:             * This method sets the vertical alignment for a table cell
357:             */
358:
359:            public void setVertAlign(String value) {
360:                _vAlign = value;
361:            }
362:
363:            /**
364:             * This method sets the width of the table cell. Overerides table column
365:             * width.
366:             * 
367:             * @param cellWidth
368:             *            the width of the cell
369:             */
370:            public void setWidth(String cellWidth) {
371:                _cellWidth = cellWidth;
372:            }
373:
374:            /**
375:             * This method sets whether or not the contents of the cell should word wrap
376:             */
377:
378:            public void setWrap(boolean value) {
379:                _wrap = value;
380:            }
381:
382:            public void setClickSortAnchorClass(String sClassName) {
383:                _clickSortAnchorClass = sClassName;
384:            }
385:
386:            /**
387:             * @return Returns the clickSort.
388:             */
389:            public boolean isClickSort() {
390:                return _clickSort;
391:            }
392:
393:            /**
394:             * @param clickSort
395:             *            The clickSort to set.
396:             */
397:            public void setClickSort(boolean clickSort) {
398:                _clickSort = clickSort;
399:            }
400:
401:            /**
402:             *  @return the parent datatable that this component is in
403:             */
404:            public JspDataTable getParentDataTable() {
405:                HtmlComponent parent = getParent();
406:                while (parent != null) {
407:                    if (parent instanceof  JspDataTable)
408:                        return (JspDataTable) parent;
409:                    parent = parent.getParent();
410:                }
411:                return null;
412:            }
413:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.