KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > JRHyperlink


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * JasperSoft Corporation
24  * 303 Second Street, Suite 450 North
25  * San Francisco, CA 94107
26  * http://www.jaspersoft.com
27  */

28 package net.sf.jasperreports.engine;
29
30
31 /**
32  * An interface providing hyperlink functionality. It must be implemented by elements that can contain hyperlinks.
33  *
34  * There are three types of hyperlinks: reference, anchor and page. The reference type just points to an external resource.
35  * The anchor type can point to an anchor in the current document or inside an external referenced document. In the latter
36  * case, users have to specify both an anchor expression and a reference expression. The page type can point to the
37  * beginning of a specific page in the current document or an external document (in the same way that anchor type does).
38  *
39  * @see JRAnchor
40  * @author Teodor Danciu (teodord@users.sourceforge.net)
41  * @version $Id: JRHyperlink.java 1364 2006-08-31 18:13:20 +0300 (Thu, 31 Aug 2006) lucianc $
42  */

43 public interface JRHyperlink
44 {
45
46
47     /**
48      * Constant useful for specifying that the element does not contain a hyperlink. This is the default value
49      * for a hyperlink type.
50      */

51     public static final byte HYPERLINK_TYPE_NONE = 1;
52
53     /**
54      * Constant useful for specifying that the hyperlink points to an external resource specified by the
55      * hyperlink reference expression.
56      * @see JRHyperlink#getHyperlinkReferenceExpression()
57      */

58     public static final byte HYPERLINK_TYPE_REFERENCE = 2;
59
60     /**
61      * Constant useful for specifying that the hyperlink points to a local anchor, specified by the hyperlink
62      * anchor expression.
63      * @see JRHyperlink#getHyperlinkAnchorExpression()
64      */

65     public static final byte HYPERLINK_TYPE_LOCAL_ANCHOR = 3;
66
67     /**
68      * Constant useful for specifying that the hyperlink points to a 1 based page index within the current document.
69      */

70     public static final byte HYPERLINK_TYPE_LOCAL_PAGE = 4;
71
72     /**
73      * Constant useful for specifying that the hyperlink points to a remote anchor (specified by the hyperlink
74      * anchor expression) within an external document (specified by the hyperlink reference expression).
75      * @see JRHyperlink#getHyperlinkAnchorExpression()
76      * @see JRHyperlink#getHyperlinkReferenceExpression()
77      */

78     public static final byte HYPERLINK_TYPE_REMOTE_ANCHOR = 5;
79
80     /**
81      * Constant useful for specifying that the hyperlink points to a 1 based page index within an external document
82      * (specified by the hyperlink reference expression).
83      */

84     public static final byte HYPERLINK_TYPE_REMOTE_PAGE = 6;
85
86     
87     /**
88      * Not set hyperlink type.
89      */

90     public static final byte HYPERLINK_TYPE_NULL = 0;
91     
92     
93     /**
94      * Custom hyperlink type.
95      * <p>
96      * The specific type is determined by {@link #getLinkType() getLinkType()}.
97      * </p>
98      */

99     public static final byte HYPERLINK_TYPE_CUSTOM = 7;
100
101
102     /**
103      * Constant useful for specifying that the hyperlink will be opened in the same window.
104      */

105     public static final byte HYPERLINK_TARGET_SELF = 1;
106
107     /**
108      * Constant useful for specifying that the hyperlink will be opened in a new window.
109      */

110     public static final byte HYPERLINK_TARGET_BLANK = 2;
111
112
113     /**
114      * Retrieves the hyperlink type for the element.
115      * <p>
116      * The actual hyperlink type is determined by {@link #getLinkType() getLinkType()}.
117      * This method can is used to determine whether the hyperlink type is one of the
118      * built-in types or a custom type.
119      * When hyperlink is of custom type, {@link #HYPERLINK_TYPE_CUSTOM HYPERLINK_TYPE_CUSTOM} is returned.
120      * </p>
121      * @return one of the hyperlink type constants
122      * @see #getLinkType()
123      */

124     public byte getHyperlinkType();
125
126
127     /**
128      * Retrieves the hyperlink target for the element.
129      * @return one of the hyperlink target constants
130      */

131     public byte getHyperlinkTarget();
132
133
134     /**
135      * Returns the expression whose value represents the hyperlink reference. It is only used when the hyperlink type is
136      * reference or anchor
137      */

138     public JRExpression getHyperlinkReferenceExpression();
139
140
141     /**
142      * Returns the expression whose value represents the anchor. It is only used when the hyperlink type is anchor.
143      */

144     public JRExpression getHyperlinkAnchorExpression();
145
146
147     /**
148      * Returns an integer representing the page index of the link. It is only used when the hyperlink type is page.
149      * If the expression does not evaluate to an integer, an exception will be thrown.
150      */

151     public JRExpression getHyperlinkPageExpression();
152
153     
154     /**
155      * Returns the hyperlink type.
156      * <p>
157      * The type can be one of the built-in types
158      * (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage),
159      * or can be an arbitrary type.
160      * </p>
161      * @return the hyperlink type
162      */

163     public String JavaDoc getLinkType();
164     
165     
166     /**
167      * Returns the list of hyperlink parameters.
168      * <p>
169      * The parameters can be used by custom hyperlink types to generate
170      * dynamic links.
171      * </p>
172      * @return the list of hyperlink parameters
173      */

174     public JRHyperlinkParameter[] getHyperlinkParameters();
175     
176     
177     /**
178      * Returns the expression which will generate the hyperlink tooltip.
179      *
180      * @return the expression which will generate the hyperlink tooltip
181      */

182     public JRExpression getHyperlinkTooltipExpression();
183
184 }
185
Popular Tags