Source Code Cross Referenced for AbstractRenderableColumn.java in  » J2EE » wicket » org » apache » wicket » extensions » markup » html » tree » table » 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 » wicket » org.apache.wicket.extensions.markup.html.tree.table 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.wicket.extensions.markup.html.tree.table;
018:
019:        import javax.swing.tree.TreeNode;
020:
021:        import org.apache.wicket.Component;
022:        import org.apache.wicket.MarkupContainer;
023:        import org.apache.wicket.Response;
024:        import org.apache.wicket.util.string.Strings;
025:
026:        /**
027:         * Convenience class for creating non-interactive lightweight (IRenderable
028:         * based) columns.
029:         * 
030:         * @author Matej Knopp
031:         */
032:        public abstract class AbstractRenderableColumn extends AbstractColumn {
033:            private boolean contentAsTooltip = false;
034:
035:            private boolean escapeContent = true;
036:
037:            /**
038:             * Creates the column
039:             * 
040:             * @param location
041:             *            Specifies how the column should be aligned and what his size
042:             *            should be
043:             * 
044:             * @param header
045:             *            Header caption
046:             */
047:            public AbstractRenderableColumn(ColumnLocation location,
048:                    String header) {
049:                super (location, header);
050:            }
051:
052:            /**
053:             * Returns the string value for the provided node.
054:             * 
055:             * @param node
056:             *            Determines the position in tree
057:             * @return The
058:             */
059:            public abstract String getNodeValue(TreeNode node);
060:
061:            /**
062:             * Returns whether the content should also be visible as tooltip of the
063:             * cell.
064:             * 
065:             * @return whether the content should also be visible as tooltip
066:             */
067:            public boolean isContentAsTooltip() {
068:                return contentAsTooltip;
069:            }
070:
071:            /**
072:             * Returns whether the special html characters of content will be escaped.
073:             * 
074:             * @return Whether html characters should be escaped
075:             */
076:            public boolean isEscapeContent() {
077:                return escapeContent;
078:            }
079:
080:            /**
081:             * @see IColumn#newCell(MarkupContainer, String, TreeNode, int)
082:             */
083:            public Component newCell(MarkupContainer parent, String id,
084:                    TreeNode node, int level) {
085:                return null;
086:            }
087:
088:            /**
089:             * @see IColumn#newCell(TreeNode, int)
090:             */
091:            public IRenderable newCell(TreeNode node, int level) {
092:                return new IRenderable() {
093:                    private static final long serialVersionUID = 1L;
094:
095:                    public void render(TreeNode node, Response response) {
096:                        String content = getNodeValue(node);
097:
098:                        // escape if necessary
099:                        if (isEscapeContent()) {
100:                            content = Strings.escapeMarkup(content).toString();
101:                        }
102:
103:                        response.write("<span");
104:                        if (isContentAsTooltip()) {
105:                            response.write(" title=\"" + content + "\"");
106:                        }
107:                        response.write(">");
108:                        response.write(content);
109:                        response.write("</span>");
110:                    }
111:                };
112:            }
113:
114:            /**
115:             * Sets whether the content should also be visible as tooltip (html title
116:             * attribute) of the cell.
117:             * 
118:             * @param contentAsTooltip
119:             *            whether the content should also be visible as tooltip
120:             */
121:            public void setContentAsTooltip(boolean contentAsTooltip) {
122:                this .contentAsTooltip = contentAsTooltip;
123:            }
124:
125:            /**
126:             * Sets whether the special html characters of content should be escaped.
127:             * 
128:             * @param escapeContent
129:             *            Whether to espcape html characters
130:             */
131:            public void setEscapeContent(boolean escapeContent) {
132:                this.escapeContent = escapeContent;
133:            }
134:        }
w__ww_._j__ava__2___s___._c_o_m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.