Source Code Cross Referenced for LinkCellRenderer.java in  » Web-Framework » struts-2.0.11 » org » apache » struts2 » 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 » Web Framework » struts 2.0.11 » org.apache.struts2.components.table.renderer 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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