32 lines
1.0 KiB
Java
32 lines
1.0 KiB
Java
package net.sf.jasperreports.charts.util;
|
|
|
|
import java.util.List;
|
|
import net.sf.jasperreports.engine.JRPrintHyperlink;
|
|
import org.jfree.chart.entity.ChartEntity;
|
|
import org.jfree.chart.entity.XYItemEntity;
|
|
|
|
public class HighLowChartHyperlinkProvider implements ChartHyperlinkProvider {
|
|
private static final long serialVersionUID = 10200L;
|
|
|
|
private List itemHyperlinks;
|
|
|
|
public HighLowChartHyperlinkProvider(List itemHyperlinks) {
|
|
this.itemHyperlinks = itemHyperlinks;
|
|
}
|
|
|
|
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity) {
|
|
JRPrintHyperlink printHyperlink = null;
|
|
if (hasHyperlinks() && entity instanceof XYItemEntity) {
|
|
XYItemEntity itemEntity = (XYItemEntity)entity;
|
|
int item = itemEntity.getItem();
|
|
if (item >= 0 && item < this.itemHyperlinks.size())
|
|
printHyperlink = this.itemHyperlinks.get(item);
|
|
}
|
|
return printHyperlink;
|
|
}
|
|
|
|
public boolean hasHyperlinks() {
|
|
return (this.itemHyperlinks != null && this.itemHyperlinks.size() > 0);
|
|
}
|
|
}
|