You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(64) |
Apr
(38) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|---|
|
From: todd r. <to...@us...> - 2005-05-05 16:08:32
|
Update of /cvsroot/pocolap/pocolap/data/documentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv465/data/documentation Modified Files: config_file_how_to.sxw config_file_how_to.pdf Log Message: Preparing for release 0.2.1 Index: config_file_how_to.pdf =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/documentation/config_file_how_to.pdf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** config_file_how_to.pdf 4 May 2005 23:37:44 -0000 1.2 --- config_file_how_to.pdf 5 May 2005 16:08:22 -0000 1.3 *************** *** 16901,16906 **** 7.6 0 Td <09> Tj 3.8 0 Td <05> Tj ! 4.7 0 Td <10> Tj ! 7.5 0 Td <03> Tj ET Q --- 16901,16906 ---- 7.6 0 Td <09> Tj 3.8 0 Td <05> Tj ! 4.6 0 Td <10> Tj [...2859 lines suppressed...] ! 0000535880 00000 n ! 0000536844 00000 n ! 0000538030 00000 n ! 0000538149 00000 n ! 0000538266 00000 n ! 0000538682 00000 n ! 0000538743 00000 n trailer << /Size 68 *************** *** 24533,24536 **** >> startxref ! 535281 %%EOF --- 24746,24749 ---- >> startxref ! 538950 %%EOF Index: config_file_how_to.sxw =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/documentation/config_file_how_to.sxw,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsJsEaiH and /tmp/cvsXDDyRG differ |
|
From: todd r. <to...@us...> - 2005-05-04 23:39:17
|
Update of /cvsroot/pocolap/pocolap In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25791 Modified Files: CHANGES.TXT Log Message: Preparing for release 0.2.1 Index: CHANGES.TXT =================================================================== RCS file: /cvsroot/pocolap/pocolap/CHANGES.TXT,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** CHANGES.TXT 13 Apr 2005 22:01:34 -0000 1.13 --- CHANGES.TXT 4 May 2005 23:39:08 -0000 1.14 *************** *** 1,2 **** --- 1,6 ---- + Changes in pocolap version 0.2.1: + + - Added the "Select Format" option to generate PDF files of the information in the report grid. + Changes in pocolap version 0.2.0: |
|
From: todd r. <to...@us...> - 2005-05-04 23:37:53
|
Update of /cvsroot/pocolap/pocolap/data/documentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25313/data/documentation Modified Files: config_file_how_to.sxw config_file_how_to.pdf Log Message: Preparing for release 0.2.1 Index: config_file_how_to.pdf =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/documentation/config_file_how_to.pdf,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsizTdp9 and /tmp/cvsNpGZ77 differ Index: config_file_how_to.sxw =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/documentation/config_file_how_to.sxw,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsufCeGH and /tmp/cvsovqQGG differ |
|
From: Rashmi B. <ra...@us...> - 2005-04-30 15:12:55
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22725 Modified Files: pocOLAPConfig.xsd Log Message: Added documentation for <pdfConfig> element Index: pocOLAPConfig.xsd =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsd,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pocOLAPConfig.xsd 29 Apr 2005 15:03:46 -0000 1.4 --- pocOLAPConfig.xsd 30 Apr 2005 15:12:47 -0000 1.5 *************** *** 157,160 **** --- 157,168 ---- <xsd:complexType name="pdfConfig"> + <xsd:annotation> + <xsd:documentation> + pdfConfig element indicates if the 'Select Format' option will be displayed on + ReptPage.jsp. pdfConfig element and its attribute 'display' - both are optional. + However if the pdfConfig element is there but not the 'display' attribute - default + will be set to true. + </xsd:documentation> + </xsd:annotation> <xsd:attribute name="display" type="xsd:boolean" use="optional" default="true" /> </xsd:complexType> |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 21:34:35
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20748 Modified Files: FormatHelper.java Log Message: PDF related changes Index: FormatHelper.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/FormatHelper.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FormatHelper.java 29 Apr 2005 15:05:51 -0000 1.3 --- FormatHelper.java 29 Apr 2005 21:34:25 -0000 1.4 *************** *** 76,91 **** String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); ! Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet,fmt); ! ! req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); ! page = pocOLAPConstants.SERVLET_PDF; ! } return page ; --- 76,95 ---- String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! if ((fmt!=null) && (!(fmt.equalsIgnoreCase(pocOLAPConstants.NULL_VALUE)))) { ! ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); ! Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet,fmt); ! ! req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); ! page = pocOLAPConstants.SERVLET_PDF; ! } ! else{ ! page = "../" + pocOLAPConstants.PAGE_MAIN ; ! } } return page ; |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:06:02
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28195 Modified Files: FormatHelper.java pocOLAPConstants.java Log Message: PDF related changes Index: FormatHelper.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/FormatHelper.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FormatHelper.java 19 Apr 2005 00:39:16 -0000 1.2 --- FormatHelper.java 29 Apr 2005 15:05:51 -0000 1.3 *************** *** 42,46 **** /** ! * FormatHelper implements ServletHelper. It processes requests for ACTION_FORMAT_PDF * * @author Rashmi Banthia --- 42,46 ---- /** ! * FormatHelper implements ServletHelper. It processes requests for ACTION_FORMAT * * @author Rashmi Banthia *************** *** 66,70 **** */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null ; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; --- 66,70 ---- */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; *************** *** 73,80 **** if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); --- 73,81 ---- if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); *************** *** 82,89 **** SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet); req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); page = pocOLAPConstants.SERVLET_PDF; } return page ; --- 83,91 ---- SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet,fmt); req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); page = pocOLAPConstants.SERVLET_PDF; + } return page ; *************** *** 95,102 **** Selector across, FilterList[] filterlist , ! SpreadSheet spsheet ){ ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet); return baos ; } --- 97,105 ---- Selector across, FilterList[] filterlist , ! SpreadSheet spsheet , ! String format){ ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet,format); return baos ; } Index: pocOLAPConstants.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/pocOLAPConstants.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** pocOLAPConstants.java 19 Apr 2005 00:39:17 -0000 1.10 --- pocOLAPConstants.java 29 Apr 2005 15:05:52 -0000 1.11 *************** *** 79,84 **** public static final String ACTION_ADMN_REINIT = "admn.reinit"; public static final String ACTION_LOAD_REPT = "load.rept" ; - public static final String ACTION_FORMAT_PDF = "PDF" ; public static final String ACTION_FORMAT = "format" ; /*ATTRs are used for session attribute names*/ --- 79,89 ---- public static final String ACTION_ADMN_REINIT = "admn.reinit"; public static final String ACTION_LOAD_REPT = "load.rept" ; public static final String ACTION_FORMAT = "format" ; + + //PDF Formats + public static final String ACTION_PDF_CONTEMPORARY = "PDF - Contemporary" ; + public static final String ACTION_PDF_HTML = "PDF - Html" ; + public static final String ACTION_PDF_SIMPLEGRID = "PDF - SimpleGrid" ; + public static final String ACTION_PDF_PLAIN = "PDF - Plain" ; /*ATTRs are used for session attribute names*/ |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:05:23
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27930 Modified Files: FormatPDF.java Log Message: PDF related changes Index: FormatPDF.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format/FormatPDF.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FormatPDF.java 26 Apr 2005 17:33:39 -0000 1.3 --- FormatPDF.java 29 Apr 2005 15:05:14 -0000 1.4 *************** *** 46,50 **** import java.lang.Math; import com.pocolap.schema.SupplementalItem ; ! import com.pocolap.schema.FormatTypeItem; public class FormatPDF { --- 46,50 ---- import java.lang.Math; import com.pocolap.schema.SupplementalItem ; ! import com.pocolap.servlets.pocOLAPConstants ; public class FormatPDF { *************** *** 69,73 **** Selector across, FilterList[] filterlist , ! SpreadSheet spsheet ){ String errclass = getClass().getName()+".createPDF(CrossTabDef,Selector,Selector,FilterList[],SpreadSheet): "; --- 69,74 ---- Selector across, FilterList[] filterlist , ! SpreadSheet spsheet , ! String format ){ String errclass = getClass().getName()+".createPDF(CrossTabDef,Selector,Selector,FilterList[],SpreadSheet): "; *************** *** 90,94 **** TOP_MARGIN = TOP_MARGIN + (flist.length * 14); ! TableFormat tableformat = getTableFormat(); Rectangle psize = tableformat.getPageSize(); Document document = new Document(psize, LEFT_MARGIN, RIGHT_MARGIN, TOP_MARGIN, BOTTOM_MARGIN); //(PageSize,left,right,top,margin) --- 91,95 ---- TOP_MARGIN = TOP_MARGIN + (flist.length * 14); ! TableFormat tableformat = getTableFormat(format); Rectangle psize = tableformat.getPageSize(); Document document = new Document(psize, LEFT_MARGIN, RIGHT_MARGIN, TOP_MARGIN, BOTTOM_MARGIN); //(PageSize,left,right,top,margin) *************** *** 319,349 **** } ! private TableFormat getTableFormat(){ ! TableFormat t = null ; ! SupplementalItem sitem = currdefinition.getCrossTabDef().getRept().getSupplementalItem() ; ! if ((sitem!=null) && ! (sitem.getPdfConfigItem()!=null) && ! (sitem.getPdfConfigItem().getPdfFormatItem()!=null) ! ){ ! switch (sitem.getPdfConfigItem().getPdfFormatItem().getFormatTypeItem().intValue()){ ! case FormatTypeItem.INT_HTML: ! t = new HtmlFormat(); ! break; ! case FormatTypeItem.INT_CONTEMPORARY: ! t = new ContemporaryFormat(); ! break; ! case FormatTypeItem.INT_SIMPLE_GRID: ! t = new SimpleGridFormat(); ! break; ! case FormatTypeItem.INT_PLAIN: ! t = new PlainFormat(); ! break; ! default: ! t = new ContemporaryFormat(); ! break; ! } ! } else ! t = new ContemporaryFormat(); return t ; } --- 320,336 ---- } ! private TableFormat getTableFormat(String format){ ! TableFormat t = null ; ! if (format.equalsIgnoreCase(pocOLAPConstants.ACTION_PDF_HTML)) ! t = new HtmlFormat(); ! else if (format.equalsIgnoreCase(pocOLAPConstants.ACTION_PDF_CONTEMPORARY)) ! t = new ContemporaryFormat(); ! else if (format.equalsIgnoreCase(pocOLAPConstants.ACTION_PDF_SIMPLEGRID)) ! t = new SimpleGridFormat(); ! else if (format.equalsIgnoreCase(pocOLAPConstants.ACTION_PDF_PLAIN)) ! t = new PlainFormat(); else ! t = new ContemporaryFormat(); ! return t ; } *************** *** 351,355 **** } ! /*c Here's some documentation to understand this class: (X denotes empty cell) --- 338,342 ---- } ! /* Here's some documentation to understand this class: (X denotes empty cell) |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:04:49
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27694 Modified Files: FormatSelector.java Log Message: PDF related changes Index: FormatSelector.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/tags/FormatSelector.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FormatSelector.java 22 Apr 2005 16:59:11 -0000 1.2 --- FormatSelector.java 29 Apr 2005 15:04:41 -0000 1.3 *************** *** 69,72 **** --- 69,73 ---- CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); SupplementalItem sitem = currDefinition.getCrossTabDef().getRept().getSupplementalItem(); + req.getSession().removeAttribute(pocOLAPConstants.ACTION_FORMAT); boolean displayfmt= false; if (sitem!=null) { *************** *** 82,86 **** if (displayfmt){ StringBuffer strbuf = new StringBuffer(); ! String[] fmt = {pocOLAPConstants.ACTION_FORMAT_PDF}; if (fmt.length > 1) { strbuf = doTableHeader() ; --- 83,91 ---- if (displayfmt){ StringBuffer strbuf = new StringBuffer(); ! String[] fmt = {pocOLAPConstants.ACTION_PDF_CONTEMPORARY, ! pocOLAPConstants.ACTION_PDF_HTML, ! pocOLAPConstants.ACTION_PDF_SIMPLEGRID, ! pocOLAPConstants.ACTION_PDF_PLAIN}; ! if (fmt.length > 1) { strbuf = doTableHeader() ; |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:04:23
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27462 Modified Files: crosstab.jar Log Message: PDF related changes Index: crosstab.jar =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/crosstab.jar,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 Binary files /tmp/cvslvs9XH and /tmp/cvsHJ0ZXw differ |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:03:56
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27368 Modified Files: pocOLAPConfig.xsd pocOLAPConfig.xsdconfig Log Message: PDF related changes Index: pocOLAPConfig.xsdconfig =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsdconfig,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pocOLAPConfig.xsdconfig 26 Apr 2005 17:33:12 -0000 1.3 --- pocOLAPConfig.xsdconfig 29 Apr 2005 15:03:47 -0000 1.4 *************** *** 26,31 **** <xb:qname name="pc:reportIcon" javaname="ReportIconItem" /> <xb:qname name="pc:pdfConfig" javaname="PdfConfigItem" /> - <xb:qname name="pc:pdfFormat" javaname="PdfFormatItem" /> - <xb:qname name="pc:formatType" javaname="FormatTypeItem" /> <xb:qname name="pc:crosstab" javaname="CrossTabDef" /> --- 26,29 ---- Index: pocOLAPConfig.xsd =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsd,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pocOLAPConfig.xsd 26 Apr 2005 17:33:12 -0000 1.3 --- pocOLAPConfig.xsd 29 Apr 2005 15:03:46 -0000 1.4 *************** *** 157,181 **** <xsd:complexType name="pdfConfig"> ! <xsd:sequence> ! <xsd:element type="pc:pdfFormat" name="pdfFormat" minOccurs="0" maxOccurs="1" /> ! </xsd:sequence> ! <xsd:attribute name="display" type="xsd:boolean" use="optional" default="true" /> ! </xsd:complexType> ! ! <xsd:complexType name="pdfFormat"> ! <xsd:sequence> ! <xsd:element type="pc:formatType" name="formatType" minOccurs="0" maxOccurs="1" default="Contemporary"/> ! </xsd:sequence> </xsd:complexType> - <xsd:simpleType name="formatType" > - <xsd:restriction base="xsd:string"> - <xsd:enumeration value="Html" /> - <xsd:enumeration value="Contemporary" /> - <xsd:enumeration value="SimpleGrid" /> - <xsd:enumeration value="Plain" /> - </xsd:restriction> - </xsd:simpleType> - <xsd:complexType name="reportIcon"> <xsd:attribute name="src" use="required" type="xsd:string" /> --- 157,163 ---- <xsd:complexType name="pdfConfig"> ! <xsd:attribute name="display" type="xsd:boolean" use="optional" default="true" /> </xsd:complexType> <xsd:complexType name="reportIcon"> <xsd:attribute name="src" use="required" type="xsd:string" /> |
|
From: Rashmi B. <ra...@us...> - 2005-04-29 15:03:27
|
Update of /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27191 Modified Files: derbyconfig.xml Log Message: PDF related changes Index: derbyconfig.xml =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs/derbyconfig.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** derbyconfig.xml 26 Apr 2005 17:32:47 -0000 1.5 --- derbyconfig.xml 29 Apr 2005 15:03:19 -0000 1.6 *************** *** 71,79 **** <description>This shows employee labor data stored in a Derby database</description> <link linktext="Learn more at the pocOLAP home page" linkurl="http://pocolap.sourceforge.net" /> ! <pdfConfig display="true"> ! <pdfFormat> ! <formatType>SimpleGrid</formatType> ! </pdfFormat> ! </pdfConfig> </supplemental> --- 71,75 ---- <description>This shows employee labor data stored in a Derby database</description> <link linktext="Learn more at the pocOLAP home page" linkurl="http://pocolap.sourceforge.net" /> ! <pdfConfig display="true"/> </supplemental> |
|
From: Rashmi B. <ra...@us...> - 2005-04-26 17:34:24
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22129 Added Files: ContemporaryFormat.java HtmlFormat.java PlainFormat.java SimpleGridFormat.java TableFormat.java Log Message: PDF related changes --- NEW FILE: TableFormat.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import org.apache.log4j.Logger ; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.Rectangle; import com.lowagie.text.PageSize ; import com.pocolap.xtab.layout.SpreadSheet; public class TableFormat { static Logger logger = Logger.getLogger(TableFormat.class); public TableFormat(){} public Rectangle getPageSize(){ Rectangle psize = PageSize.A4.rotate(); //psize.setBackgroundColor(new java.awt.Color(204, 204, 255)); return psize ; } public PdfPTable formatTable(String[][] harr,String[][] newarr, SpreadSheet sheet){ return null ; } } --- NEW FILE: SimpleGridFormat.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import org.apache.log4j.Logger ; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.pdf.PdfPCell ; import com.pocolap.xtab.layout.SpreadSheet; import java.awt.Color; import com.lowagie.text.Paragraph ; import com.lowagie.text.FontFactory; import com.lowagie.text.Element ; import com.lowagie.text.Font ; import com.lowagie.text.Rectangle; import com.lowagie.text.PageSize ; public class SimpleGridFormat extends TableFormat { static Logger logger = Logger.getLogger(SimpleGridFormat.class); public PdfPTable formatTable(String[][] harr,String[][] newarr, SpreadSheet sheet){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; int rows = newarr.length; int cols = newarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length; PdfPTable table = null ; table = new PdfPTable(cols); table.setHeaderRows(hrow); table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center for (int i=0;i<rows;i++){ for (int j=0;j<cols;j++){ if ((i<hrow) && (j<hcol)){ //Row/Column Selectors if (fixedcol==0){ if (i==hrow-1) table.addCell(applyStyleLastRowSelector(newarr[i][j])); else table.addCell(applyStyleRowSelector(newarr[i][j],hcol)); } else { if (fixedrow==0){ if (j==hcol-1) table.addCell(applyStyleLastColSelector(newarr[i][j])); else table.addCell(applyStyleColSelector(newarr[i][j])); } else { if ((j==hcol-1)&&(i!=hrow-1)) table.addCell(applyStyleRowSelector(newarr[i][j],hcol)); if (i==hrow-1){ if (j==hcol-1) table.addCell(applyStyleLastColSelector(newarr[i][j])); else table.addCell(applyStyleColSelector(newarr[i][j])); } } } } else { if ((i>=hrow) && (j<hcol)) //Column Headers { if (j==hcol-1){ if ((i%2)==0) table.addCell(applyStyleLastColumnHeader(newarr[i][j])); else table.addCell(applyStyleLastColumnHeaderAlt(newarr[i][j])); } else{ if ((i%2)==0) table.addCell(applyStyleColumnHeader(newarr[i][j])); else table.addCell(applyStyleColumnHeaderAlt(newarr[i][j])); } } else { if ((i<hrow) && (j>=hcol)) //Row Headers { if (i==hrow-1) table.addCell(applyStyleLastRowHeader(newarr[i][j])); else table.addCell(applyStyleRowHeader(newarr[i][j])); } else { //Data cells if ((i%2)==0) table.addCell(applyStyleData(newarr[i][j])); else table.addCell(applyStyleDataAlt(newarr[i][j])); } } } } } return table; } private PdfPCell applyStyleData(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleRowSelector(String str, int colspan){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(2f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleLastRowSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(2f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleColSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleLastColSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(2f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleColumnHeaderAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleLastColumnHeaderAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(2f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleLastColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(2f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleLastRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(2f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } private PdfPCell applyStyleDataAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); Rectangle border = new Rectangle(0f,0f); border.setBorderWidthLeft(0.3f); border.setBorderWidthBottom(0.3f); border.setBorderWidthRight(0.3f); border.setBorderWidthTop(0.3f); border.setBorderColor(Color.BLACK); cell.cloneNonPositionParameters(border); return cell ; } } --- NEW FILE: HtmlFormat.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import org.apache.log4j.Logger ; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.pdf.PdfPCell ; import com.pocolap.xtab.layout.SpreadSheet; import java.awt.Color; import com.lowagie.text.Paragraph ; import com.lowagie.text.FontFactory; import com.lowagie.text.Element ; import com.lowagie.text.Font ; import com.lowagie.text.Rectangle ; import com.lowagie.text.PageSize ; public class HtmlFormat extends TableFormat { static Logger logger = Logger.getLogger(HtmlFormat.class); public Rectangle getPageSize(){ Rectangle psize = PageSize.A4.rotate(); psize.setBackgroundColor(new java.awt.Color(204, 204, 255)); return psize ; } public PdfPTable formatTable(String[][] harr,String[][] newarr, SpreadSheet sheet){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; int rows = newarr.length; int cols = newarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length; PdfPTable table = null ; table = new PdfPTable(cols); table.setHeaderRows(hrow); table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center for(int i=0;i<rows;i++){ for(int j=0;j<cols;j++){ if ( (( i<hrow-1 && j==hcol-1) && (!(fixedcol==0))) || (( i<hrow && j==hcol-1) && ((fixedcol==0))) ) table.addCell(applyStyleColumnSelector(newarr[i][j],hcol)); else if (i==hrow-1 && j<hcol) table.addCell(applyStyleRowSelector(newarr[i][j])); else if ( (( i<hrow-1 && j>hcol-1) && (!(fixedcol==0))) || (( i<hrow && j>hcol-1) && ((fixedcol==0))) ) table.addCell(applyStyleColumnHeader(newarr[i][j])); else if (i>hrow-1 && j<hcol && (!(newarr[i][j].equalsIgnoreCase("Totals")))) table.addCell(applyStyleRowHeader(newarr[i][j])); else if (i==hrow-1 && (!(fixedcol==0)) && (!(i==0)) ) table.addCell(applyStyleSeparator(" ")); else if ( ((fixedcol==0) && (i==hrow) && (j==hcol-1))|| ((fixedrow==0) && (j==hcol) && i==hrow-1) ) table.addCell(applyStyleTotal(newarr[i][j])); else if ((newarr[i][j]!=null)&&((i%2)==0)) table.addCell(applyStyleData(newarr[i][j])); else if ((newarr[i][j]!=null)&&((i%2)==1)) table.addCell(applyStyleDataAlt(newarr[i][j])); } } return table; } //#D9D9D9 nice gray private PdfPCell applyStyleColumnSelector(String str, int colspan){ //white bold times_roman font Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); cell.setBackgroundColor(new Color(0,102,204)); //#0066CC *blue*; return cell ; } private PdfPCell applyStyleRowSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(102,153,255)); //#6699FF *bluish*; return cell ; } private PdfPCell applyStyleColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(255,255,255))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(0,102,204)); // #0066CC *blue*; return cell ; } private PdfPCell applyStyleRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(102,153,255)); // #6699FF *bluish*; return cell ; } private PdfPCell applyStyleSeparator(String str){ //font bold color=#CCCCCC Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(204,204,204))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setBackgroundColor(new Color(153,153,153)); // 999999 *light gray*; return cell ; } private PdfPCell applyStyleTotal(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, new Color(255,255,255))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(0,0,102)); // #000066 *mint green*; return cell ; } private PdfPCell applyStyleData(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(204,204,204)); // CCCCCC *white*; return cell ; } private PdfPCell applyStyleDataAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(204,204,255)); // #CCCCFF; return cell ; } } --- NEW FILE: ContemporaryFormat.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import org.apache.log4j.Logger ; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.pdf.PdfPCell ; import com.pocolap.xtab.layout.SpreadSheet; import java.awt.Color; import com.lowagie.text.Paragraph ; import com.lowagie.text.FontFactory; import com.lowagie.text.Element ; import com.lowagie.text.Font ; import com.lowagie.text.Rectangle; import com.lowagie.text.PageSize ; public class ContemporaryFormat extends TableFormat { static Logger logger = Logger.getLogger(ContemporaryFormat.class); public PdfPTable formatTable(String[][] harr,String[][] newarr, SpreadSheet sheet){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; int rows = newarr.length; int cols = newarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length; PdfPTable table = null ; table = new PdfPTable(cols); table.setHeaderRows(hrow); table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center for (int i=0;i<rows;i++){ for (int j=0;j<cols;j++){ if ((i<hrow) && (j<hcol)){ //Row/Column Selectors if (fixedcol==0){ if (i==hrow-1) table.addCell(applyStyleLastRowSelector(newarr[i][j])); else table.addCell(applyStyleRowSelector(newarr[i][j],hcol)); } else { if (fixedrow==0){ if (j==hcol-1) table.addCell(applyStyleLastColSelector(newarr[i][j])); else table.addCell(applyStyleColSelector(newarr[i][j])); } else { if ((j==hcol-1)&&(i!=hrow-1)) table.addCell(applyStyleRowSelector(newarr[i][j],hcol)); if (i==hrow-1){ if (j==hcol-1) table.addCell(applyStyleLastColSelector(newarr[i][j])); else table.addCell(applyStyleColSelector(newarr[i][j])); } } } } else { if ((i>=hrow) && (j<hcol)) //Column Headers { if (j==hcol-1){ if ((i%2)==0) table.addCell(applyStyleLastColumnHeader(newarr[i][j])); else table.addCell(applyStyleLastColumnHeaderAlt(newarr[i][j])); } else{ if ((i%2)==0) table.addCell(applyStyleColumnHeader(newarr[i][j])); else table.addCell(applyStyleColumnHeaderAlt(newarr[i][j])); } } else { if ((i<hrow) && (j>=hcol)) //Row Headers { if (i==hrow-1) table.addCell(applyStyleLastRowHeader(newarr[i][j])); else table.addCell(applyStyleRowHeader(newarr[i][j])); } else { //Data cells if ((i%2)==0) table.addCell(applyStyleData(newarr[i][j])); else table.addCell(applyStyleDataAlt(newarr[i][j])); } } } } } return table; } private PdfPCell applyStyleData(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleRowSelector(String str, int colspan){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.RIGHT ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleLastRowSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM |Rectangle.RIGHT ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleColSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); //cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleLastColSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); //cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM | Rectangle.RIGHT ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleColumnHeaderAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleLastColumnHeaderAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBorder(Rectangle.RIGHT); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleLastColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.RIGHT); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleLastRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleDataAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBorder(Rectangle.NO_BORDER); return cell ; } } --- NEW FILE: PlainFormat.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import org.apache.log4j.Logger ; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.pdf.PdfPCell ; import com.pocolap.xtab.layout.SpreadSheet; import java.awt.Color; import com.lowagie.text.Paragraph ; import com.lowagie.text.FontFactory; import com.lowagie.text.Element ; import com.lowagie.text.Font ; public class PlainFormat extends TableFormat { static Logger logger = Logger.getLogger(PlainFormat.class); public PdfPTable formatTable(String[][] harr,String[][] newarr, SpreadSheet sheet){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; int rows = newarr.length; int cols = newarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length; PdfPTable table = null ; table = new PdfPTable(cols); table.setHeaderRows(hrow); table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center for (int i=0;i<rows;i++){ for (int j=0;j<cols;j++){ table.addCell(applyStyleData(newarr[i][j])); } } return table; } private PdfPCell applyStyleData(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); return cell ; } } |
|
From: Rashmi B. <ra...@us...> - 2005-04-26 17:33:48
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21728 Modified Files: FormatPDF.java Log Message: PDF related changes Index: FormatPDF.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format/FormatPDF.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** FormatPDF.java 19 Apr 2005 00:39:58 -0000 1.2 --- FormatPDF.java 26 Apr 2005 17:33:39 -0000 1.3 *************** *** 45,48 **** --- 45,50 ---- import java.io.ByteArrayOutputStream; import java.lang.Math; + import com.pocolap.schema.SupplementalItem ; + import com.pocolap.schema.FormatTypeItem; public class FormatPDF { *************** *** 87,92 **** if (flist!=null) TOP_MARGIN = TOP_MARGIN + (flist.length * 14); ! Rectangle psize = PageSize.A4.rotate(); ! psize.setBackgroundColor(new java.awt.Color(204, 204, 255)); //CCCCFF Document document = new Document(psize, LEFT_MARGIN, RIGHT_MARGIN, TOP_MARGIN, BOTTOM_MARGIN); //(PageSize,left,right,top,margin) try{ --- 89,95 ---- if (flist!=null) TOP_MARGIN = TOP_MARGIN + (flist.length * 14); ! ! TableFormat tableformat = getTableFormat(); ! Rectangle psize = tableformat.getPageSize(); Document document = new Document(psize, LEFT_MARGIN, RIGHT_MARGIN, TOP_MARGIN, BOTTOM_MARGIN); //(PageSize,left,right,top,margin) try{ *************** *** 97,104 **** writer.setPageEvent(new HeaderEvent(currdefinition,flist)); document.open(); ! createTable(writer,document); } catch(DocumentException de) { ! System.err.println(de.getMessage()); } document.close(); --- 100,107 ---- writer.setPageEvent(new HeaderEvent(currdefinition,flist)); document.open(); ! createTable(writer,document, tableformat); } catch(DocumentException de) { ! logger.error(errclass + de.getMessage()); } document.close(); *************** *** 116,120 **** } ! private void createTable(PdfWriter writer,Document document) { String errclass = getClass().getName()+".createTable(PdfWriter,Document): "; logger.debug(errclass+ "Creating table .."); --- 119,123 ---- } ! private void createTable(PdfWriter writer,Document document , TableFormat tableformat) { String errclass = getClass().getName()+".createTable(PdfWriter,Document): "; logger.debug(errclass+ "Creating table .."); *************** *** 130,134 **** } catch(DocumentException de) { ! System.err.println(de.getMessage()); } return ; --- 133,137 ---- } catch(DocumentException de) { ! logger.error(errclass+de.getMessage()); } return ; *************** *** 140,144 **** //Decide how many cols on a page int totalpoints = (int)PageSize.A4.rotate().right() - LEFT_MARGIN - RIGHT_MARGIN ; //left and right margins ! // logger.debug("Totalpoints on this page: " + totalpoints); float[] maxlen; //contains the points required for each column in newarr[][]. maxlen = new float[newarr[0].length]; --- 143,147 ---- //Decide how many cols on a page int totalpoints = (int)PageSize.A4.rotate().right() - LEFT_MARGIN - RIGHT_MARGIN ; //left and right margins ! // logger.debug("Totalpoints on this page: " + totalpoints); float[] maxlen; //contains the points required for each column in newarr[][]. maxlen = new float[newarr[0].length]; *************** *** 156,162 **** } ! // for(int i=0;i<maxlen.length;i++){ ! // logger.debug("i=" + i + " Col length:" + maxlen[i]); ! // } //Calculate the no. of points required for header columns --- 159,165 ---- } ! // for(int i=0;i<maxlen.length;i++){ ! // logger.debug("i=" + i + " Col length:" + maxlen[i]); ! // } //Calculate the no. of points required for header columns *************** *** 166,174 **** } ! // logger.debug("Header column points : " + hcolpoints); int totaltables = 0,sum=0; //Calculate no. of tables ! // logger.debug("Calculate no. of tables"); for (int i=0,j=harr[0].length ;j<maxlen.length;totaltables = i,i++){ sum = hcolpoints ; --- 169,177 ---- } ! // logger.debug("Header column points : " + hcolpoints); int totaltables = 0,sum=0; //Calculate no. of tables ! // logger.debug("Calculate no. of tables"); for (int i=0,j=harr[0].length ;j<maxlen.length;totaltables = i,i++){ sum = hcolpoints ; *************** *** 178,182 **** sum = sum + (int)maxlen[j]; } ! // logger.debug("i="+i+" sum="+sum); } totaltables ++ ; --- 181,185 ---- sum = sum + (int)maxlen[j]; } ! // logger.debug("i="+i+" sum="+sum); } totaltables ++ ; *************** *** 232,236 **** PdfPTable table ; ! table = formatTable(harr,smallarr); table.setLockedWidth(true); try{ --- 235,239 ---- PdfPTable table ; ! table = tableformat.formatTable(harr,smallarr,sheet); table.setLockedWidth(true); try{ *************** *** 240,244 **** } catch(DocumentException de) { ! System.err.println(de.getMessage()); } } --- 243,247 ---- } catch(DocumentException de) { ! logger.error(errclass+de.getMessage()); } } *************** *** 316,541 **** } ! private PdfPTable formatTable(String[][] harr,String[][] newarr){ ! int fixedrow = sheet.getFixedRowCount() ; ! int fixedcol = sheet.getFixedColumnCount() ; ! int rows = newarr.length; ! int cols = newarr[0].length ; ! int hrow = harr.length ; ! int hcol = harr[0].length; ! ! PdfPTable table = null ; ! table = new PdfPTable(cols); ! ! table.setHeaderRows(hrow); ! //table.setWidthPercentage(100); //Default width is 80% ! table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center ! ! ! for(int i=0;i<rows;i++){ ! for(int j=0;j<cols;j++){ ! if ( (( i<hrow-1 && j==hcol-1) && (!(fixedcol==0))) || ! (( i<hrow && j==hcol-1) && ((fixedcol==0))) ) ! table.addCell(applyStyleColumnSelector(newarr[i][j],hcol)); ! ! else if (i==hrow-1 && j<hcol) ! table.addCell(applyStyleRowSelector(newarr[i][j])); ! ! else if ( (( i<hrow-1 && j>hcol-1) && (!(fixedcol==0))) || ! (( i<hrow && j>hcol-1) && ((fixedcol==0))) ) ! table.addCell(applyStyleColumnHeader(newarr[i][j])); ! ! else if (i>hrow-1 && j<hcol && (!(newarr[i][j].equalsIgnoreCase("Totals")))) ! table.addCell(applyStyleRowHeader(newarr[i][j])); ! ! else if (i==hrow-1 && (!(fixedcol==0)) && (!(i==0)) ) ! table.addCell(applyStyleSeparator(" ")); ! ! else if ( ((fixedcol==0) && (i==hrow) && (j==hcol-1))|| ! ((fixedrow==0) && (j==hcol) && i==hrow-1) ) ! table.addCell(applyStyleTotal(newarr[i][j])); ! ! else if ((newarr[i][j]!=null)&&((i%2)==0)) ! table.addCell(applyStyleData(newarr[i][j])); ! ! else if ((newarr[i][j]!=null)&&((i%2)==1)) ! table.addCell(applyStyleDataAlt(newarr[i][j])); ! ! } ! } ! ! return table; ! } ! ! //#D9D9D9 nice gray ! private PdfPCell applyStyleColumnSelector(String str, int colspan){ ! //white bold times_roman font ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setColspan(colspan); ! cell.setHorizontalAlignment( Element.ALIGN_RIGHT); ! cell.setBackgroundColor(new Color(0,102,204)); //#0066CC *blue*; ! return cell ; ! } ! ! private PdfPCell applyStyleRowSelector(String str){ ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(102,153,255)); //#6699FF *bluish*; ! return cell ; ! } ! ! private PdfPCell applyStyleColumnHeader(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(255,255,255))); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(0,102,204)); // #0066CC *blue*; ! return cell ; ! } ! ! private PdfPCell applyStyleRowHeader(String str){ ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(102,153,255)); // #6699FF *bluish*; ! return cell ; ! } ! ! private PdfPCell applyStyleSeparator(String str){ ! //font bold color=#CCCCCC ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(204,204,204))); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setBackgroundColor(new Color(153,153,153)); // 999999 *light gray*; ! return cell ; ! } ! ! private PdfPCell applyStyleTotal(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, new Color(255,255,255))); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(0,0,102)); // #000066 *mint green*; ! return cell ; ! } ! ! private PdfPCell applyStyleData(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(204,204,204)); // CCCCCC *white*; ! return cell ; ! } ! ! private PdfPCell applyStyleDataAlt(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(204,204,255)); // #CCCCFF; ! return cell ; ! } ! ! ! /* ! //#D9D9D9 nice gray ! private PdfPCell applyStyleColumnSelector(String str, int colspan){ ! //white bold times_roman font ! // Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setColspan(colspan); ! cell.setHorizontalAlignment( Element.ALIGN_RIGHT); ! //cell.setBackgroundColor(new Color(0,102,204)); //#0066CC *blue*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.RIGHT ); ! cell.setBorderWidth(2f); ! return cell ; ! } ! ! private PdfPCell applyStyleRowSelector(String str){ ! //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! //cell.setBackgroundColor(new Color(102,153,255)); //#6699FF *bluish*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.BOTTOM |Rectangle.RIGHT ); ! //cell.setBorder(Rectangle.RIGHT); ! cell.setBorderWidth(2f); ! return cell ; ! } ! ! private PdfPCell applyStyleColumnHeader(String str){ ! //font bold color=#FFFFFF ! //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(255,255,255))); ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! //cell.setBackgroundColor(new Color(0,102,204)); // #0066CC *blue*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.NO_BORDER); ! ! return cell ; ! } ! ! private PdfPCell applyStyleRowHeader(String str){ ! //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! //cell.setBackgroundColor(new Color(102,153,255)); // #6699FF *bluish*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.RIGHT); ! cell.setBorderWidth(2f); ! return cell ; ! } ! ! private PdfPCell applyStyleSeparator(String str){ ! //font bold color=#CCCCCC ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(204,204,204))); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! //cell.setBackgroundColor(new Color(153,153,153)); // 999999 *light gray*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.BOTTOM); ! cell.setBorderWidth(2f); ! return cell ; ! } ! ! private PdfPCell applyStyleTotal(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, new Color(255,255,255))); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! cell.setBackgroundColor(new Color(0,0,102)); // #000066 *mint green*; ! cell.setBorder(Rectangle.NO_BORDER); ! return cell ; ! } ! ! private PdfPCell applyStyleData(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! //cell.setBackgroundColor(new Color(204,204,204)); // CCCCCC *white*; ! cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; ! cell.setBorder(Rectangle.NO_BORDER); ! return cell ; ! } ! ! private PdfPCell applyStyleDataAlt(String str){ ! //font bold color=#FFFFFF ! Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); ! PdfPCell cell = new PdfPCell(new Paragraph(p)); ! cell.setHorizontalAlignment( Element.ALIGN_CENTER); ! //cell.setBackgroundColor(new Color(204,204,255)); // #CCCCFF; ! cell.setBorder(Rectangle.NO_BORDER); ! return cell ; ! } ! */ } ! /* Here's some documentation to understand this class: (X denotes empty cell) --- 319,355 ---- } ! private TableFormat getTableFormat(){ ! TableFormat t = null ; ! SupplementalItem sitem = currdefinition.getCrossTabDef().getRept().getSupplementalItem() ; ! if ((sitem!=null) && ! (sitem.getPdfConfigItem()!=null) && ! (sitem.getPdfConfigItem().getPdfFormatItem()!=null) ! ){ ! switch (sitem.getPdfConfigItem().getPdfFormatItem().getFormatTypeItem().intValue()){ ! case FormatTypeItem.INT_HTML: ! t = new HtmlFormat(); ! break; ! case FormatTypeItem.INT_CONTEMPORARY: ! t = new ContemporaryFormat(); ! break; ! case FormatTypeItem.INT_SIMPLE_GRID: ! t = new SimpleGridFormat(); ! break; ! case FormatTypeItem.INT_PLAIN: ! t = new PlainFormat(); ! break; ! default: ! t = new ContemporaryFormat(); ! break; ! } ! } ! else ! t = new ContemporaryFormat(); ! return t ; ! } ! } ! /*c Here's some documentation to understand this class: (X denotes empty cell) |
|
From: Rashmi B. <ra...@us...> - 2005-04-26 17:33:22
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21465 Modified Files: crosstab.jar pocOLAPConfig.xsd pocOLAPConfig.xsdconfig Log Message: PDF related changes Index: pocOLAPConfig.xsdconfig =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsdconfig,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pocOLAPConfig.xsdconfig 22 Apr 2005 17:00:37 -0000 1.2 --- pocOLAPConfig.xsdconfig 26 Apr 2005 17:33:12 -0000 1.3 *************** *** 26,31 **** <xb:qname name="pc:reportIcon" javaname="ReportIconItem" /> <xb:qname name="pc:pdfConfig" javaname="PdfConfigItem" /> <xb:qname name="pc:crosstab" javaname="CrossTabDef" /> ! <xb:qname name="pc:crosstabType" javaname="CrossTabDefItem" /> --- 26,33 ---- <xb:qname name="pc:reportIcon" javaname="ReportIconItem" /> <xb:qname name="pc:pdfConfig" javaname="PdfConfigItem" /> + <xb:qname name="pc:pdfFormat" javaname="PdfFormatItem" /> + <xb:qname name="pc:formatType" javaname="FormatTypeItem" /> <xb:qname name="pc:crosstab" javaname="CrossTabDef" /> ! <xb:qname name="pc:crosstabType" javaname="CrossTabDefItem" /> Index: crosstab.jar =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/crosstab.jar,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 Binary files /tmp/cvsasodMx and /tmp/cvsFOQRkN differ Index: pocOLAPConfig.xsd =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsd,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pocOLAPConfig.xsd 22 Apr 2005 17:00:37 -0000 1.2 --- pocOLAPConfig.xsd 26 Apr 2005 17:33:12 -0000 1.3 *************** *** 157,163 **** --- 157,181 ---- <xsd:complexType name="pdfConfig"> + <xsd:sequence> + <xsd:element type="pc:pdfFormat" name="pdfFormat" minOccurs="0" maxOccurs="1" /> + </xsd:sequence> <xsd:attribute name="display" type="xsd:boolean" use="optional" default="true" /> </xsd:complexType> + <xsd:complexType name="pdfFormat"> + <xsd:sequence> + <xsd:element type="pc:formatType" name="formatType" minOccurs="0" maxOccurs="1" default="Contemporary"/> + </xsd:sequence> + </xsd:complexType> + + <xsd:simpleType name="formatType" > + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="Html" /> + <xsd:enumeration value="Contemporary" /> + <xsd:enumeration value="SimpleGrid" /> + <xsd:enumeration value="Plain" /> + </xsd:restriction> + </xsd:simpleType> + <xsd:complexType name="reportIcon"> <xsd:attribute name="src" use="required" type="xsd:string" /> |
|
From: Rashmi B. <ra...@us...> - 2005-04-26 17:32:56
|
Update of /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21137 Modified Files: derbyconfig.xml Log Message: PDF related changes Index: derbyconfig.xml =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs/derbyconfig.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** derbyconfig.xml 22 Apr 2005 17:01:22 -0000 1.4 --- derbyconfig.xml 26 Apr 2005 17:32:47 -0000 1.5 *************** *** 71,75 **** <description>This shows employee labor data stored in a Derby database</description> <link linktext="Learn more at the pocOLAP home page" linkurl="http://pocolap.sourceforge.net" /> ! <pdfConfig display="true" /> </supplemental> --- 71,79 ---- <description>This shows employee labor data stored in a Derby database</description> <link linktext="Learn more at the pocOLAP home page" linkurl="http://pocolap.sourceforge.net" /> ! <pdfConfig display="true"> ! <pdfFormat> ! <formatType>SimpleGrid</formatType> ! </pdfFormat> ! </pdfConfig> </supplemental> |
|
From: Rashmi B. <ra...@us...> - 2005-04-22 17:01:31
|
Update of /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25343 Modified Files: derbyconfig.xml Log Message: PDF related changes Index: derbyconfig.xml =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/pocolapDB/crosstabdefs/derbyconfig.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** derbyconfig.xml 1 Apr 2005 00:04:46 -0000 1.3 --- derbyconfig.xml 22 Apr 2005 17:01:22 -0000 1.4 *************** *** 71,74 **** --- 71,75 ---- <description>This shows employee labor data stored in a Derby database</description> <link linktext="Learn more at the pocOLAP home page" linkurl="http://pocolap.sourceforge.net" /> + <pdfConfig display="true" /> </supplemental> |
|
From: Rashmi B. <ra...@us...> - 2005-04-22 17:01:15
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25143 Modified Files: crosstab.jar Log Message: PDF related changes Index: crosstab.jar =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/crosstab.jar,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 Binary files /tmp/cvsA37sgX and /tmp/cvspOTkSY differ |
|
From: Rashmi B. <ra...@us...> - 2005-04-22 17:00:46
|
Update of /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24843 Modified Files: pocOLAPConfig.xsd pocOLAPConfig.xsdconfig Log Message: PDF related changes Index: pocOLAPConfig.xsdconfig =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsdconfig,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pocOLAPConfig.xsdconfig 31 Mar 2005 20:54:37 -0000 1.1 --- pocOLAPConfig.xsdconfig 22 Apr 2005 17:00:37 -0000 1.2 *************** *** 25,28 **** --- 25,29 ---- <xb:qname name="pc:externallink" javaname="ExternalLinkItem" /> <xb:qname name="pc:reportIcon" javaname="ReportIconItem" /> + <xb:qname name="pc:pdfConfig" javaname="PdfConfigItem" /> <xb:qname name="pc:crosstab" javaname="CrossTabDef" /> Index: pocOLAPConfig.xsd =================================================================== RCS file: /cvsroot/pocolap/pocolap/data/xsd/CrosstabXSD/pocOLAPConfig.xsd,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pocOLAPConfig.xsd 31 Mar 2005 20:54:37 -0000 1.1 --- pocOLAPConfig.xsd 22 Apr 2005 17:00:37 -0000 1.2 *************** *** 147,150 **** --- 147,151 ---- <xsd:element type="xsd:string" name="description" maxOccurs="1" minOccurs="0" /> <xsd:element type="pc:externalLink" name="link" minOccurs="0" maxOccurs="unbounded" /> + <xsd:element type="pc:pdfConfig" name="pdfConfig" minOccurs="0" maxOccurs="1" /> </xsd:sequence> </xsd:complexType> *************** *** 155,158 **** --- 156,163 ---- </xsd:complexType> + <xsd:complexType name="pdfConfig"> + <xsd:attribute name="display" type="xsd:boolean" use="optional" default="true" /> + </xsd:complexType> + <xsd:complexType name="reportIcon"> <xsd:attribute name="src" use="required" type="xsd:string" /> |
|
From: Rashmi B. <ra...@us...> - 2005-04-22 16:59:20
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24285 Modified Files: FormatSelector.java Log Message: PDF related changes Index: FormatSelector.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/tags/FormatSelector.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FormatSelector.java 14 Apr 2005 22:34:13 -0000 1.1 --- FormatSelector.java 22 Apr 2005 16:59:11 -0000 1.2 *************** *** 34,38 **** import org.apache.log4j.Logger; ! import com.pocolap.servlets.pocOLAPConstants; --- 34,39 ---- import org.apache.log4j.Logger; ! import com.pocolap.schema.CrossTabDef ; ! import com.pocolap.schema.SupplementalItem ; import com.pocolap.servlets.pocOLAPConstants; *************** *** 66,129 **** JspWriter writer = pageContext.getOut(); Logger logger = Logger.getLogger(getClass().getName()); String errclass = getClass().getName()+".doEndTag()"; - - StringBuffer strbuf = new StringBuffer(); - String[] fmt = {pocOLAPConstants.ACTION_FORMAT_PDF}; - if (fmt.length > 1) { - strbuf = doTableHeader() ; - try { - strbuf.append("<tr><td>\n<select name=\""); - strbuf.append(pocOLAPConstants.ACTION_FORMAT); - strbuf.append("\" onchange=\"setAction('"); - strbuf.append(pocOLAPConstants.ACTION_FORMAT); - strbuf.append("');\">\n"); - strbuf.append("<option value=\"null\">Select Format</option>\n"); - - for(int j=0;j<fmt.length;j++){ - strbuf.append("<option value=\""); - strbuf.append(fmt[j]); - strbuf.append("\">"); - strbuf.append(fmt[j]); - strbuf.append("</option>\n"); - } - strbuf.append("</select></td></tr>\n"); - strbuf.append("</table>"); - writer.write(strbuf.toString()); - } - catch (IOException e) { - if (logger!=null){ - logger.error(errclass+": "+e.getMessage(),new Throwable(e)); - }else{ - System.out.println(errclass+": "+e.getMessage()); - e.printStackTrace(); - } - } ! } ! else if (fmt.length == 1) { ! strbuf = doTableHeader() ; ! try{ ! strbuf.append("<tr><td>\n<input type=\"text\" name=\""); ! strbuf.append(pocOLAPConstants.ACTION_FORMAT); ! strbuf.append("\" value=\""); ! strbuf.append(fmt[0]); ! strbuf.append("\" onclick=\"setAction('"); ! strbuf.append(pocOLAPConstants.ACTION_FORMAT); ! strbuf.append("');\">\n"); ! strbuf.append("</td></tr>\n"); ! strbuf.append("</table>"); ! writer.write(strbuf.toString()); ! } ! catch(IOException e){ ! if (logger!=null){ ! logger.error(errclass+": "+e.getMessage(),new Throwable(e)); ! }else{ ! System.out.println(errclass+": "+e.getMessage()); ! e.printStackTrace(); ! } ! } ! } return retVal; } --- 67,141 ---- JspWriter writer = pageContext.getOut(); + CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); + SupplementalItem sitem = currDefinition.getCrossTabDef().getRept().getSupplementalItem(); + boolean displayfmt= false; + if (sitem!=null) { + if(sitem.getPdfConfigItem()!=null) + displayfmt = sitem.getPdfConfigItem().getDisplay(); + } + Logger logger = Logger.getLogger(getClass().getName()); String errclass = getClass().getName()+".doEndTag()"; ! logger.debug(errclass+": Display Format is:" + displayfmt); + if (displayfmt){ + StringBuffer strbuf = new StringBuffer(); + String[] fmt = {pocOLAPConstants.ACTION_FORMAT_PDF}; + if (fmt.length > 1) { + strbuf = doTableHeader() ; + try { + strbuf.append("<tr><td>\n<select name=\""); + strbuf.append(pocOLAPConstants.ACTION_FORMAT); + strbuf.append("\" onchange=\"setAction('"); + strbuf.append(pocOLAPConstants.ACTION_FORMAT); + strbuf.append("');\">\n"); + strbuf.append("<option value=\"null\">Select Format</option>\n"); + + for(int j=0;j<fmt.length;j++){ + strbuf.append("<option value=\""); + strbuf.append(fmt[j]); + strbuf.append("\">"); + strbuf.append(fmt[j]); + strbuf.append("</option>\n"); + } + strbuf.append("</select></td></tr>\n"); + strbuf.append("</table>"); + writer.write(strbuf.toString()); + } + catch (IOException e) { + if (logger!=null){ + logger.error(errclass+": "+e.getMessage(),new Throwable(e)); + }else{ + System.out.println(errclass+": "+e.getMessage()); + e.printStackTrace(); + } + } + + } + else if (fmt.length == 1) { + strbuf = doTableHeader() ; + try{ + strbuf.append("<tr><td>\n<input type=\"text\" name=\""); + strbuf.append(pocOLAPConstants.ACTION_FORMAT); + strbuf.append("\" value=\""); + strbuf.append(fmt[0]); + strbuf.append("\" onclick=\"setAction('"); + strbuf.append(pocOLAPConstants.ACTION_FORMAT); + strbuf.append("');\">\n"); + strbuf.append("</td></tr>\n"); + strbuf.append("</table>"); + writer.write(strbuf.toString()); + } + catch(IOException e){ + if (logger!=null){ + logger.error(errclass+": "+e.getMessage(),new Throwable(e)); + }else{ + System.out.println(errclass+": "+e.getMessage()); + e.printStackTrace(); + } + } + } + } return retVal; } |
|
From: todd r. <to...@us...> - 2005-04-19 15:00:48
|
Update of /cvsroot/pocolap/pocolap/web In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6632/web Modified Files: index.html Log Message: Changed link to point to new demo Index: index.html =================================================================== RCS file: /cvsroot/pocolap/pocolap/web/index.html,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** index.html 17 Aug 2004 22:53:43 -0000 1.6 --- index.html 19 Apr 2005 15:00:39 -0000 1.7 *************** *** 17,21 **** </p> </td><td width="140"><p> ! <a href="http://crosstab.users.mcs2.netarray.com/pocolap/ReptPage.jsp">Live Demo</a> </p></td></tr></table> --- 17,21 ---- </p> </td><td width="140"><p> ! <a href="http://www.pocolap.com:8080/pocolap/ReptPage.jsp">Live Demo</a> </p></td></tr></table> *************** *** 26,30 **** <p>pocOLAP provides a web-based, crosstab reporting tool that looks like a standard spreadsheet. You can select which fields to display across the top and down the side. You can even drill down for more detail.</p> <p>While it's not an OLAP server or full fledged data mining solution, pocOLAP makes your data easy to use and understand. And perhaps best of all, it's free!</p> ! <p class="demo"><a class="demo" href="http://crosstab.users.mcs2.netarray.com/pocolap/ReptPage.jsp">Go to the live Demo</a></p> <p class="sourceforge"> <a href="http://sourceforge.net"> --- 26,30 ---- <p>pocOLAP provides a web-based, crosstab reporting tool that looks like a standard spreadsheet. You can select which fields to display across the top and down the side. You can even drill down for more detail.</p> <p>While it's not an OLAP server or full fledged data mining solution, pocOLAP makes your data easy to use and understand. And perhaps best of all, it's free!</p> ! <p class="demo"><a class="demo" href="http://www.pocolap.com:8080/pocolap/ReptPage.jsp">Go to the live Demo</a></p> <p class="sourceforge"> <a href="http://sourceforge.net"> |
|
From: Rashmi B. <ra...@us...> - 2005-04-19 00:40:09
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10932 Modified Files: FormatPDF.java Log Message: PDF related changes Index: FormatPDF.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format/FormatPDF.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FormatPDF.java 14 Apr 2005 22:35:24 -0000 1.1 --- FormatPDF.java 19 Apr 2005 00:39:58 -0000 1.2 *************** *** 4,34 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all [...1052 lines suppressed...] ! 5 | RXF | X | X | X | X | 5.0 So I need to merge these two arrays (harr[][], sheerarr[][]) to get newarr[][]. (Notice one row is less in sheetarr[][]) ! */ \ No newline at end of file --- 575,586 ---- X | X | 9.0 | 8.0 | 7.0 | 2.5 | 6.0 ------------------------------------------------------- ! 1 | Laces | X | 5.0 | 20.0 | X | X ! 2 | ABC | 2.0 | X | X | X | X ! 3 | XYZ | X | 7.5 | X | X | X ! 4 | ADF | X | X | 3.2 | X | X ! 5 | RXF | X | X | X | X | 5.0 So I need to merge these two arrays (harr[][], sheerarr[][]) to get newarr[][]. (Notice one row is less in sheetarr[][]) ! */ |
|
From: Rashmi B. <ra...@us...> - 2005-04-19 00:39:45
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/tags In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10837 Modified Files: ReptGrid.java Log Message: PDF related changes Index: ReptGrid.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/tags/ReptGrid.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ReptGrid.java 14 Apr 2005 22:32:38 -0000 1.17 --- ReptGrid.java 19 Apr 2005 00:39:35 -0000 1.18 *************** *** 4,24 **** Copyright (c) 2003 Todd Runstein ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --- 4,24 ---- Copyright (c) 2003 Todd Runstein ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ *************** *** 42,48 **** import com.pocolap.xtab.layout.SpreadSheet; import com.pocolap.selectors.Selector; ! import com.pocolap.servlets.pocOLAPConstants ; ! import org.apache.log4j.Logger ; import com.pocolap.schema.CrossTabDef ; --- 42,48 ---- import com.pocolap.xtab.layout.SpreadSheet; import com.pocolap.selectors.Selector; ! import com.pocolap.servlets.pocOLAPConstants ; ! import org.apache.log4j.Logger ; import com.pocolap.schema.CrossTabDef ; *************** *** 51,60 **** * ReptGrid is a heavy tag, consisting of select lists and a spreadsheet-like table. * This one should be broken out into more reusable components. ! * * @author todd * */ public class ReptGrid extends TagSupport { ! static Logger logger = Logger.getLogger(ReptGrid.class); /** --- 51,60 ---- * ReptGrid is a heavy tag, consisting of select lists and a spreadsheet-like table. * This one should be broken out into more reusable components. ! * * @author todd * */ public class ReptGrid extends TagSupport { ! static Logger logger = Logger.getLogger(ReptGrid.class); /** *************** *** 66,73 **** ! /** * doEndTag writes selection and report content ! * ! * @return int determines how remainder of page is processed * @throws JspExection if processing can not be completed */ --- 66,73 ---- ! /** * doEndTag writes selection and report content ! * ! * @return int determines how remainder of page is processed * @throws JspExection if processing can not be completed */ *************** *** 79,99 **** HttpServletRequest req = (HttpServletRequest)pageContext.getRequest(); HttpServletResponse res =(HttpServletResponse)pageContext.getResponse(); ! JspWriter writer = pageContext.getOut(); CrossTabDef crosstab = (CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); //Modified 6/16/2004 - TaR /* * This is somewhat screwy - there are three sets of public fields in ! * pocOLAPConstants that all equal the same thing - One set begins with * ACTION, the next with ELEMENT and the last with ATTR * This is so that you can use which ever matches the object ! * you're working with. In this case, we're working with ! * attributes, so we'll use the ATTR one - this may cause * some pain later, but at least it's documented now ;) */ Selector across = (Selector)req.getSession().getAttribute(pocOLAPConstants.ATTR_ACROSSSELECTOR); Selector down = (Selector)req.getSession().getAttribute(pocOLAPConstants.ATTR_DOWNSELECTOR); ! FilterList[] filters = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! try { writer.write(doReport(crosstab,down,across,filters)); --- 79,99 ---- HttpServletRequest req = (HttpServletRequest)pageContext.getRequest(); HttpServletResponse res =(HttpServletResponse)pageContext.getResponse(); ! JspWriter writer = pageContext.getOut(); CrossTabDef crosstab = (CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); //Modified 6/16/2004 - TaR /* * This is somewhat screwy - there are three sets of public fields in ! * pocOLAPConstants that all equal the same thing - One set begins with * ACTION, the next with ELEMENT and the last with ATTR * This is so that you can use which ever matches the object ! * you're working with. In this case, we're working with ! * attributes, so we'll use the ATTR one - this may cause * some pain later, but at least it's documented now ;) */ Selector across = (Selector)req.getSession().getAttribute(pocOLAPConstants.ATTR_ACROSSSELECTOR); Selector down = (Selector)req.getSession().getAttribute(pocOLAPConstants.ATTR_DOWNSELECTOR); ! FilterList[] filters = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! try { writer.write(doReport(crosstab,down,across,filters)); *************** *** 103,107 **** throw new JspException(e); } ! logger.debug(errclass+"End function doEndTag()"); return retVal; --- 103,107 ---- throw new JspException(e); } ! logger.debug(errclass+"End function doEndTag()"); return retVal; *************** *** 110,114 **** /** * doReport outputs the data via XTabQueryGenerator. ! * * @param crosstab * @param down --- 110,114 ---- /** * doReport outputs the data via XTabQueryGenerator. ! * * @param crosstab * @param down *************** *** 118,132 **** * @throws SQLException if the database can not be accessed * @throws IOException if content can't be written ! */ protected String doReport( ! CrossTabDef crosstab, ! Selector down, ! Selector across, ! FilterList[] filters) throws SQLException{ StringBuffer retVal = new StringBuffer(); ! String errclass = getClass().getName()+".doReport(CrossTabDef,Selector,Selector,FilterList[]): " ; ! QueryGenerator gen = new QueryGenerator(crosstab); int count=0; --- 118,132 ---- * @throws SQLException if the database can not be accessed * @throws IOException if content can't be written ! */ protected String doReport( ! CrossTabDef crosstab, ! Selector down, ! Selector across, ! FilterList[] filters) throws SQLException{ StringBuffer retVal = new StringBuffer(); ! String errclass = getClass().getName()+".doReport(CrossTabDef,Selector,Selector,FilterList[]): " ; ! QueryGenerator gen = new QueryGenerator(crosstab); int count=0; *************** *** 147,151 **** String query = gen.generateQuery(selectList,filters); if (query!=null && query.length()>0){ ! QueryAgent agent = new QueryAgent(crosstab); DetachedResultSet rs = agent.doMetaQuery(query); --- 147,151 ---- String query = gen.generateQuery(selectList,filters); if (query!=null && query.length()>0){ ! QueryAgent agent = new QueryAgent(crosstab); DetachedResultSet rs = agent.doMetaQuery(query); *************** *** 158,165 **** retVal.append(renderer.renderDynamicGrid(crosstab,sheet,down,across)); HttpServletRequest req = (HttpServletRequest)pageContext.getRequest(); ! req.getSession().setAttribute("SPREADSHEET",sheet); ! } } ! return retVal.toString(); } --- 158,165 ---- retVal.append(renderer.renderDynamicGrid(crosstab,sheet,down,across)); HttpServletRequest req = (HttpServletRequest)pageContext.getRequest(); ! req.getSession().setAttribute(pocOLAPConstants.ATTR_SPREADSHEET,sheet); ! } } ! return retVal.toString(); } *************** *** 169,173 **** /** * getSchema extracts the XTabSchema of the selected report ! * * @param req HttpServletRequest from which to extract the XTabSchema * @return XTabSchema for this session --- 169,173 ---- /** * getSchema extracts the XTabSchema of the selected report ! * * @param req HttpServletRequest from which to extract the XTabSchema * @return XTabSchema for this session *************** *** 176,185 **** return (XTabSchema)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); }*/ ! ! /** ! * getAvailableDimensions gets the Dimensions from the XTabSchema and * puts them in a String array. ! * * @param schema XTabSchema for this session * @return String[] of dimension names, or null if no dimensions are found --- 176,185 ---- return (XTabSchema)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); }*/ ! ! /** ! * getAvailableDimensions gets the Dimensions from the XTabSchema and * puts them in a String array. ! * * @param schema XTabSchema for this session * @return String[] of dimension names, or null if no dimensions are found *************** *** 188,192 **** String[] retVal = null; Vector temp = new Vector(); ! DimensionItem[] items = schema.getDimensions(); if (items!=null){ --- 188,192 ---- String[] retVal = null; Vector temp = new Vector(); ! DimensionItem[] items = schema.getDimensions(); if (items!=null){ *************** *** 205,209 **** return retVal; }*/ ! /** --- 205,209 ---- return retVal; }*/ ! /** *************** *** 211,242 **** * the group/drilldowns the user has selected, plus an additional * drilldown option (if the user can drilldown further) ! * * @param schema XTabSchema for the session * @param selecteditems Selector of selected dimension/groups * @param direction String matching one of the pocOLAPConstants directional values ! * * @throws IOException if content can't be written ! * @return String html formatted table of ! * */ /* protected String doSelector(XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); ! String[] dimensions = getAvailableDimensions(schema); String breakTag = getBreakTag(direction); ! String selectedDim = null; ! //Wrap this in a table retVal.append("\n<table><tr valign=\"top\" ><td valign=\"top\" >"); ! //Do dimensions - first select element if (selecteditems!=null && selecteditems.getItemCount()>0){ ! selectedDim = selecteditems.getSelectionItem(1).getGroupName(); } retVal.append(doDimensions(dimensions,selectedDim,direction)); ! //If a dimension was selected, we need to do the second select element //which will always be a group --- 211,242 ---- * the group/drilldowns the user has selected, plus an additional * drilldown option (if the user can drilldown further) ! * * @param schema XTabSchema for the session * @param selecteditems Selector of selected dimension/groups * @param direction String matching one of the pocOLAPConstants directional values ! * * @throws IOException if content can't be written ! * @return String html formatted table of ! * */ /* protected String doSelector(XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); ! String[] dimensions = getAvailableDimensions(schema); String breakTag = getBreakTag(direction); ! String selectedDim = null; ! //Wrap this in a table retVal.append("\n<table><tr valign=\"top\" ><td valign=\"top\" >"); ! //Do dimensions - first select element if (selecteditems!=null && selecteditems.getItemCount()>0){ ! selectedDim = selecteditems.getSelectionItem(1).getGroupName(); } retVal.append(doDimensions(dimensions,selectedDim,direction)); ! //If a dimension was selected, we need to do the second select element //which will always be a group *************** *** 244,248 **** retVal.append(breakTag); retVal.append(doGroups(schema,selecteditems,direction)); ! //If a group was selected, do drilldowns too if (selecteditems.getItemCount()>1){ --- 244,248 ---- retVal.append(breakTag); retVal.append(doGroups(schema,selecteditems,direction)); ! //If a group was selected, do drilldowns too if (selecteditems.getItemCount()>1){ *************** *** 250,299 **** } } ! //close the table retVal.append("\n</td></tr></table>"); ! return retVal.toString(); }*/ ! /** * doDrillDowns creates select lists of tables and fields that should appear * on the grid (report) ! * * @param schema XTabSchema for the session * @param selecteditems Selector representing previously selected dimensions * @param direction String matching on of the pocOLAPConstants directional variables\ * @return String HTML formatted lists of tables and fields ! */ /* protected String doDrillDowns( XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); ! //DrillDowns are always element 3 or higher int number = 3; ! //We'll use this before the last option for visual effect String stepDown = "\n</td></tr><tr><td> </td><td>"; ! //Dimension is always first element if (selecteditems!=null && selecteditems.getItemCount()>0){ ! DimensionItem dimension = schema.getDimension(selecteditems.getSelectionItem(1).getGroupName()); ! //Group is always the second element if (selecteditems.getItemCount()>1){ ! GroupItem group = dimension.getGroup(selecteditems.getSelectionItem(2).getGroupName()); ! //Get the drilldown options DrillDownItem[] drilldowns = group.getDrilldowns(); ! //This will be used to extract names from DrillDownItems String[] ddNames = null; ! if (selecteditems.getItemCount()>2){ //At least one drilldown has already been selected --- 250,299 ---- } } ! //close the table retVal.append("\n</td></tr></table>"); ! return retVal.toString(); }*/ ! /** * doDrillDowns creates select lists of tables and fields that should appear * on the grid (report) ! * * @param schema XTabSchema for the session * @param selecteditems Selector representing previously selected dimensions * @param direction String matching on of the pocOLAPConstants directional variables\ * @return String HTML formatted lists of tables and fields ! */ /* protected String doDrillDowns( XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); ! //DrillDowns are always element 3 or higher int number = 3; ! //We'll use this before the last option for visual effect String stepDown = "\n</td></tr><tr><td> </td><td>"; ! //Dimension is always first element if (selecteditems!=null && selecteditems.getItemCount()>0){ ! DimensionItem dimension = schema.getDimension(selecteditems.getSelectionItem(1).getGroupName()); ! //Group is always the second element if (selecteditems.getItemCount()>1){ ! GroupItem group = dimension.getGroup(selecteditems.getSelectionItem(2).getGroupName()); ! //Get the drilldown options DrillDownItem[] drilldowns = group.getDrilldowns(); ! //This will be used to extract names from DrillDownItems String[] ddNames = null; ! if (selecteditems.getItemCount()>2){ //At least one drilldown has already been selected *************** *** 301,307 **** //and display it's drilldowns. Keep doing this until //we hit the last selecteditem that do the drilldowns ! //for that group (if any exist). I know that's a lot to //digest - don't worry, I'll walk you through it! ! // _outdated: Since dimension is 0, group is 1, we will loop through // _outdated: selected items starting at 2 and go to the end --- 301,307 ---- //and display it's drilldowns. Keep doing this until //we hit the last selecteditem that do the drilldowns ! //for that group (if any exist). I know that's a lot to //digest - don't worry, I'll walk you through it! ! // _outdated: Since dimension is 0, group is 1, we will loop through // _outdated: selected items starting at 2 and go to the end *************** *** 312,318 **** //Extract drilldown names if (drilldowns!=null){ ! ddNames = getPreviouslyUnusedDrillDowns(selecteditems,drilldowns,x-1); ! if (ddNames!=null){ retVal.append(getBreakTag(direction)); --- 312,318 ---- //Extract drilldown names if (drilldowns!=null){ ! ddNames = getPreviouslyUnusedDrillDowns(selecteditems,drilldowns,x-1); ! if (ddNames!=null){ retVal.append(getBreakTag(direction)); *************** *** 321,334 **** }else{ break; ! } } ! } } //Whatever the last item picked was, we need to get the drilldowns //for it, write the stepDown, then write the element ! //Extract drilldown names, excluding drilldowns that are ! //already picked ! if (drilldowns!=null){ ddNames= getPreviouslyUnusedDrillDowns(selecteditems,drilldowns,selecteditems.getItemCount()); if (ddNames!=null){ --- 321,334 ---- }else{ break; ! } } ! } } //Whatever the last item picked was, we need to get the drilldowns //for it, write the stepDown, then write the element ! //Extract drilldown names, excluding drilldowns that are ! //already picked ! if (drilldowns!=null){ ddNames= getPreviouslyUnusedDrillDowns(selecteditems,drilldowns,selecteditems.getItemCount()); if (ddNames!=null){ *************** *** 342,346 **** return retVal.toString(); }*/ ! /** --- 342,346 ---- return retVal.toString(); }*/ ! /** *************** *** 348,352 **** * for drilling down - eliminates the ability to drilldown into a dimension that has * already been drilled into (endless loop). ! * * @param selecteditems Selector representing previously selected dimensions * @param drilldowns DrillDownItem[] from XTabSchema --- 348,352 ---- * for drilling down - eliminates the ability to drilldown into a dimension that has * already been drilled into (endless loop). ! * * @param selecteditems Selector representing previously selected dimensions * @param drilldowns DrillDownItem[] from XTabSchema *************** *** 355,359 **** */ /*protected String[] getPreviouslyUnusedDrillDowns( ! Selector selecteditems, DrillDownItem[] drilldowns, int currentItem){ --- 355,359 ---- */ /*protected String[] getPreviouslyUnusedDrillDowns( ! Selector selecteditems, DrillDownItem[] drilldowns, int currentItem){ *************** *** 367,371 **** boolean wasFound = false; String checkName = drilldowns[x].getName(); ! //We can safely skip the first selecteditem since it is a //DimensionItem and we are only interested in DrillDownItem //names (which are just names of GroupItems) --- 367,371 ---- boolean wasFound = false; String checkName = drilldowns[x].getName(); ! //We can safely skip the first selecteditem since it is a //DimensionItem and we are only interested in DrillDownItem //names (which are just names of GroupItems) *************** *** 384,388 **** } } ! //Convert the vector to an array if (unused.size()>0){ --- 384,388 ---- } } ! //Convert the vector to an array if (unused.size()>0){ *************** *** 392,396 **** } } ! return retVal; }*/ --- 392,396 ---- } } ! return retVal; }*/ *************** *** 398,421 **** /** * doGroups creates a select list for groups of an XTabSchema ! * * @param schema XTabSchema for the session * @param selecteditems Selector representing currently selected dimensions * @param direction String matching one of the pocOLAPConstants directional variables * @throws IOException if content can't be written ! */ /* protected String doGroups( XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); //Groups are always the second element ! int number = 2; //Selected dimension is always first element String selectedDimension = selecteditems.getSelectionItem(1).getGroupName(); ! if (selectedDimension!=null){ DimensionItem dim = schema.getDimension(selectedDimension); ! //Selected group (if exists) is always second element String selectedGroup = null; --- 398,421 ---- /** * doGroups creates a select list for groups of an XTabSchema ! * * @param schema XTabSchema for the session * @param selecteditems Selector representing currently selected dimensions * @param direction String matching one of the pocOLAPConstants directional variables * @throws IOException if content can't be written ! */ /* protected String doGroups( XTabSchema schema, Selector selecteditems, String direction){ ! StringBuffer retVal = new StringBuffer(); //Groups are always the second element ! int number = 2; //Selected dimension is always first element String selectedDimension = selecteditems.getSelectionItem(1).getGroupName(); ! if (selectedDimension!=null){ DimensionItem dim = schema.getDimension(selectedDimension); ! //Selected group (if exists) is always second element String selectedGroup = null; *************** *** 425,429 **** selectedGroup = dim.getDefGroup(); } ! //Get the group names GroupItem[] groups = dim.getGroups(); --- 425,429 ---- selectedGroup = dim.getDefGroup(); } ! //Get the group names GroupItem[] groups = dim.getGroups(); *************** *** 432,436 **** groupNames[x]=groups[x].getName(); } ! //Draw the element retVal.append(XTabMain.drawSelectList(groupNames,direction+number,selectedGroup,false)); --- 432,436 ---- groupNames[x]=groups[x].getName(); } ! //Draw the element retVal.append(XTabMain.drawSelectList(groupNames,direction+number,selectedGroup,false)); *************** *** 438,445 **** return retVal.toString(); } */ ! /** * doDimensions creates a select list for dimensions of an XTabSchema ! * * @param dimensions String[] of dimensions from XTabSchema for the session * @param selected String selected dimension --- 438,445 ---- return retVal.toString(); } */ ! /** * doDimensions creates a select list for dimensions of an XTabSchema ! * * @param dimensions String[] of dimensions from XTabSchema for the session * @param selected String selected dimension *************** *** 451,468 **** String selected, String direction){ ! StringBuffer retVal = new StringBuffer(); ! boolean forceTopLevel = (selected==null); int number = 1; //Dimensions are always the first select list retVal.append(XTabMain.drawSelectList(dimensions,direction+number,selected,forceTopLevel)); ! return retVal.toString(); }*/ ! /** * getBreakTag determines whether a <code><br/></code> tag should * be output ! * * @param direction String matching one of the pocOLAPConstants directional variables * @return String suitable for html output --- 451,468 ---- String selected, String direction){ ! StringBuffer retVal = new StringBuffer(); ! boolean forceTopLevel = (selected==null); int number = 1; //Dimensions are always the first select list retVal.append(XTabMain.drawSelectList(dimensions,direction+number,selected,forceTopLevel)); ! return retVal.toString(); }*/ ! /** * getBreakTag determines whether a <code><br/></code> tag should * be output ! * * @param direction String matching one of the pocOLAPConstants directional variables * @return String suitable for html output *************** *** 475,478 **** return retVal; }*/ ! } --- 475,478 ---- return retVal; }*/ ! } |
|
From: Rashmi B. <ra...@us...> - 2005-04-19 00:39:26
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/servlets In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10744 Modified Files: FormatHelper.java PDFServlet.java pocOLAPConstants.java Log Message: PDF related changes Index: FormatHelper.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/FormatHelper.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FormatHelper.java 14 Apr 2005 22:32:08 -0000 1.1 --- FormatHelper.java 19 Apr 2005 00:39:16 -0000 1.2 *************** *** 4,24 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --- 4,24 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ *************** *** 27,43 **** package com.pocolap.servlets; ! import javax.servlet.http.HttpServletRequest ; import javax.servlet.http.HttpServletResponse ; import javax.servlet.ServletException ; import org.apache.log4j.Logger; ! import java.util.HashMap; import com.pocolap.schema.CrossTabDef; import com.pocolap.selectors.Selector ; ! import com.pocolap.xtab.filter.FilterList ; ! import com.pocolap.xtab.layout.SpreadSheet; import java.io.ByteArrayOutputStream; import javax.servlet.ServletOutputStream; ! import com.pocolap.xtab.format.FormatPDF ; /** --- 27,43 ---- package com.pocolap.servlets; ! import javax.servlet.http.HttpServletRequest ; import javax.servlet.http.HttpServletResponse ; import javax.servlet.ServletException ; import org.apache.log4j.Logger; ! import java.util.HashMap; import com.pocolap.schema.CrossTabDef; import com.pocolap.selectors.Selector ; ! import com.pocolap.xtab.filter.FilterList ; ! import com.pocolap.xtab.layout.SpreadSheet; import java.io.ByteArrayOutputStream; import javax.servlet.ServletOutputStream; ! import com.pocolap.xtab.format.FormatPDF ; /** *************** *** 46,64 **** * @author Rashmi Banthia */ ! public class FormatHelper implements ServletHelper { ! private HashMap parameters ; static Logger logger = Logger.getLogger(SavedReportHelper.class); ! protected Selector acrossselector ; ! protected Selector downselector ; ! protected FilterList[] filterlist ; ! /** Creates a new instance of SavedReportHelper */ ! public FormatHelper() { } ! /** * processRequest processes request for ACTION_FORMAT and sets session variables. ! * * @param req HttpServletRequest from the webserver * @param res HttpServletResponse from the webserver --- 46,64 ---- * @author Rashmi Banthia */ ! public class FormatHelper implements ServletHelper { ! private HashMap parameters ; static Logger logger = Logger.getLogger(SavedReportHelper.class); ! protected Selector acrossselector ; ! protected Selector downselector ; ! protected FilterList[] filterlist ; ! /** Creates a new instance of SavedReportHelper */ ! public FormatHelper() { } ! /** * processRequest processes request for ACTION_FORMAT and sets session variables. ! * * @param req HttpServletRequest from the webserver * @param res HttpServletResponse from the webserver *************** *** 66,104 **** */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null ; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; ! ! String action = (String)req.getParameter(pocOLAPConstants.XTAB_ACTION); ! ! if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute("SPREADSHEET"); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet); ! ! req.getSession().setAttribute("PDFBAOS",baos); ! page = "PDFServlet"; ! } return page ; } ! ! public ByteArrayOutputStream createPDF(CrossTabDef curr, ! Selector down, Selector across, FilterList[] filterlist , SpreadSheet spsheet ){ ! ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet); ! return baos ; } ! ! } \ No newline at end of file --- 66,104 ---- */ public String processRequest(HttpServletRequest req, HttpServletResponse res) throws ServletException { ! String page = null ; parameters = (HashMap)req.getParameterMap(); String errclass = getClass().getName()+".processRequest(HttpServletRequest,HttpServletResponse): "; ! ! String action = (String)req.getParameter(pocOLAPConstants.XTAB_ACTION); ! ! if (action.equalsIgnoreCase(pocOLAPConstants.ACTION_FORMAT)) { ! String fmt = (String)req.getParameter(pocOLAPConstants.ACTION_FORMAT); logger.debug(errclass+"Action = Format Report , Format = " + fmt ); ! CrossTabDef currDefinition =(CrossTabDef)req.getSession().getAttribute(pocOLAPConstants.ATTR_SCHEMA); ! Selector downselector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_DOWN_START); Selector acrossSelector = (Selector)req.getSession().getAttribute(pocOLAPConstants.ACTION_ACROSS_START); ! FilterList[] flist = (FilterList[])req.getSession().getAttribute(pocOLAPConstants.ATTR_FILTERS); ! SpreadSheet sheet = (SpreadSheet) req.getSession().getAttribute(pocOLAPConstants.ATTR_SPREADSHEET); ! ByteArrayOutputStream baos = createPDF(currDefinition,downselector,acrossSelector,flist,sheet); ! ! req.getSession().setAttribute(pocOLAPConstants.ATTR_BAOS,baos); ! page = pocOLAPConstants.SERVLET_PDF; ! } return page ; } ! ! public ByteArrayOutputStream createPDF(CrossTabDef curr, ! Selector down, Selector across, FilterList[] filterlist , SpreadSheet spsheet ){ ! ! ByteArrayOutputStream baos = new FormatPDF().createPDF(curr,down,across,filterlist,spsheet); ! return baos ; } ! ! } Index: PDFServlet.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/PDFServlet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PDFServlet.java 14 Apr 2005 22:32:08 -0000 1.1 --- PDFServlet.java 19 Apr 2005 00:39:17 -0000 1.2 *************** *** 4,27 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ! package com.pocolap.servlets; --- 4,27 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ ! package com.pocolap.servlets; *************** *** 34,57 **** import java.io.PrintWriter; import java.io.IOException; ! import org.apache.log4j.Logger ; public class PDFServlet extends HttpServlet { ! static Logger logger = Logger.getLogger(PDFServlet.class); ! public PDFServlet() { super(); } ! public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String errclass = getClass().getName()+".doGet(HttpServletRequest,HttpServletResponse): "; ! ByteArrayOutputStream baosPDF = null; ! ! baosPDF = (ByteArrayOutputStream) req.getSession().getAttribute("PDFBAOS"); ! resp.setContentType("application/pdf"); resp.setContentLength(baosPDF.size()); --- 34,57 ---- import java.io.PrintWriter; import java.io.IOException; ! import org.apache.log4j.Logger ; public class PDFServlet extends HttpServlet { ! static Logger logger = Logger.getLogger(PDFServlet.class); ! public PDFServlet() { super(); } ! public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String errclass = getClass().getName()+".doGet(HttpServletRequest,HttpServletResponse): "; ! ByteArrayOutputStream baosPDF = null; ! ! baosPDF = (ByteArrayOutputStream) req.getSession().getAttribute(pocOLAPConstants.ATTR_BAOS); ! resp.setContentType("application/pdf"); resp.setContentLength(baosPDF.size()); *************** *** 64,72 **** out.flush(); } ! catch(IOException ioe) { logger.error(errclass + ioe.getMessage()); } ! } ! } --- 64,72 ---- out.flush(); } ! catch(IOException ioe) { logger.error(errclass + ioe.getMessage()); } ! } ! } Index: pocOLAPConstants.java =================================================================== RCS file: /cvsroot/pocolap/pocolap/src/com/pocolap/servlets/pocOLAPConstants.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** pocOLAPConstants.java 14 Apr 2005 22:31:28 -0000 1.9 --- pocOLAPConstants.java 19 Apr 2005 00:39:17 -0000 1.10 *************** *** 4,24 **** Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ --- 4,24 ---- Copyright (c) 2005 Rashmi Banthia ! Permission is hereby granted, free of charge, to any person obtaining a copy ! of this software and associated documentation files (the "Software"), to deal ! in the Software without restriction, including without limitation the rights to use, ! copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the ! Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: ! The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. ! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ! EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES ! OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND ! NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT ! HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, ! WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING ! FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ *************** *** 27,37 **** /** ! * pocOLAPConstants contains the constants required. ! * * @author Rashmi Banthia * */ ! public final class pocOLAPConstants { ! /**Action is used to tell the servlet what was requested. This is the name used * by the <com.pocolap.tags.Action> tag.*/ --- 27,37 ---- /** ! * pocOLAPConstants contains the constants required. ! * * @author Rashmi Banthia * */ ! public final class pocOLAPConstants { ! /**Action is used to tell the servlet what was requested. This is the name used * by the <com.pocolap.tags.Action> tag.*/ *************** *** 74,94 **** public static final String ACTION_COMBINE_CHANGE = ELEMENT_FILTER_COMBINE; public static final String ACTION_FILTER_SET = "fltr.set"; ! public static final String ACTION_FILTER_PREFIX = "fltr" ; public static final String ACTION_ADMN_PREFIX = "admn" ; public static final String ACTION_ADMN_DISPLAYLOG4J = "admn.displaylog4j"; public static final String ACTION_ADMN_REINIT = "admn.reinit"; ! public static final String ACTION_LOAD_REPT = "load.rept" ; ! public static final String ACTION_FORMAT_PDF = "PDF" ; public static final String ACTION_FORMAT = "format" ; ! /*ATTRs are used for session attribute names*/ public static final String ATTR_REPT_LIST = "reptlist"; public static final String ATTR_REPT_SELECTED = "selrept"; public static final String ATTR_SCHEMA = "currschema"; //XTabSchema ! /**ATTR_DOWNSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ public static final String ATTR_DOWNSELECTOR = ELEMENT_SELECTOR_DOWN; //Vector of Strings ! /**ATTR_ACROSSSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ --- 74,94 ---- public static final String ACTION_COMBINE_CHANGE = ELEMENT_FILTER_COMBINE; public static final String ACTION_FILTER_SET = "fltr.set"; ! public static final String ACTION_FILTER_PREFIX = "fltr" ; public static final String ACTION_ADMN_PREFIX = "admn" ; public static final String ACTION_ADMN_DISPLAYLOG4J = "admn.displaylog4j"; public static final String ACTION_ADMN_REINIT = "admn.reinit"; ! public static final String ACTION_LOAD_REPT = "load.rept" ; ! public static final String ACTION_FORMAT_PDF = "PDF" ; public static final String ACTION_FORMAT = "format" ; ! /*ATTRs are used for session attribute names*/ public static final String ATTR_REPT_LIST = "reptlist"; public static final String ATTR_REPT_SELECTED = "selrept"; public static final String ATTR_SCHEMA = "currschema"; //XTabSchema ! /**ATTR_DOWNSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ public static final String ATTR_DOWNSELECTOR = ELEMENT_SELECTOR_DOWN; //Vector of Strings ! /**ATTR_ACROSSSELECTOR is a Vector of Strings. The first element will always * point to a Dimension. The second, always to a Group within that dimension. * All others point to Drilldowns(Groups) */ *************** *** 100,103 **** --- 100,106 ---- public static final String ATTR_FILTER_ACTION = "faction"; //String public static final String ATTR_DETAIL_ITEM = "ditem"; //Integer + public static final String ATTR_SPREADSHEET = "SPREADSHEET" ; + //PDF ByteArrayOutputStream + public static final String ATTR_BAOS = "PDFBAOS" ; /** Items for ResourceServlet **/ *************** *** 106,111 **** public static final String VALUE_RESOURCE_TYPE_BINARY = "image"; public static final String VALUE_RESOURCE_TYPE_TEXT = "html"; ! ! /** In web.xml, only param-names starting with "whs_" will be * considered WareHouse Schema files */ public static final String CONFIG_FILE_TAG = "whs_"; --- 109,114 ---- public static final String VALUE_RESOURCE_TYPE_BINARY = "image"; public static final String VALUE_RESOURCE_TYPE_TEXT = "html"; ! ! /** In web.xml, only param-names starting with "whs_" will be * considered WareHouse Schema files */ public static final String CONFIG_FILE_TAG = "whs_"; *************** *** 114,125 **** public static final String SERVLET = "servlets/XTabMain"; public static final String SERVLET_RESOURCES = "servlets/Resources"; ! public static final String PAGE_MAIN = "ReptPage.jsp"; public static final String PAGE_FILTER_VIEW = "FilterView.jsp"; public static final String PAGE_FILTER_DETAILS = "FilterDetail.jsp"; public static final String PAGE_ADMIN = "Admin.jsp"; ! public static final String DEFAULT_NULL_OPTION_LABEL = "Select a table"; public static final String NULL_VALUE = "null"; ! } \ No newline at end of file --- 117,129 ---- public static final String SERVLET = "servlets/XTabMain"; public static final String SERVLET_RESOURCES = "servlets/Resources"; ! public static final String SERVLET_PDF = "PDFServlet"; ! public static final String PAGE_MAIN = "ReptPage.jsp"; public static final String PAGE_FILTER_VIEW = "FilterView.jsp"; public static final String PAGE_FILTER_DETAILS = "FilterDetail.jsp"; public static final String PAGE_ADMIN = "Admin.jsp"; ! public static final String DEFAULT_NULL_OPTION_LABEL = "Select a table"; public static final String NULL_VALUE = "null"; ! } |
|
From: Rashmi B. <ra...@us...> - 2005-04-14 22:35:35
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24963 Added Files: FormatPDF.java HeaderEvent.java Log Message: PDF related changes --- NEW FILE: HeaderEvent.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import com.lowagie.text.Document; import com.lowagie.text.ExceptionConverter; import com.lowagie.text.Paragraph; import com.lowagie.text.Rectangle; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfContentByte; import com.lowagie.text.pdf.PdfPTable; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPageEventHelper; import com.lowagie.text.pdf.PdfWriter; import com.pocolap.schema.CrossTabDef; import com.lowagie.text.Element; import com.lowagie.text.FontFactory ; import com.lowagie.text.Font; import java.awt.Color; import java.util.Date ; import com.pocolap.xtab.filter.FilterList ; import com.pocolap.xtab.filter.HTMLFilterFormatter; import com.lowagie.text.pdf.PdfTemplate; import org.apache.log4j.Logger ; public class HeaderEvent extends PdfPageEventHelper { static Logger logger = Logger.getLogger(HeaderEvent.class); private CrossTabDef currdefinition ; private FilterList[] flist ; /** A template that will hold the total number of pages. */ public PdfTemplate tpl; public HeaderEvent(){} public HeaderEvent(CrossTabDef curr,FilterList[] filterlist ){ this.currdefinition = curr ; this.flist = filterlist ; } public void onOpenDocument(PdfWriter writer, Document document) { try { // initialization of the template tpl = writer.getDirectContent().createTemplate(100, 100); } catch(Exception e) { throw new ExceptionConverter(e); } } public void onEndPage(PdfWriter writer, Document document) { try { String errclass = getClass().getName()+".onEndPage(PdfWriter,Document): "; String reporttitle = currdefinition.getCrossTabDef().getRept().getName(); Rectangle page = document.getPageSize(); PdfPTable head = new PdfPTable(1); //One column head.setTotalWidth(page.width() - document.leftMargin() - document.rightMargin()); //Adding Report Title logger.debug(errclass+" Adding report title to header"); Paragraph p = new Paragraph(reporttitle,FontFactory.getFont(FontFactory.TIMES_ROMAN, 18, Font.BOLD, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBorder(Rectangle.NO_BORDER); head.addCell(cell); //Adding Current DateTime logger.debug(errclass+" Adding current datetime"); p = new Paragraph(new Date().toString()+"\n",FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, Color.black)); cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_LEFT); if (flist!=null) cell.setBorder(Rectangle.NO_BORDER); else cell.setBorder(Rectangle.BOTTOM); head.addCell(cell); //Adding filter information logger.debug(errclass+" Adding filter information to header"); int var = 0 ; if (flist!=null){ for (int i=0;i<flist.length;var=i,i++){ if (flist[i]!=null){ String val[][] = new HTMLFilterFormatter().getFilterText(flist[i]); StringBuffer retval = new StringBuffer(flist[i].getName() + ": "); for (int x=0;x<val.length;x++){ if (val[x][0].trim().equals("")){ retval.append(" "); }else{ retval.append(val[x][0]); } retval.append(val[x][1]); } p = new Paragraph(retval.toString(),FontFactory.getFont(FontFactory.TIMES_ROMAN, 10, Font.NORMAL, Color.black)); cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); if ((i+1)==flist.length) cell.setBorder(Rectangle.BOTTOM); else cell.setBorder(Rectangle.NO_BORDER); head.addCell(cell); } } } //Writing the header head.writeSelectedRows(0, -1, document.leftMargin(), page.height(), writer.getDirectContent()); //Writing Footer logger.debug(errclass+" Writing footer"); String text = "Page " + writer.getPageNumber() + " of "; PdfContentByte cb = writer.getDirectContent(); cb.saveState(); BaseFont helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false); float textSize = helv.getWidthPoint(text, 12); float textBase = document.bottom() - 20; cb.beginText(); cb.setFontAndSize(helv, 12); float adjust = helv.getWidthPoint("0", 12); cb.setTextMatrix(document.right() - textSize - adjust, textBase); cb.showText(text); cb.endText(); cb.addTemplate(tpl, document.right() - adjust, textBase); cb.saveState(); cb.moveTo(document.bottom(), document.leftMargin()-7); cb.lineTo(page.width()-document.rightMargin(), document.leftMargin()-7); cb.stroke(); cb.restoreState(); } catch (Exception e) { throw new ExceptionConverter(e); } } public void onCloseDocument(PdfWriter writer, Document document) { try { tpl.beginText(); BaseFont helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false); tpl.setFontAndSize(helv, 12); tpl.setTextMatrix(0, 0); tpl.showText("" + (writer.getPageNumber() - 1)); tpl.endText(); } catch(Exception e) { throw new ExceptionConverter(e); } } } --- NEW FILE: FormatPDF.java --- /* * Created on Apr 14, 2005 by Rashmi Banthia * Copyright (c) 2005 Rashmi Banthia Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ package com.pocolap.xtab.format ; import com.pocolap.selectors.Selector ; import com.pocolap.xtab.filter.FilterList ; import com.pocolap.schema.CrossTabDef; import com.pocolap.xtab.layout.SpreadSheet; import org.apache.log4j.Logger ; import java.awt.Color; import com.lowagie.text.pdf.PdfWriter; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable ; import com.lowagie.text.Element ; import com.lowagie.text.Rectangle; import com.lowagie.text.Font ; import com.lowagie.text.Paragraph ; import com.lowagie.text.Document ; import com.lowagie.text.PageSize; import com.lowagie.text.DocumentException ; import com.lowagie.text.FontFactory; import java.io.ByteArrayOutputStream; import java.lang.Math; public class FormatPDF { static Logger logger = Logger.getLogger(FormatPDF.class); private CrossTabDef currdefinition ; private Selector downselector ; private Selector acrossSelector; private FilterList[] flist ; private SpreadSheet sheet ; public FormatPDF(){ } public ByteArrayOutputStream createPDF( CrossTabDef curr, Selector down, Selector across, FilterList[] filterlist , SpreadSheet spsheet ){ String errclass = getClass().getName()+".createPDF(CrossTabDef,Selector,Selector,FilterList[],SpreadSheet): "; logger.debug(errclass+ "Printing PDF file .."); this.currdefinition = curr; this.downselector = down ; this.acrossSelector = across ; this.flist = filterlist ; this.sheet = spsheet ; ByteArrayOutputStream baos = null; /* Deciding the 'top' margin for the page is based on - how much space will header occupy. So PdfPTable.getRowHeight() gives: 'Report Title' Height = 22 points; 'Date' row Height = 14 points; Each filter row height = 14 points 10 pt is the extra space between the header and begining of table.*/ int top = 36+10 ; if (flist!=null) top = top + (flist.length * 14); Document document = new Document(PageSize.A4.rotate(), 36, 36, top, 36); //(PageSize,left,right,top,margin) try{ baos = new ByteArrayOutputStream(); PdfWriter writer = PdfWriter.getInstance(document, baos); addMetaData(document); //This will create Header and Footer writer.setPageEvent(new HeaderEvent(currdefinition,flist)); document.open(); createTable(writer,document); } catch(DocumentException de) { System.err.println(de.getMessage()); } document.close(); return baos ; } private void addMetaData(Document document){ String errclass = getClass().getName()+".addMetaData(Document): "; logger.debug(errclass+ "Adding meta data .."); document.addTitle("pocOLAP Report"); document.addSubject("pocOLAP Report"); document.addKeywords("pocOLAP, CrossTab, Report"); document.addCreator("iText"); document.addAuthor("Rashmi Banthia"); } private void createTable(PdfWriter writer,Document document) { String errclass = getClass().getName()+".createTable(PdfWriter,Document): "; logger.debug(errclass+ "Creating table .."); String[][] harr = fillTopLeftHeader(); if (harr==null) //no selectors selected { PdfPTable table = new PdfPTable(1); ; table.addCell(sheet.toArray()[0][0]); try{ document.add(table); } catch(DocumentException de) { System.err.println(de.getMessage()); } return ; } //Merge Arrays Header+Spreadsheet String[][] newarr = mergeArrays(harr); //Decide how many cols on a page int totalpoints = (int)PageSize.A4.rotate().right() - 36 - 36 ; //left and right margins // logger.debug("Totalpoints on this page: " + totalpoints); float[] maxlen; //contains the points required for each column in newarr[][]. maxlen = new float[newarr[0].length]; boolean flag = true ; for (int i=0;i<newarr[0].length;i++){ int max = 0; for (int j=0;j<newarr.length;j++){ if ((newarr[j][i]!=null) && (newarr[j][i].length()> max) ) max = newarr[j][i].length() ; } if (max>((totalpoints/10)/2)) //Nothing more than 50% of the page maxlen[i] = ((totalpoints/10)/2) * 10; else maxlen[i] = Math.round(max * 10); //1 character = 10 points } // for(int i=0;i<maxlen.length;i++){ // logger.debug("i=" + i + " Col length:" + maxlen[i]); // } //Calculate the no. of points required for header columns int hcolpoints = 0; for (int i=0;i<harr[0].length;i++){ hcolpoints = hcolpoints + (int)maxlen[i]; } // logger.debug("Header column points : " + hcolpoints); int totaltables = 0,sum=0; //Calculate no. of tables // logger.debug("Calculate no. of tables"); for (int i=0,j=harr[0].length ;j<maxlen.length;totaltables = i,i++){ sum = hcolpoints ; for (int k = 0; j<maxlen.length; j++,k++){ if ((sum + maxlen[j]) > totalpoints) break ; sum = sum + (int)maxlen[j]; } // logger.debug("i="+i+" sum="+sum); } totaltables ++ ; //Calculate no. of cols per page float[][] nw ; nw = new float[totaltables][]; for (int i=0,j=harr[0].length ;i < totaltables ;i++){ sum = hcolpoints ; int k = 0; for (k = 0; j<maxlen.length; j++,k++){ if ((sum + maxlen[j]) > totalpoints){ nw[i] = new float[k+harr[0].length]; break; } sum = sum + (int)maxlen[j]; } if (j==maxlen.length) nw[i] = new float[k+harr[0].length]; } //set the column width for each column for (int i=0,k=harr[0].length ; i< totaltables ; i++) { for (int j=0;j<nw[i].length;j++){ if (j<harr[0].length) nw[i][j] = maxlen[j] ; else nw[i][j] = maxlen[k++]; } } //Col split to more than one page for (int i=0 ,z=harr[0].length ; i< totaltables ; i++) { String[][] smallarr; smallarr=new String[newarr.length][nw[i].length]; for(int x=0;x<newarr.length;x++) for(int k=0;k<nw[i].length;k++) smallarr[x][k] = " "; //Copy the headers for (int k=0;k<newarr.length;k++){ for (int j=0;j<harr[0].length;j++){ smallarr[k][j] = newarr[k][j]; } } //Append the remaining cols for (int x=harr[0].length; x<nw[i].length ; x++,z++){ for (int k=0;k<newarr.length;k++){ smallarr[k][x] = newarr[k][z]; } } PdfPTable table ; table = formatTable(harr,smallarr); table.setLockedWidth(true); try{ table.setTotalWidth(nw[i]); document.add(table); document.newPage(); } catch(DocumentException de) { System.err.println(de.getMessage()); } } } private String[][] fillTopLeftHeader(){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; String[][] cellarr; if (fixedrow==0 && fixedcol==0) return null; fixedrow = (fixedrow==0)?1:(fixedcol==0?fixedrow:fixedrow+1) ; fixedcol= (fixedcol==0)?1:fixedcol ; cellarr = new String[fixedrow][fixedcol]; if(fixedrow>0) for (int i = 0;i<(sheet.getFixedColumnCount()==0?fixedrow:fixedrow-1);i++) cellarr[i][fixedcol-1]=acrossSelector.getSelectionItem(i+2).getGroupName(); if (sheet.getFixedColumnCount()>0) for(int j=0;j<fixedcol;j++) cellarr[fixedrow-1][j]=downselector.getSelectionItem(j+2).getGroupName(); return cellarr; } private String[][] mergeArrays(String[][] harr){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; String[][] sheetarr = sheet.toArray(); String[][] newarr ; int rows = sheetarr.length; int cols = sheetarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length ; if (fixedcol==0) cols++; if (fixedrow==0 || (fixedrow>0 && fixedcol>0)) rows++; newarr = new String[rows][cols]; if (fixedcol==0){ for (int i=0;i<rows;i++){ for(int j=0;j<cols;j++){ if (i<hrow && j<hcol) newarr[i][j] = harr[i][j] ; else { newarr[i][j] = (j>0)?sheetarr[i][j-1]:"Totals" ; } } } } if (fixedrow==0 || (fixedrow>0 && fixedcol>0)) { for (int i=0;i<rows;i++){ for(int j=0;j<cols;j++){ if (i<hrow && j<hcol) newarr[i][j] = harr[i][j] ; else{ if (i==fixedrow) newarr[i][j] = (i==0)?"Totals":" " ; else newarr[i][j] = (i>fixedrow)?sheetarr[i-1][j]:sheetarr[i][j] ; } } } } return newarr ; } private PdfPTable formatTable(String[][] harr,String[][] newarr){ int fixedrow = sheet.getFixedRowCount() ; int fixedcol = sheet.getFixedColumnCount() ; int rows = newarr.length; int cols = newarr[0].length ; int hrow = harr.length ; int hcol = harr[0].length; PdfPTable table = null ; table = new PdfPTable(cols); table.setHeaderRows(hrow); //table.setWidthPercentage(100); //Default width is 80% table.setHorizontalAlignment(Element.ALIGN_LEFT) ; // Default is center for(int i=0;i<rows;i++){ for(int j=0;j<cols;j++){ if ( (( i<hrow-1 && j==hcol-1) && (!(fixedcol==0))) || (( i<hrow && j==hcol-1) && ((fixedcol==0))) ) table.addCell(applyStyleColumnSelector(newarr[i][j],hcol)); else if (i==hrow-1 && j<hcol) table.addCell(applyStyleRowSelector(newarr[i][j])); else if ( (( i<hrow-1 && j>hcol-1) && (!(fixedcol==0))) || (( i<hrow && j>hcol-1) && ((fixedcol==0))) ) table.addCell(applyStyleColumnHeader(newarr[i][j])); else if (i>hrow-1 && j<hcol && (!(newarr[i][j].equalsIgnoreCase("Totals")))) table.addCell(applyStyleRowHeader(newarr[i][j])); else if (i==hrow-1 && (!(fixedcol==0)) && (!(i==0)) ) table.addCell(applyStyleSeparator(" ")); else if ( ((fixedcol==0) && (i==hrow) && (j==hcol-1))|| ((fixedrow==0) && (j==hcol) && i==hrow-1) ) table.addCell(applyStyleTotal(newarr[i][j])); else if ((newarr[i][j]!=null)&&((i%2)==0)) table.addCell(applyStyleData(newarr[i][j])); else if ((newarr[i][j]!=null)&&((i%2)==1)) table.addCell(applyStyleDataAlt(newarr[i][j])); } } return table; } //#D9D9D9 nice gray private PdfPCell applyStyleColumnSelector(String str, int colspan){ //white bold times_roman font Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); cell.setBackgroundColor(new Color(0,102,204)); //#0066CC *blue*; return cell ; } private PdfPCell applyStyleRowSelector(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(102,153,255)); //#6699FF *bluish*; return cell ; } private PdfPCell applyStyleColumnHeader(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(255,255,255))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(0,102,204)); // #0066CC *blue*; return cell ; } private PdfPCell applyStyleRowHeader(String str){ Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(102,153,255)); // #6699FF *bluish*; return cell ; } private PdfPCell applyStyleSeparator(String str){ //font bold color=#CCCCCC Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(204,204,204))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setBackgroundColor(new Color(153,153,153)); // 999999 *light gray*; return cell ; } private PdfPCell applyStyleTotal(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, new Color(255,255,255))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(0,0,102)); // #000066 *mint green*; return cell ; } private PdfPCell applyStyleData(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(204,204,204)); // CCCCCC *white*; return cell ; } private PdfPCell applyStyleDataAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(204,204,255)); // #CCCCFF; return cell ; } /* //#D9D9D9 nice gray private PdfPCell applyStyleColumnSelector(String str, int colspan){ //white bold times_roman font // Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setColspan(colspan); cell.setHorizontalAlignment( Element.ALIGN_RIGHT); //cell.setBackgroundColor(new Color(0,102,204)); //#0066CC *blue*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.RIGHT ); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleRowSelector(String str){ //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); //cell.setBackgroundColor(new Color(102,153,255)); //#6699FF *bluish*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM |Rectangle.RIGHT ); //cell.setBorder(Rectangle.RIGHT); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleColumnHeader(String str){ //font bold color=#FFFFFF //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(255,255,255))); Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); //cell.setBackgroundColor(new Color(0,102,204)); // #0066CC *blue*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleRowHeader(String str){ //Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, Color.white)); Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); //cell.setBackgroundColor(new Color(102,153,255)); // #6699FF *bluish*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.RIGHT); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleSeparator(String str){ //font bold color=#CCCCCC Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLD, new Color(204,204,204))); PdfPCell cell = new PdfPCell(new Paragraph(p)); //cell.setBackgroundColor(new Color(153,153,153)); // 999999 *light gray*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.BOTTOM); cell.setBorderWidth(2f); return cell ; } private PdfPCell applyStyleTotal(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.BOLDITALIC, new Color(255,255,255))); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); cell.setBackgroundColor(new Color(0,0,102)); // #000066 *mint green*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleData(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); //cell.setBackgroundColor(new Color(204,204,204)); // CCCCCC *white*; cell.setBackgroundColor(new Color(217,217,217)); // #D9D9D9 *gray*; cell.setBorder(Rectangle.NO_BORDER); return cell ; } private PdfPCell applyStyleDataAlt(String str){ //font bold color=#FFFFFF Paragraph p = new Paragraph(str,FontFactory.getFont(FontFactory.TIMES_ROMAN, Font.DEFAULTSIZE, Font.NORMAL, Color.black)); PdfPCell cell = new PdfPCell(new Paragraph(p)); cell.setHorizontalAlignment( Element.ALIGN_CENTER); //cell.setBackgroundColor(new Color(204,204,255)); // #CCCCFF; cell.setBorder(Rectangle.NO_BORDER); return cell ; } */ } /* Here's some documentation to understand this class: (X denotes empty cell) Lets consider a sample array (This is type of array returned by mergeArrays() OR newarr[][]: X |Customer | ABC | XYZ | Hamm | Ling | Weston ------------------------------------------------------- X |Shoe Size| 9.0 | 8.0 | 7.0 | 2.5 | 6.0 ------------------------------------------------------- SKU |Vendor | X | X | X | X | X -------------------------------------------------------- 1 | Laces | X | 5.0 | 20.0 | X | X 2 | ABC | 2.0 | X | X | X | X 3 | XYZ | X | 7.5 | X | X | X 4 | ADF | X | X | 3.2 | X | X 5 | RXF | X | X | X | X | 5.0 Now, The array harr[][] is : X |Customer | ---------------- X |Shoe Size| ----------------- SKU |Vendor | ---------------- hrow = 3 (harr.length) hcol = 2 (harr[0].length) sheet.getFixedRowCount() = 2 ; sheet.getFixedColumnCount() = 2 ; Sheetarr[][] is : X | X | ABC | XYZ | Hamm | Ling | Weston ------------------------------------------------------- X | X | 9.0 | 8.0 | 7.0 | 2.5 | 6.0 ------------------------------------------------------- 1 | Laces | X | 5.0 | 20.0 | X | X 2 | ABC | 2.0 | X | X | X | X 3 | XYZ | X | 7.5 | X | X | X 4 | ADF | X | X | 3.2 | X | X 5 | RXF | X | X | X | X | 5.0 So I need to merge these two arrays (harr[][], sheerarr[][]) to get newarr[][]. (Notice one row is less in sheetarr[][]) */ |
|
From: Rashmi B. <ra...@us...> - 2005-04-14 22:34:54
|
Update of /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24339/format Log Message: Directory /cvsroot/pocolap/pocolap/src/com/pocolap/xtab/format added to the repository |