1 28 package net.sf.jasperreports.charts.fill; 29 30 import net.sf.jasperreports.charts.JRXyzSeries; 31 import net.sf.jasperreports.engine.JRException; 32 import net.sf.jasperreports.engine.JRExpression; 33 import net.sf.jasperreports.engine.JRHyperlink; 34 import net.sf.jasperreports.engine.JRPrintHyperlink; 35 import net.sf.jasperreports.engine.JRRuntimeException; 36 import net.sf.jasperreports.engine.fill.JRCalculator; 37 import net.sf.jasperreports.engine.fill.JRExpressionEvalException; 38 import net.sf.jasperreports.engine.fill.JRFillHyperlinkHelper; 39 import net.sf.jasperreports.engine.fill.JRFillObjectFactory; 40 41 45 public class JRFillXyzSeries implements JRXyzSeries { 46 47 JRXyzSeries parent = null; 48 49 private Comparable series = null; 50 private Number xValue = null; 51 private Number yValue = null; 52 private Number zValue = null; 53 private JRPrintHyperlink itemHyperlink; 54 55 public JRFillXyzSeries( JRXyzSeries xyzSeries, JRFillObjectFactory factory ){ 56 factory.put( xyzSeries, this ); 57 parent = xyzSeries; 58 } 59 60 public JRExpression getSeriesExpression(){ 61 return parent.getSeriesExpression(); 62 } 63 64 public JRExpression getXValueExpression(){ 65 return parent.getXValueExpression(); 66 } 67 68 public JRExpression getYValueExpression(){ 69 return parent.getYValueExpression(); 70 } 71 72 public JRExpression getZValueExpression(){ 73 return parent.getZValueExpression(); 74 } 75 76 77 protected Comparable getSeries(){ 78 return series; 79 } 80 81 protected Number getXValue(){ 82 return xValue; 83 } 84 85 protected Number getYValue(){ 86 return yValue; 87 } 88 89 protected Number getZValue(){ 90 return zValue; 91 } 92 93 protected JRPrintHyperlink getPrintItemHyperlink() 94 { 95 return itemHyperlink; 96 } 97 98 protected void evaluate( JRCalculator calculator ) throws JRExpressionEvalException { 99 series = (Comparable )calculator.evaluate( getSeriesExpression() ); 100 xValue = (Number )calculator.evaluate( getXValueExpression() ); 101 yValue = (Number )calculator.evaluate( getYValueExpression() ); 102 zValue = (Number )calculator.evaluate( getZValueExpression() ); 103 104 if (hasItemHyperlinks()) 105 { 106 evaluateItemHyperlink(calculator); 107 } 108 } 109 110 protected void evaluateItemHyperlink(JRCalculator calculator) throws JRExpressionEvalException 111 { 112 try 113 { 114 itemHyperlink = JRFillHyperlinkHelper.evaluateHyperlink(getItemHyperlink(), calculator, JRExpression.EVALUATION_DEFAULT); 115 } 116 catch (JRExpressionEvalException e) 117 { 118 throw e; 119 } 120 catch (JRException e) 121 { 122 throw new JRRuntimeException(e); 123 } 124 } 125 126 public JRHyperlink getItemHyperlink() 127 { 128 return parent.getItemHyperlink(); 129 } 130 131 public boolean hasItemHyperlinks() 132 { 133 return getItemHyperlink() != null; 134 } 135 136 } 137 | Popular Tags |