30 lines
991 B
Java
30 lines
991 B
Java
package net.sf.jasperreports.charts.util;
|
|
|
|
import java.util.Map;
|
|
import net.sf.jasperreports.engine.JRPrintHyperlink;
|
|
import org.jfree.chart.entity.ChartEntity;
|
|
import org.jfree.chart.entity.PieSectionEntity;
|
|
|
|
public class PieChartHyperlinkProvider implements ChartHyperlinkProvider {
|
|
private static final long serialVersionUID = 10200L;
|
|
|
|
private Map sectionHyperlinks;
|
|
|
|
public PieChartHyperlinkProvider(Map sectionHyperlinks) {
|
|
this.sectionHyperlinks = sectionHyperlinks;
|
|
}
|
|
|
|
public JRPrintHyperlink getEntityHyperlink(ChartEntity entity) {
|
|
JRPrintHyperlink printHyperlink = null;
|
|
if (hasHyperlinks() && entity instanceof PieSectionEntity) {
|
|
PieSectionEntity pieEntity = (PieSectionEntity)entity;
|
|
printHyperlink = (JRPrintHyperlink)this.sectionHyperlinks.get(pieEntity.getSectionKey());
|
|
}
|
|
return printHyperlink;
|
|
}
|
|
|
|
public boolean hasHyperlinks() {
|
|
return (this.sectionHyperlinks != null && this.sectionHyperlinks.size() > 0);
|
|
}
|
|
}
|