package net.sf.jasperreports.engine.base;

import java.io.Serializable;
import net.sf.jasperreports.engine.JRHyperlinkHelper;
import net.sf.jasperreports.engine.JRPrintHyperlink;
import net.sf.jasperreports.engine.JRPrintHyperlinkParameter;
import net.sf.jasperreports.engine.JRPrintHyperlinkParameters;

public class JRBasePrintHyperlink implements JRPrintHyperlink, Serializable {
  private static final long serialVersionUID = 10200L;
  
  private String linkType;
  
  private byte hyperlinkTarget = 1;
  
  private String hyperlinkReference;
  
  private String hyperlinkAnchor;
  
  private Integer hyperlinkPage;
  
  private String hyperlinkTooltip;
  
  private JRPrintHyperlinkParameters hyperlinkParameters;
  
  public String getHyperlinkAnchor() {
    return this.hyperlinkAnchor;
  }
  
  public Integer getHyperlinkPage() {
    return this.hyperlinkPage;
  }
  
  public JRPrintHyperlinkParameters getHyperlinkParameters() {
    return this.hyperlinkParameters;
  }
  
  public String getHyperlinkReference() {
    return this.hyperlinkReference;
  }
  
  public byte getHyperlinkTarget() {
    return this.hyperlinkTarget;
  }
  
  public byte getHyperlinkType() {
    return JRHyperlinkHelper.getHyperlinkType(getLinkType());
  }
  
  public String getLinkType() {
    return this.linkType;
  }
  
  public void setHyperlinkAnchor(String hyperlinkAnchor) {
    this.hyperlinkAnchor = hyperlinkAnchor;
  }
  
  public void setHyperlinkPage(Integer hyperlinkPage) {
    this.hyperlinkPage = hyperlinkPage;
  }
  
  public void setHyperlinkParameters(JRPrintHyperlinkParameters parameters) {
    this.hyperlinkParameters = parameters;
  }
  
  public void setHyperlinkReference(String hyperlinkReference) {
    this.hyperlinkReference = hyperlinkReference;
  }
  
  public void setHyperlinkTarget(byte hyperlinkTarget) {
    this.hyperlinkTarget = hyperlinkTarget;
  }
  
  public void setHyperlinkType(byte hyperlinkType) {
    setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType));
  }
  
  public void setLinkType(String type) {
    this.linkType = type;
  }
  
  public void addHyperlinkParameter(JRPrintHyperlinkParameter parameter) {
    if (this.hyperlinkParameters == null)
      this.hyperlinkParameters = new JRPrintHyperlinkParameters(); 
    this.hyperlinkParameters.addParameter(parameter);
  }
  
  public String getHyperlinkTooltip() {
    return this.hyperlinkTooltip;
  }
  
  public void setHyperlinkTooltip(String hyperlinkTooltip) {
    this.hyperlinkTooltip = hyperlinkTooltip;
  }
}
