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.base;
029:
030: import java.io.Serializable;
031:
032: import net.sf.jasperreports.engine.JRConstants;
033: import net.sf.jasperreports.engine.JRHyperlink;
034: import net.sf.jasperreports.engine.JRHyperlinkHelper;
035: import net.sf.jasperreports.engine.JRPrintHyperlink;
036: import net.sf.jasperreports.engine.JRPrintHyperlinkParameter;
037: import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;
038:
039: /**
040: * Stand-alone implementation of {@link JRPrintHyperlink JRPrintHyperlink}.
041: *
042: * @author Lucian Chirita (lucianc@users.sourceforge.net)
043: * @version $Id: JRBasePrintHyperlink.java 1364 2006-08-31 15:13:20Z lucianc $
044: */
045: public class JRBasePrintHyperlink implements JRPrintHyperlink,
046: Serializable {
047:
048: private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;
049:
050: private String linkType;
051: private byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF;
052: private String hyperlinkReference;
053: private String hyperlinkAnchor;
054: private Integer hyperlinkPage;
055: private String hyperlinkTooltip;
056: private JRPrintHyperlinkParameters hyperlinkParameters;
057:
058: /**
059: * Creates a blank hyperlink.
060: */
061: public JRBasePrintHyperlink() {
062: }
063:
064: public String getHyperlinkAnchor() {
065: return hyperlinkAnchor;
066: }
067:
068: public Integer getHyperlinkPage() {
069: return hyperlinkPage;
070: }
071:
072: public JRPrintHyperlinkParameters getHyperlinkParameters() {
073: return hyperlinkParameters;
074: }
075:
076: public String getHyperlinkReference() {
077: return hyperlinkReference;
078: }
079:
080: public byte getHyperlinkTarget() {
081: return hyperlinkTarget;
082: }
083:
084: public byte getHyperlinkType() {
085: return JRHyperlinkHelper.getHyperlinkType(getLinkType());
086: }
087:
088: public String getLinkType() {
089: return linkType;
090: }
091:
092: public void setHyperlinkAnchor(String hyperlinkAnchor) {
093: this .hyperlinkAnchor = hyperlinkAnchor;
094: }
095:
096: public void setHyperlinkPage(Integer hyperlinkPage) {
097: this .hyperlinkPage = hyperlinkPage;
098: }
099:
100: public void setHyperlinkParameters(
101: JRPrintHyperlinkParameters parameters) {
102: this .hyperlinkParameters = parameters;
103: }
104:
105: public void setHyperlinkReference(String hyperlinkReference) {
106: this .hyperlinkReference = hyperlinkReference;
107: }
108:
109: public void setHyperlinkTarget(byte hyperlinkTarget) {
110: this .hyperlinkTarget = hyperlinkTarget;
111: }
112:
113: public void setHyperlinkType(byte hyperlinkType) {
114: setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
115: }
116:
117: public void setLinkType(String type) {
118: this .linkType = type;
119: }
120:
121: /**
122: * Adds a custom hyperlink parameter.
123: *
124: * @param parameter the parameter to add
125: * @see #getHyperlinkParameters()
126: * @see JRPrintHyperlinkParameters#addParameter(JRPrintHyperlinkParameter)
127: */
128: public void addHyperlinkParameter(
129: JRPrintHyperlinkParameter parameter) {
130: if (hyperlinkParameters == null) {
131: hyperlinkParameters = new JRPrintHyperlinkParameters();
132: }
133: hyperlinkParameters.addParameter(parameter);
134: }
135:
136: public String getHyperlinkTooltip() {
137: return hyperlinkTooltip;
138: }
139:
140: public void setHyperlinkTooltip(String hyperlinkTooltip) {
141: this.hyperlinkTooltip = hyperlinkTooltip;
142: }
143:
144: }
|