1 28 29 import java.util.Collection ; 30 31 import net.sf.jasperreports.engine.JRDefaultScriptlet; 32 import net.sf.jasperreports.engine.JRScriptletException; 33 34 35 39 public class HeadingsScriptlet extends JRDefaultScriptlet 40 { 41 42 43 46 public Boolean addHeading(String groupName) throws JRScriptletException 47 { 48 Collection headings = (Collection )this.getVariableValue("HeadingsCollection"); 49 50 Integer type = null; 51 String text = null; 52 String reference = null; 53 Integer pageIndex = (Integer )this.getVariableValue("PAGE_NUMBER"); 54 55 if ("FirstLetterGroup".equals(groupName)) 56 { 57 type = new Integer (1); 58 text = "Letter " + this.getVariableValue("FirstLetter"); 59 reference = "FirstLetterGroup_" + this.getVariableValue("FirstLetter"); 60 61 headings.add(new HeadingBean(type, text, reference, pageIndex)); 62 } 63 else if ("ShipCountryGroup".equals(groupName)) 64 { 65 type = new Integer (2); 66 text = (String )this.getFieldValue("ShipCountry"); 67 reference = "ShipCountryGroup_" + this.getVariableValue("ShipCountryNumber"); 68 69 headings.add(new HeadingBean(type, text, reference, pageIndex)); 70 } 71 72 return Boolean.FALSE; 73 } 74 75 76 } 77 | Popular Tags |