Source Code Cross Referenced for JRHyperlinkHelper.java in  » Report » jasperreports-2.0.1 » net » sf » jasperreports » engine » 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 » Report » jasperreports 2.0.1 » net.sf.jasperreports.engine 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ============================================================================
003:         * GNU Lesser General Public License
004:         * ============================================================================
005:         *
006:         * JasperReports - Free Java report-generating library.
007:         * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
008:         * 
009:         * This library is free software; you can redistribute it and/or
010:         * modify it under the terms of the GNU Lesser General Public
011:         * License as published by the Free Software Foundation; either
012:         * version 2.1 of the License, or (at your option) any later version.
013:         * 
014:         * This library is distributed in the hope that it will be useful,
015:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
016:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
017:         * Lesser General Public License for more details.
018:         * 
019:         * You should have received a copy of the GNU Lesser General Public
020:         * License along with this library; if not, write to the Free Software
021:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
022:         * 
023:         * JasperSoft Corporation
024:         * 303 Second Street, Suite 450 North
025:         * San Francisco, CA 94107
026:         * http://www.jaspersoft.com
027:         */
028:        package net.sf.jasperreports.engine;
029:
030:        import java.util.HashMap;
031:        import java.util.Map;
032:
033:        /**
034:         * Utility class that manages built-in hyperlink types.
035:         * 
036:         * @author Lucian Chirita (lucianc@users.sourceforge.net)
037:         * @version $Id: JRHyperlinkHelper.java 1720 2007-05-07 10:02:56Z lucianc $
038:         */
039:        public class JRHyperlinkHelper {
040:            /**
041:             * "None" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_NONE JRHyperlink.HYPERLINK_TYPE_NONE}.
042:             */
043:            public static final String HYPERLINK_TYPE_NONE = "None";
044:
045:            /**
046:             * "Reference" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_REFERENCE JRHyperlink.HYPERLINK_TYPE_REFERENCE}.
047:             */
048:            public static final String HYPERLINK_TYPE_REFERENCE = "Reference";
049:
050:            /**
051:             * "LocalAnchor" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_LOCAL_ANCHOR JRHyperlink.HYPERLINK_LOCAL_ANCHOR}.
052:             */
053:            public static final String HYPERLINK_TYPE_LOCAL_ANCHOR = "LocalAnchor";
054:
055:            /**
056:             * "LocalPage" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_LOCAL_PAGE JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE}.
057:             */
058:            public static final String HYPERLINK_TYPE_LOCAL_PAGE = "LocalPage";
059:
060:            /**
061:             * "RemoteAnchor" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_REMOTE_ANCHOR JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR}.
062:             */
063:            public static final String HYPERLINK_TYPE_REMOTE_ANCHOR = "RemoteAnchor";
064:
065:            /**
066:             * "RemotePage" link type, equivalent to {@link JRHyperlink#HYPERLINK_TYPE_REMOTE_PAGE JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE}.
067:             */
068:            public static final String HYPERLINK_TYPE_REMOTE_PAGE = "RemotePage";
069:
070:            private static final Map builtinTypes;
071:
072:            static {
073:                builtinTypes = createBuiltinTypes();
074:            }
075:
076:            private static Map createBuiltinTypes() {
077:                Map types = new HashMap();
078:                types.put(HYPERLINK_TYPE_NONE, new Byte(
079:                        JRHyperlink.HYPERLINK_TYPE_NONE));
080:                types.put(HYPERLINK_TYPE_REFERENCE, new Byte(
081:                        JRHyperlink.HYPERLINK_TYPE_REFERENCE));
082:                types.put(HYPERLINK_TYPE_LOCAL_ANCHOR, new Byte(
083:                        JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR));
084:                types.put(HYPERLINK_TYPE_LOCAL_PAGE, new Byte(
085:                        JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE));
086:                types.put(HYPERLINK_TYPE_REMOTE_ANCHOR, new Byte(
087:                        JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR));
088:                types.put(HYPERLINK_TYPE_REMOTE_PAGE, new Byte(
089:                        JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE));
090:                return types;
091:            }
092:
093:            /**
094:             * Returns the built-in hyperlink type, or {@link JRHyperlink#HYPERLINK_TYPE_CUSTOM JRHyperlink.HYPERLINK_TYPE_CUSTOM}
095:             * if the type is not a built-in type.
096:             * 
097:             * @param hyperlink the hyperlink object
098:             * @return the hyperlink type
099:             */
100:            public static byte getHyperlinkType(JRHyperlink hyperlink) {
101:                return getHyperlinkType(hyperlink.getLinkType());
102:            }
103:
104:            /**
105:             * Returns the built-in hyperlink type, or {@link JRHyperlink#HYPERLINK_TYPE_CUSTOM JRHyperlink.HYPERLINK_TYPE_CUSTOM}
106:             * if the type is not a built-in type.
107:             * 
108:             * @param linkType the link type
109:             * @return the hyperlink type
110:             */
111:            public static byte getHyperlinkType(String linkType) {
112:                byte type;
113:                if (linkType == null) {
114:                    type = JRHyperlink.HYPERLINK_TYPE_NONE;
115:                } else {
116:                    Byte builtinType = (Byte) builtinTypes.get(linkType);
117:                    if (builtinType == null) {
118:                        type = JRHyperlink.HYPERLINK_TYPE_CUSTOM;
119:                    } else {
120:                        type = builtinType.byteValue();
121:                    }
122:                }
123:                return type;
124:            }
125:
126:            /**
127:             * Returns the link type associated with a built-in type.
128:             * 
129:             * @param hyperlinkType the built-in type
130:             * @return the String link type
131:             */
132:            public static String getLinkType(byte hyperlinkType) {
133:                String type;
134:                switch (hyperlinkType) {
135:                case JRHyperlink.HYPERLINK_TYPE_NULL:
136:                case JRHyperlink.HYPERLINK_TYPE_NONE:
137:                    type = null;
138:                    break;
139:                case JRHyperlink.HYPERLINK_TYPE_REFERENCE:
140:                    type = HYPERLINK_TYPE_REFERENCE;
141:                    break;
142:                case JRHyperlink.HYPERLINK_TYPE_LOCAL_ANCHOR:
143:                    type = HYPERLINK_TYPE_LOCAL_ANCHOR;
144:                    break;
145:                case JRHyperlink.HYPERLINK_TYPE_LOCAL_PAGE:
146:                    type = HYPERLINK_TYPE_LOCAL_PAGE;
147:                    break;
148:                case JRHyperlink.HYPERLINK_TYPE_REMOTE_ANCHOR:
149:                    type = HYPERLINK_TYPE_REMOTE_ANCHOR;
150:                    break;
151:                case JRHyperlink.HYPERLINK_TYPE_REMOTE_PAGE:
152:                    type = HYPERLINK_TYPE_REMOTE_PAGE;
153:                    break;
154:                case JRHyperlink.HYPERLINK_TYPE_CUSTOM:
155:                    throw new JRRuntimeException(
156:                            "Custom hyperlink types cannot be specified using the byte constant");
157:                default:
158:                    throw new JRRuntimeException("Unknown hyperlink type "
159:                            + hyperlinkType);
160:                }
161:                return type;
162:            }
163:
164:            /**
165:             * Decides whether a hyperlink is empty or not.
166:             * <p>
167:             * The hyperlink is considered empty when it's <code>null</code> or when
168:             * its type is {@link JRHyperlink#HYPERLINK_TYPE_NONE HYPERLINK_TYPE_NONE}
169:             * and it doesn't include a tooltip expression
170:             * </p>
171:             * @param hyperlink the hyperlink
172:             * @return whether the hyperlink is empty
173:             */
174:            public static boolean isEmpty(JRHyperlink hyperlink) {
175:                return hyperlink == null
176:                        || (hyperlink.getHyperlinkType() == JRHyperlink.HYPERLINK_TYPE_NONE && hyperlink
177:                                .getHyperlinkTooltipExpression() == null);
178:            }
179:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.