Source Code Cross Referenced for LinkCellRenderer.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » components » table » renderer » 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 » webwork 2.2.6 » com.opensymphony.webwork.components.table.renderer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.webwork.components.table.renderer;
006:
007:        import com.opensymphony.webwork.components.table.WebTable;
008:
009:        /**
010:         * @author $author$
011:         * @version $Revision: 1282 $
012:         */
013:        public class LinkCellRenderer extends AbstractCellRenderer {
014:
015:            /**
016:             * this is the actual renderer tha will be used to display the text
017:             */
018:            protected CellRenderer _delegateRenderer = new DefaultCellRenderer();
019:
020:            /**
021:             * the CSS class this link belongs to. Optional
022:             */
023:            protected String _cssClass = null;
024:
025:            /**
026:             * the id attribute this link belongs to. Optional
027:             */
028:            protected String _cssId = null;
029:
030:            /**
031:             * this is the link we are setting (required)
032:             */
033:            protected String _link = null;
034:
035:            /**
036:             * the (Java)script/ function to execute when the link is clicked. Optional
037:             */
038:            protected String _onclick = null;
039:
040:            /**
041:             * the (Java)script/ function to execute when the link is clicked twice. Optional
042:             */
043:            protected String _ondblclick = null;
044:
045:            /**
046:             * the (Java)script/ function to execute when cursor is away from the link. Optional
047:             */
048:            protected String _onmouseout = null;
049:
050:            /**
051:             * the (Java)script/ function to execute when cursor is over the link. Optional
052:             */
053:            protected String _onmouseover = null;
054:
055:            /**
056:             * if set there will be a parameter attached to link.  (optional)
057:             * This should be extended to allow multiple parameters
058:             */
059:            protected String _param = null;
060:
061:            /**
062:             * directly set the value for the param.  Will overide paramColumn if set.
063:             * optional.  Either this or paramColumn must be set if param is used.
064:             * Will be ignored if param not used
065:             */
066:            protected String _paramValue = null;
067:
068:            /**
069:             * the target frame to open in. Optional
070:             */
071:            protected String _target = null;
072:
073:            /**
074:             * the title attribute this link belongs to. Optional
075:             */
076:            protected String _title = null;
077:
078:            /**
079:             * additional parameters after the above parameter is generated. Optional
080:             */
081:            protected String _trailParams = null;
082:
083:            /**
084:             * if used the param value will be taken from another column in the table.  Useful if each row
085:             * needs a different paramter.  The paramter can be taken from a hidden cell.
086:             * if paramValue is also set it will overrid this.  (option either this or paramValue must be set
087:             * if param is used. Will be ignored if param not used
088:             */
089:            protected int _paramColumn = -1;
090:
091:            public LinkCellRenderer() {
092:            }
093:
094:            /**
095:             * should the link data be encodeed?
096:             */
097:            public String getCellValue(WebTable table, Object data, int row,
098:                    int col) {
099:                String value = _delegateRenderer.renderCell(table, data, row,
100:                        col);
101:
102:                StringBuffer cell = new StringBuffer(256);
103:                cell.append("<a href='").append(_link);
104:
105:                if (_param != null) {
106:                    cell.append("?").append(_param).append("=");
107:
108:                    if (_paramValue != null) {
109:                        cell.append(_paramValue);
110:                    } else if (_paramColumn >= 0) {
111:                        cell.append(table.getModel().getValueAt(row,
112:                                _paramColumn).toString());
113:                    }
114:                }
115:
116:                if ((_trailParams != null) && !"".equals(_trailParams)) {
117:                    if (_param == null) {
118:                        cell.append("?");
119:                    } else {
120:                        cell.append("&");
121:                    }
122:
123:                    cell.append(_trailParams);
124:                }
125:
126:                cell.append("'");
127:
128:                if ((_target != null) && (!"".equals(_target))) {
129:                    cell.append(" target='").append(_target).append("'");
130:                }
131:
132:                if ((_cssClass != null) && (!"".equals(_cssClass))) {
133:                    cell.append(" class='").append(_cssClass).append("'");
134:                }
135:
136:                if ((_cssId != null) && (!"".equals(_cssId))) {
137:                    cell.append(" id='").append(_cssId).append("'");
138:                }
139:
140:                if ((_title != null) && (!"".equals(_title))) {
141:                    cell.append(" title='").append(_title).append("'");
142:                }
143:
144:                if ((_onclick != null) && (!"".equals(_onclick))) {
145:                    cell.append(" onclick='").append(_onclick).append("'");
146:                }
147:
148:                if ((_ondblclick != null) && (!"".equals(_ondblclick))) {
149:                    cell.append(" ondblclick='").append(_ondblclick)
150:                            .append("'");
151:                }
152:
153:                if ((_onmouseover != null) && (!"".equals(_onmouseover))) {
154:                    cell.append(" onmouseover='").append(_onmouseover).append(
155:                            "'");
156:                }
157:
158:                if ((_onmouseout != null) && (!"".equals(_onmouseout))) {
159:                    cell.append(" onmouseout='").append(_onmouseout)
160:                            .append("'");
161:                }
162:
163:                cell.append(">").append(value).append("</a>");
164:
165:                return cell.toString();
166:            }
167:
168:            public void setCssClass(String cssClass) {
169:                _cssClass = cssClass;
170:            }
171:
172:            public void setCssId(String cssId) {
173:                _cssId = cssId;
174:            }
175:
176:            public void setLink(String link) {
177:                _link = link;
178:            }
179:
180:            public void setOnclick(String onclick) {
181:                _onclick = onclick;
182:            }
183:
184:            public void setOndblclick(String ondblclick) {
185:                _ondblclick = ondblclick;
186:            }
187:
188:            public void setOnmouseout(String onmouseout) {
189:                _onmouseout = onmouseout;
190:            }
191:
192:            public void setOnmouseover(String onmouseover) {
193:                _onmouseover = onmouseover;
194:            }
195:
196:            public void setParam(String param) {
197:                _param = param;
198:            }
199:
200:            public void setParamColumn(int paramColumn) {
201:                _paramColumn = paramColumn;
202:            }
203:
204:            public void setParamValue(String paramValue) {
205:                _paramValue = paramValue;
206:            }
207:
208:            /**
209:             * used to set the renderer to delgate to.
210:             * if the render is an AbstractCellRenderer then it will take the alignment from
211:             * the delegate renderer and set it that way.
212:             */
213:            public void setRenderer(CellRenderer delegateRenderer) {
214:                _delegateRenderer = delegateRenderer;
215:
216:                if (_delegateRenderer instanceof  AbstractCellRenderer) {
217:                    setAlignment(((AbstractCellRenderer) _delegateRenderer)
218:                            .getAlignment());
219:                }
220:            }
221:
222:            public void setTarget(String target) {
223:                _target = target;
224:            }
225:
226:            public void setTitle(String title) {
227:                _title = title;
228:            }
229:
230:            public void setTrailParams(String trailParams) {
231:                _trailParams = trailParams;
232:            }
233:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.