KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > base > JRBasePrintHyperlink


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.base;
29
30 import java.io.Serializable JavaDoc;
31
32 import net.sf.jasperreports.engine.JRConstants;
33 import net.sf.jasperreports.engine.JRHyperlink;
34 import net.sf.jasperreports.engine.JRHyperlinkHelper;
35 import net.sf.jasperreports.engine.JRPrintHyperlink;
36 import net.sf.jasperreports.engine.JRPrintHyperlinkParameter;
37 import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
38
39
40 /**
41  * Stand-alone implementation of {@link JRPrintHyperlink JRPrintHyperlink}.
42  *
43  * @author Lucian Chirita (lucianc@users.sourceforge.net)
44  * @version $Id: JRBasePrintHyperlink.java 1364 2006-08-31 18:13:20 +0300 (Thu, 31 Aug 2006) lucianc $
45  */

46 public class JRBasePrintHyperlink implements JRPrintHyperlink, Serializable JavaDoc
47 {
48     
49     private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
50     
51     private String JavaDoc linkType;
52     private byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF;
53     private String JavaDoc hyperlinkReference;
54     private String JavaDoc hyperlinkAnchor;
55     private Integer JavaDoc hyperlinkPage;
56     private String JavaDoc hyperlinkTooltip;
57     private JRPrintHyperlinkParameters hyperlinkParameters;
58
59     
60     /**
61      * Creates a blank hyperlink.
62      */

63     public JRBasePrintHyperlink()
64     {
65     }
66     
67     public String JavaDoc getHyperlinkAnchor()
68     {
69         return hyperlinkAnchor;
70     }
71
72     public Integer JavaDoc getHyperlinkPage()
73     {
74         return hyperlinkPage;
75     }
76
77     public JRPrintHyperlinkParameters getHyperlinkParameters()
78     {
79         return hyperlinkParameters;
80     }
81
82     public String JavaDoc getHyperlinkReference()
83     {
84         return hyperlinkReference;
85     }
86
87     public byte getHyperlinkTarget()
88     {
89         return hyperlinkTarget;
90     }
91
92     public byte getHyperlinkType()
93     {
94         return JRHyperlinkHelper.getHyperlinkType(getLinkType());
95     }
96
97     public String JavaDoc getLinkType()
98     {
99         return linkType;
100     }
101
102     public void setHyperlinkAnchor(String JavaDoc hyperlinkAnchor)
103     {
104         this.hyperlinkAnchor = hyperlinkAnchor;
105     }
106
107     public void setHyperlinkPage(Integer JavaDoc hyperlinkPage)
108     {
109         this.hyperlinkPage = hyperlinkPage;
110     }
111
112     public void setHyperlinkParameters(JRPrintHyperlinkParameters parameters)
113     {
114         this.hyperlinkParameters = parameters;
115     }
116
117     public void setHyperlinkReference(String JavaDoc hyperlinkReference)
118     {
119         this.hyperlinkReference = hyperlinkReference;
120     }
121
122     public void setHyperlinkTarget(byte hyperlinkTarget)
123     {
124         this.hyperlinkTarget = hyperlinkTarget;
125     }
126
127     public void setHyperlinkType(byte hyperlinkType)
128     {
129         setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
130     }
131
132     public void setLinkType(String JavaDoc type)
133     {
134         this.linkType = type;
135     }
136
137     
138     /**
139      * Adds a custom hyperlink parameter.
140      *
141      * @param parameter the parameter to add
142      * @see #getHyperlinkParameters()
143      * @see JRPrintHyperlinkParameters#addParameter(JRPrintHyperlinkParameter)
144      */

145     public void addHyperlinkParameter(JRPrintHyperlinkParameter parameter)
146     {
147         if (hyperlinkParameters == null)
148         {
149             hyperlinkParameters = new JRPrintHyperlinkParameters();
150         }
151         hyperlinkParameters.addParameter(parameter);
152     }
153
154     
155     public String JavaDoc getHyperlinkTooltip()
156     {
157         return hyperlinkTooltip;
158     }
159
160     
161     public void setHyperlinkTooltip(String JavaDoc hyperlinkTooltip)
162     {
163         this.hyperlinkTooltip = hyperlinkTooltip;
164     }
165
166 }
167
Popular Tags