1 28 package net.sf.jasperreports.engine.design; 29 30 import java.util.ArrayList ; 31 import java.util.Iterator ; 32 import java.util.List ; 33 34 import net.sf.jasperreports.engine.JRConstants; 35 import net.sf.jasperreports.engine.JRExpression; 36 import net.sf.jasperreports.engine.JRHyperlink; 37 import net.sf.jasperreports.engine.JRHyperlinkHelper; 38 import net.sf.jasperreports.engine.JRHyperlinkParameter; 39 import net.sf.jasperreports.engine.base.JRBaseHyperlink; 40 41 42 49 public class JRDesignHyperlink extends JRBaseHyperlink 50 { 51 52 private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID; 53 54 private List hyperlinkParameters; 55 56 public JRDesignHyperlink() 57 { 58 hyperlinkParameters = new ArrayList (); 59 } 60 61 62 68 public void setHyperlinkType(byte hyperlinkType) 69 { 70 setLinkType(JRHyperlinkHelper.getLinkType(hyperlinkType)); 71 } 72 73 74 84 public void setHyperlinkTarget(byte hyperlinkTarget) 85 { 86 this.hyperlinkTarget = hyperlinkTarget; 87 } 88 89 90 104 public void setHyperlinkReferenceExpression(JRExpression hyperlinkReferenceExpression) 105 { 106 this.hyperlinkReferenceExpression = hyperlinkReferenceExpression; 107 } 108 109 110 122 public void setHyperlinkAnchorExpression(JRExpression hyperlinkAnchorExpression) 123 { 124 this.hyperlinkAnchorExpression = hyperlinkAnchorExpression; 125 } 126 127 128 140 public void setHyperlinkPageExpression(JRExpression hyperlinkPageExpression) 141 { 142 this.hyperlinkPageExpression = hyperlinkPageExpression; 143 } 144 145 146 155 public void setLinkType(String type) 156 { 157 this.linkType = type; 158 } 159 160 161 public JRHyperlinkParameter[] getHyperlinkParameters() 162 { 163 JRHyperlinkParameter[] parameters; 164 if (hyperlinkParameters.isEmpty()) 165 { 166 parameters = null; 167 } 168 else 169 { 170 parameters = new JRHyperlinkParameter[hyperlinkParameters.size()]; 171 hyperlinkParameters.toArray(parameters); 172 } 173 return parameters; 174 } 175 176 177 182 public List getHyperlinkParametersList() 183 { 184 return hyperlinkParameters; 185 } 186 187 188 193 public void addHyperlinkParameter(JRHyperlinkParameter parameter) 194 { 195 hyperlinkParameters.add(parameter); 196 } 197 198 199 204 public void removeHyperlinkParameter(JRHyperlinkParameter parameter) 205 { 206 hyperlinkParameters.remove(parameter); 207 } 208 209 210 219 public void removeHyperlinkParameter(String parameterName) 220 { 221 for (Iterator it = hyperlinkParameters.iterator(); it.hasNext();) 222 { 223 JRHyperlinkParameter parameter = (JRHyperlinkParameter) it.next(); 224 if (parameter.getName() != null && parameter.getName().equals(parameterName)) 225 { 226 it.remove(); 227 } 228 } 229 } 230 231 232 239 public void setHyperlinkTooltipExpression(JRExpression hyperlinkTooltipExpression) 240 { 241 this.hyperlinkTooltipExpression = hyperlinkTooltipExpression; 242 } 243 244 } 245 | Popular Tags |