1 28 package net.sf.jasperreports.engine.base; 29 30 import java.io.Serializable ; 31 32 import net.sf.jasperreports.engine.JRConstants; 33 import net.sf.jasperreports.engine.JRExpression; 34 import net.sf.jasperreports.engine.JRHyperlink; 35 import net.sf.jasperreports.engine.JRHyperlinkHelper; 36 import net.sf.jasperreports.engine.JRHyperlinkParameter; 37 38 44 public class JRBaseHyperlink implements JRHyperlink, Serializable 45 { 46 47 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 48 49 protected String linkType; 50 protected byte hyperlinkTarget = JRHyperlink.HYPERLINK_TARGET_SELF; 51 protected JRExpression hyperlinkReferenceExpression; 52 protected JRExpression hyperlinkAnchorExpression; 53 protected JRExpression hyperlinkPageExpression; 54 protected JRExpression hyperlinkTooltipExpression; 55 protected JRHyperlinkParameter[] hyperlinkParameters; 56 57 58 61 public JRBaseHyperlink() 62 { 63 } 64 65 66 protected JRBaseHyperlink(JRHyperlink link, JRBaseObjectFactory factory) 67 { 68 factory.put(link, this); 69 70 linkType = link.getLinkType(); 71 hyperlinkTarget = link.getHyperlinkTarget(); 72 hyperlinkReferenceExpression = factory.getExpression(link.getHyperlinkReferenceExpression()); 73 hyperlinkAnchorExpression = factory.getExpression(link.getHyperlinkAnchorExpression()); 74 hyperlinkPageExpression = factory.getExpression(link.getHyperlinkPageExpression()); 75 hyperlinkTooltipExpression = factory.getExpression(link.getHyperlinkTooltipExpression()); 76 hyperlinkParameters = copyHyperlinkParameters(link, factory); 77 } 78 79 public static JRHyperlinkParameter[] copyHyperlinkParameters(JRHyperlink link, JRBaseObjectFactory factory) 80 { 81 JRHyperlinkParameter[] linkParameters = link.getHyperlinkParameters(); 82 JRHyperlinkParameter[] parameters = null; 83 if (linkParameters != null && linkParameters.length > 0) 84 { 85 parameters = new JRHyperlinkParameter[linkParameters.length]; 86 for (int i = 0; i < linkParameters.length; i++) 87 { 88 JRHyperlinkParameter parameter = linkParameters[i]; 89 parameters[i] = factory.getHyperlinkParameter(parameter); 90 } 91 } 92 return parameters; 93 } 94 95 public JRExpression getHyperlinkAnchorExpression() 96 { 97 return hyperlinkAnchorExpression; 98 } 99 100 public JRExpression getHyperlinkPageExpression() 101 { 102 return hyperlinkPageExpression; 103 } 104 105 public JRHyperlinkParameter[] getHyperlinkParameters() 106 { 107 return hyperlinkParameters; 108 } 109 110 public JRExpression getHyperlinkReferenceExpression() 111 { 112 return hyperlinkReferenceExpression; 113 } 114 115 public byte getHyperlinkTarget() 116 { 117 return hyperlinkTarget; 118 } 119 120 public byte getHyperlinkType() 121 { 122 return JRHyperlinkHelper.getHyperlinkType(this); 123 } 124 125 public String getLinkType() 126 { 127 return linkType; 128 } 129 130 public JRExpression getHyperlinkTooltipExpression() 131 { 132 return hyperlinkTooltipExpression; 133 } 134 135 } 136 | Popular Tags |