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: /**
031: * An interface providing hyperlink functionality. It must be implemented by elements that can contain hyperlinks.
032: *
033: * There are three types of hyperlinks: reference, anchor and page. The reference type just points to an external resource.
034: * The anchor type can point to an anchor in the current document or inside an external referenced document. In the latter
035: * case, users have to specify both an anchor expression and a reference expression. The page type can point to the
036: * beginning of a specific page in the current document or an external document (in the same way that anchor type does).
037: *
038: * @see JRAnchor
039: * @author Teodor Danciu (teodord@users.sourceforge.net)
040: * @version $Id: JRHyperlink.java 1364 2006-08-31 15:13:20Z lucianc $
041: */
042: public interface JRHyperlink {
043:
044: /**
045: * Constant useful for specifying that the element does not contain a hyperlink. This is the default value
046: * for a hyperlink type.
047: */
048: public static final byte HYPERLINK_TYPE_NONE = 1;
049:
050: /**
051: * Constant useful for specifying that the hyperlink points to an external resource specified by the
052: * hyperlink reference expression.
053: * @see JRHyperlink#getHyperlinkReferenceExpression()
054: */
055: public static final byte HYPERLINK_TYPE_REFERENCE = 2;
056:
057: /**
058: * Constant useful for specifying that the hyperlink points to a local anchor, specified by the hyperlink
059: * anchor expression.
060: * @see JRHyperlink#getHyperlinkAnchorExpression()
061: */
062: public static final byte HYPERLINK_TYPE_LOCAL_ANCHOR = 3;
063:
064: /**
065: * Constant useful for specifying that the hyperlink points to a 1 based page index within the current document.
066: */
067: public static final byte HYPERLINK_TYPE_LOCAL_PAGE = 4;
068:
069: /**
070: * Constant useful for specifying that the hyperlink points to a remote anchor (specified by the hyperlink
071: * anchor expression) within an external document (specified by the hyperlink reference expression).
072: * @see JRHyperlink#getHyperlinkAnchorExpression()
073: * @see JRHyperlink#getHyperlinkReferenceExpression()
074: */
075: public static final byte HYPERLINK_TYPE_REMOTE_ANCHOR = 5;
076:
077: /**
078: * Constant useful for specifying that the hyperlink points to a 1 based page index within an external document
079: * (specified by the hyperlink reference expression).
080: */
081: public static final byte HYPERLINK_TYPE_REMOTE_PAGE = 6;
082:
083: /**
084: * Not set hyperlink type.
085: */
086: public static final byte HYPERLINK_TYPE_NULL = 0;
087:
088: /**
089: * Custom hyperlink type.
090: * <p>
091: * The specific type is determined by {@link #getLinkType() getLinkType()}.
092: * </p>
093: */
094: public static final byte HYPERLINK_TYPE_CUSTOM = 7;
095:
096: /**
097: * Constant useful for specifying that the hyperlink will be opened in the same window.
098: */
099: public static final byte HYPERLINK_TARGET_SELF = 1;
100:
101: /**
102: * Constant useful for specifying that the hyperlink will be opened in a new window.
103: */
104: public static final byte HYPERLINK_TARGET_BLANK = 2;
105:
106: /**
107: * Retrieves the hyperlink type for the element.
108: * <p>
109: * The actual hyperlink type is determined by {@link #getLinkType() getLinkType()}.
110: * This method can is used to determine whether the hyperlink type is one of the
111: * built-in types or a custom type.
112: * When hyperlink is of custom type, {@link #HYPERLINK_TYPE_CUSTOM HYPERLINK_TYPE_CUSTOM} is returned.
113: * </p>
114: * @return one of the hyperlink type constants
115: * @see #getLinkType()
116: */
117: public byte getHyperlinkType();
118:
119: /**
120: * Retrieves the hyperlink target for the element.
121: * @return one of the hyperlink target constants
122: */
123: public byte getHyperlinkTarget();
124:
125: /**
126: * Returns the expression whose value represents the hyperlink reference. It is only used when the hyperlink type is
127: * reference or anchor
128: */
129: public JRExpression getHyperlinkReferenceExpression();
130:
131: /**
132: * Returns the expression whose value represents the anchor. It is only used when the hyperlink type is anchor.
133: */
134: public JRExpression getHyperlinkAnchorExpression();
135:
136: /**
137: * Returns an integer representing the page index of the link. It is only used when the hyperlink type is page.
138: * If the expression does not evaluate to an integer, an exception will be thrown.
139: */
140: public JRExpression getHyperlinkPageExpression();
141:
142: /**
143: * Returns the hyperlink type.
144: * <p>
145: * The type can be one of the built-in types
146: * (Reference, LocalAnchor, LocalPage, RemoteAnchor, RemotePage),
147: * or can be an arbitrary type.
148: * </p>
149: * @return the hyperlink type
150: */
151: public String getLinkType();
152:
153: /**
154: * Returns the list of hyperlink parameters.
155: * <p>
156: * The parameters can be used by custom hyperlink types to generate
157: * dynamic links.
158: * </p>
159: * @return the list of hyperlink parameters
160: */
161: public JRHyperlinkParameter[] getHyperlinkParameters();
162:
163: /**
164: * Returns the expression which will generate the hyperlink tooltip.
165: *
166: * @return the expression which will generate the hyperlink tooltip
167: */
168: public JRExpression getHyperlinkTooltipExpression();
169:
170: }
|