List of usage examples for com.lowagie.text Table setTableFitsPage
public void setTableFitsPage(boolean fitPage)
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the strategy table and wedge & subwedge strategy tables * /*w w w. j a v a2 s . c om*/ * @param document * @param dcInfo * @throws Exception */ private void setStrategyTable(Document document, DataCollectionInformation dcInfo) throws Exception { // ------------------------------------------- Strategy Wedge // ------------------------------------------------ List<StrategyWedgeInformation> strategyWedgeInformationList = dcInfo.getListStrategyWedgeInformation(); for (Iterator<StrategyWedgeInformation> i = strategyWedgeInformationList.iterator(); i.hasNext();) { document.add(new Paragraph(" ", VERY_SMALL_FONT)); StrategyWedgeInformation swi = i.next(); Table strategyWedgeTable = new Table(10); int headerStrategyWedge[] = { 8, 10, 10, 10, 10, 10, 10, 10, 10, 20 }; // percentage strategyWedgeTable.setWidths(headerStrategyWedge); strategyWedgeTable.setWidth(100); strategyWedgeTable.setCellsFitPage(true); strategyWedgeTable.setTableFitsPage(true); strategyWedgeTable.setPadding(0); strategyWedgeTable.getDefaultCell().setBorderWidth(0); strategyWedgeTable.setBorderWidth(0); strategyWedgeTable.getDefaultCell().setBackgroundColor(WEDGE_COLOR); strategyWedgeTable.addCell(new Paragraph("Wedge number", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Resolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Completeness", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Multiplicity", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Total dose", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Number of Images", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Phi\n(" + Constants.DEGREE + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Kappa\n(" + Constants.DEGREE + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Wavelength", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); strategyWedgeTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // rows strategyWedgeTable.addCell(new Paragraph(swi.getWedgeNumber(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getResolution(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getCompleteness(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getMultiplicity(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getDoseTotal(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getNumberOfImages(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getPhi(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getKappa(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getWavelength(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getComments(), FONT_DOC)); document.add(strategyWedgeTable); // --- strategy sub wedge if (swi.getListStrategySubWedgeInformation().size() > 0) { document.add(new Paragraph(" ", VERY_SMALL_FONT)); Table strategySubWedgeTable = new Table(12); int headerStrategySubWedge[] = { 8, 15, 10, 10, 10, 10, 10, 10, 10, 8, 8, 20 }; // percentage strategySubWedgeTable.setWidths(headerStrategySubWedge); strategySubWedgeTable.setWidth(80); strategySubWedgeTable.setCellsFitPage(true); strategySubWedgeTable.setTableFitsPage(true); strategySubWedgeTable.setPadding(0); strategySubWedgeTable.getDefaultCell().setBorderWidth(0); strategySubWedgeTable.setBorderWidth(0); strategySubWedgeTable.getDefaultCell().setBackgroundColor(SUBWEDGE_COLOR); strategySubWedgeTable.addCell(new Paragraph("Sub Wedge number", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Rotation axis", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Axis start", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Axis end", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Exposure time", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Transmission", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Oscillation Range", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Completeness", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Multiplicity", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Total dose", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Number of images", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); strategySubWedgeTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // rows for (Iterator<StrategySubWedgeInformation> s = swi.getListStrategySubWedgeInformation() .iterator(); s.hasNext();) { StrategySubWedgeInformation sswi = s.next(); strategySubWedgeTable.addCell(new Paragraph(sswi.getSubWedgeNumber(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getRotationAxis(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getAxisStart(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getAxisEnd(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getExposureTime(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getTransmission(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getOscillationRange(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getCompleteness(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getMultiplicity(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getDoseTotal(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getNumberOfImages(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getComments(), FONT_DOC)); } document.add(strategySubWedgeTable); } } document.add(new Paragraph(" ", VERY_SMALL_FONT)); }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the strategy table and wedge & subwedge strategy tables copy from * setStrategyTable, waiting for feedback that we can remove the old reports * and the first method// w w w . j a v a 2s . c om * * @param document * @param dcInfo * @throws Exception */ private void setStrategyTable2(Document document, DataCollectionInformation dcInfo) throws Exception { // ------------------------------------------- Strategy Wedge // ------------------------------------------------ List<StrategyWedgeInformation> strategyWedgeInformationList = dcInfo.getListStrategyWedgeInformation(); for (Iterator<StrategyWedgeInformation> i = strategyWedgeInformationList.iterator(); i.hasNext();) { document.add(new Paragraph(" ", VERY_SMALL_FONT)); StrategyWedgeInformation swi = i.next(); Table strategyWedgeTable = new Table(10); int headerStrategyWedge[] = { 8, 10, 10, 10, 10, 10, 10, 10, 10, 20 }; // percentage strategyWedgeTable.setWidths(headerStrategyWedge); strategyWedgeTable.setWidth(100); strategyWedgeTable.setCellsFitPage(true); strategyWedgeTable.setTableFitsPage(true); strategyWedgeTable.setPadding(1); strategyWedgeTable.getDefaultCell().setBorderWidth(1); strategyWedgeTable.setBorderWidth(1); strategyWedgeTable.getDefaultCell().setBackgroundColor(LIGHT_GREY_COLOR); strategyWedgeTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); strategyWedgeTable.addCell(new Paragraph("Wedge number", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Resolution (" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Completeness", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Multiplicity", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Total dose", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Number of Images", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Phi (" + Constants.DEGREE + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Kappa (" + Constants.DEGREE + ")", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Wavelength", FONT_DOC_BOLD)); strategyWedgeTable.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); strategyWedgeTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // rows strategyWedgeTable.addCell(new Paragraph(swi.getWedgeNumber(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getResolution(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getCompleteness(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getMultiplicity(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getDoseTotal(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getNumberOfImages(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getPhi(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getKappa(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getWavelength(), FONT_DOC)); strategyWedgeTable.addCell(new Paragraph(swi.getComments(), FONT_DOC)); document.add(strategyWedgeTable); // --- strategy sub wedge if (swi.getListStrategySubWedgeInformation().size() > 0) { document.add(new Paragraph(" ", VERY_SMALL_FONT)); Table strategySubWedgeTable = new Table(12); int headerStrategySubWedge[] = { 8, 15, 10, 10, 10, 10, 10, 10, 10, 8, 8, 20 }; // percentage strategySubWedgeTable.setWidths(headerStrategySubWedge); strategySubWedgeTable.setWidth(97); strategySubWedgeTable.setCellsFitPage(true); strategySubWedgeTable.setTableFitsPage(true); strategySubWedgeTable.setPadding(1); strategySubWedgeTable.getDefaultCell().setBorderWidth(1); strategySubWedgeTable.setBorderWidth(1); strategySubWedgeTable.getDefaultCell().setBackgroundColor(LIGHT_GREY_COLOR); strategySubWedgeTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); strategySubWedgeTable.addCell(new Paragraph("Sub Wedge number", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Rotation axis", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Axis start", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Axis end", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Exposure time", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Transmission", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Oscillation Range", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Completeness", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Multiplicity", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Total dose", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Number of images", FONT_DOC_BOLD)); strategySubWedgeTable.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); strategySubWedgeTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // rows for (Iterator<StrategySubWedgeInformation> s = swi.getListStrategySubWedgeInformation() .iterator(); s.hasNext();) { StrategySubWedgeInformation sswi = s.next(); strategySubWedgeTable.addCell(new Paragraph(sswi.getSubWedgeNumber(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getRotationAxis(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getAxisStart(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getAxisEnd(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getExposureTime(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getTransmission(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getOscillationRange(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getCompleteness(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getMultiplicity(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getDoseTotal(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getNumberOfImages(), FONT_DOC)); strategySubWedgeTable.addCell(new Paragraph(sswi.getComments(), FONT_DOC)); } document.add(strategySubWedgeTable); } } document.add(new Paragraph(" ", VERY_SMALL_FONT)); }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the table for a given MXPressO/*ww w .j a va 2s .c o m*/ * * @param document * @param dataCollectionGroupVO * @param mRequest * @param lastCollectOSC * @param nextToLastCollectChar * @throws Exception */ private void setMXPressOTable(Document document, DataCollectionGroup3VO dataCollectionGroupVO, HttpServletRequest mRequest, DataCollection3VO lastCollectOSC, DataCollection3VO nextToLastCollectChar) throws Exception { if (dataCollectionGroupVO != null) { DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode, proposalNumber, mRequest); if (lastCollectOSC != null) { DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(lastCollectOSC, getSampleRankingVO(lastCollectOSC.getDataCollectionId()), getAutoProcRankingVO(lastCollectOSC.getDataCollectionId())); int noCol = 3; Table tableWF = new Table(noCol); int[] headersWidthWF = new int[noCol]; int l = 0; headersWidthWF[l++] = 27; // snapshot headersWidthWF[l++] = 24; // map 1 headersWidthWF[l++] = 51; // map2 // tableWF.setWidths(headersWidthWF); tableWF.setWidth(100); // percentage tableWF.setPadding(1); tableWF.setCellsFitPage(true); tableWF.setTableFitsPage(true); tableWF.getDefaultCell().setBorderWidth(1); tableWF.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // first row: protein acronym and sample name (or image prefix) // and startTime String collectName = lastCollectOSC.getImagePrefix(); if (dataCollectionGroupVO.getBlSampleVO() != null && dataCollectionGroupVO.getBlSampleVO().getCrystalVO() != null) { collectName = dataCollectionGroupVO.getBlSampleVO().getCrystalVO().getProteinVO().getAcronym() + "-" + dataCollectionGroupVO.getBlSampleVO().getName(); } tableWF.addCell(new Paragraph(collectName, FONT_DOC)); String collectTime = lastCollectOSC.getStartTime().toString(); Cell c = new Cell(new Paragraph(collectTime, FONT_DOC)); c.setColspan(2); tableWF.addCell(c); // second row: first snapshot + cartography graphes (2 mesh) // first snapshot String imgCrystal = dcInfo.getPathJpgCrystal3(); Cell cellCrystalImage = getCellImage(imgCrystal); tableWF.addCell(cellCrystalImage); // workflowMesh cartography Workflow3VO mxExpressOWF = dataCollectionGroupVO.getWorkflowVO(); List<WorkflowMesh3VO> listWFMesh = new ArrayList<WorkflowMesh3VO>(); Ejb3ServiceLocator ejb3ServiceLocator = Ejb3ServiceLocator.getInstance(); WorkflowMesh3Service workflowMeshService = (WorkflowMesh3Service) ejb3ServiceLocator .getLocalService(WorkflowMesh3Service.class); listWFMesh = workflowMeshService.findByWorkflowId(mxExpressOWF.getWorkflowId()); if (listWFMesh != null && listWFMesh.size() > 0) { Cell cellImg1 = getMeshMapCell(listWFMesh.get(0)); if (cellImg1 == null) { tableWF.addCell(new Paragraph("Image not found", FONT_DOC)); } else { tableWF.addCell(cellImg1); } if (listWFMesh.size() > 1) { Cell cellImg2 = getMeshMapCell(listWFMesh.get(1)); if (cellImg2 == null) { tableWF.addCell(new Paragraph("Image not found", FONT_DOC)); } else { tableWF.addCell(cellImg2); } } else tableWF.addCell(new Paragraph("No Workflow found", FONT_DOC)); } else { tableWF.addCell(new Paragraph("No Workflow found", FONT_DOC)); tableWF.addCell(new Paragraph("No Workflow found", FONT_DOC)); } // // third row: // autoprocessing results Cell resultCell = getAutoProcResultStatus(dcInfo); resultCell.setColspan(3); resultCell.setHorizontalAlignment(Element.ALIGN_LEFT); tableWF.addCell(resultCell); Integer idDc = -1; for (int k = 0; k < dataCollectionList.size(); k++) { DataCollection3VO dcVo = dataCollectionList.get(k); if (dcVo.getDataCollectionId().equals(lastCollectOSC.getDataCollectionId())) { idDc = k; break; } } if (idDc != -1) { AutoProc3VO[] autoProcs = wrapper.getAutoProcs(); AutoProcScalingStatistics3VO[] autoProcsOverall = wrapper.getScalingStatsOverall(); AutoProcScalingStatistics3VO[] autoProcsInner = wrapper.getScalingStatsInner(); AutoProcScalingStatistics3VO[] autoProcsOuter = wrapper.getScalingStatsOuter(); AutoProc3VO autoProcValue = autoProcs[idDc]; AutoProcScalingStatistics3VO autoProcOverall = autoProcsOverall[idDc]; AutoProcScalingStatistics3VO autoProcInner = autoProcsInner[idDc]; AutoProcScalingStatistics3VO autoProcOuter = autoProcsOuter[idDc]; if (autoProcValue == null) { Cell cNo = new Cell(new Paragraph("No autoprocessing results found", FONT_DOC)); cNo.setColspan(3); cNo.setHorizontalAlignment(Element.ALIGN_LEFT); tableWF.addCell(cNo); document.add(tableWF); } else { int noColSPG = 5; Table tableSPG = new Table(noColSPG); int[] headersWidth = new int[noColSPG]; int i = 0; headersWidth[i++] = 7; // space group headersWidth[i++] = 10; // completeness headersWidth[i++] = 9; // resolution headersWidth[i++] = 9; // rsymm headersWidth[i++] = 12; // unit cell tableSPG.setWidths(headersWidth); tableSPG.setWidth(100); // percentage tableSPG.setPadding(3); tableSPG.setCellsFitPage(true); tableSPG.setTableFitsPage(true); tableSPG.getDefaultCell().setBorderWidth(1); tableSPG.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); tableSPG.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableSPG.addCell(new Paragraph("Space Group", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Completeness (Inner, Outer, Overall)", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Resolution", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Rsymm (Inner, Outer, Overall)", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Unit Cell (a, b, c, alpha, beta, gamma)", FONT_DOC_BOLD)); tableSPG.getDefaultCell().setGrayFill(GREY_FILL_DATA); // space group if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) { Paragraph p = new Paragraph(autoProcValue.getSpaceGroup(), FONT_DOC); tableSPG.addCell(p); } else tableSPG.addCell(""); // completeness, rsymm, processed resolution String completenessString = new String(); String rSymmString = new String(); String resolutionString = new String(); if (autoProcOverall != null && autoProcInner != null && autoProcOuter != null) { completenessString += df2.format(autoProcInner.getCompleteness()) + "\n" + df2.format(autoProcOuter.getCompleteness()) + "\n" + df2.format(autoProcOverall.getCompleteness()); rSymmString += (autoProcInner.getRmerge() == null ? "" : df2.format(autoProcInner.getRmerge())) + "\n" + (autoProcOuter.getRmerge() == null ? "" : df2.format(autoProcOuter.getRmerge())) + "\n" + (autoProcOverall.getRmerge() == null ? "" : df2.format(autoProcOverall.getRmerge())); resolutionString += autoProcInner.getResolutionLimitLow() + " - " + autoProcInner.getResolutionLimitHigh() + "\n" + autoProcOuter.getResolutionLimitLow() + " - " + autoProcOuter.getResolutionLimitHigh() + "\n" + autoProcOverall.getResolutionLimitLow() + " - " + autoProcOverall.getResolutionLimitHigh(); } tableSPG.addCell(new Paragraph(completenessString, FONT_DOC)); tableSPG.addCell(new Paragraph(resolutionString, FONT_DOC)); tableSPG.addCell(new Paragraph(rSymmString, FONT_DOC)); // unit cell if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) { tableSPG.addCell(new Paragraph("" + autoProcValue.getRefinedCellA() + ", " + autoProcValue.getRefinedCellB() + ", " + autoProcValue.getRefinedCellC() + "\n" + autoProcValue.getRefinedCellAlpha() + ", " + autoProcValue.getRefinedCellBeta() + ", " + autoProcValue.getRefinedCellGamma(), FONT_DOC)); } else { tableSPG.addCell(""); } document.add(tableWF); document.add(new Paragraph("Best autoprocessing result", FONT_DOC)); document.add(tableSPG); } // end autoProc null } // end idDc -1 // document.add(new Paragraph(" ", FONT_SPACE)); } // end lastCollect null if (nextToLastCollectChar != null) { DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(nextToLastCollectChar, getSampleRankingVO(nextToLastCollectChar.getDataCollectionId()), getAutoProcRankingVO(nextToLastCollectChar.getDataCollectionId())); if (dcInfo.getSpacegroup() != "") { document.add(new Paragraph("EDNA characterisation output and collect strategy", FONT_DOC)); } setEDNATable2(document, dcInfo); setStrategyTable2(document, dcInfo); } } // end dataCollectionGroup null }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the autoproc results table, if no autoProc add a cell at the end of * topTable/* ww w . ja v a2s . com*/ * * @param document * @param topTable * @param collect * @throws Exception */ private void setAutoProcResultsTable(Document document, DataCollectionInformation collect) throws Exception { Integer idDc = -1; for (int k = 0; k < dataCollectionList.size(); k++) { DataCollection3VO dcVo = dataCollectionList.get(k); if (dcVo.getDataCollectionId().equals(collect.getDataCollectionId())) { idDc = k; break; } } if (idDc != -1) { AutoProc3VO[] autoProcs = wrapper.getAutoProcs(); AutoProcScalingStatistics3VO[] autoProcsOverall = wrapper.getScalingStatsOverall(); AutoProcScalingStatistics3VO[] autoProcsInner = wrapper.getScalingStatsInner(); AutoProcScalingStatistics3VO[] autoProcsOuter = wrapper.getScalingStatsOuter(); AutoProc3VO autoProcValue = autoProcs[idDc]; AutoProcScalingStatistics3VO autoProcOverall = autoProcsOverall[idDc]; AutoProcScalingStatistics3VO autoProcInner = autoProcsInner[idDc]; AutoProcScalingStatistics3VO autoProcOuter = autoProcsOuter[idDc]; if (autoProcValue == null) { // Cell cNo = new Cell(new // Paragraph("No autoprocessing results found", FONT_DOC)); // cNo.setHorizontalAlignment(Element.ALIGN_LEFT); // Table tableNR = new Table(1); // tableNR.setWidth(100); // percentage // tableNR.setPadding(3); // tableNR.setCellsFitPage(true); // tableNR.setTableFitsPage(true); // tableNR.getDefaultCell().setBorderWidth(1); // tableNR.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // tableNR.addCell(cNo); // document.add(tableNR); } else { int noColSPG = 5; Table tableSPG = new Table(noColSPG); int[] headersWidth = new int[noColSPG]; int i = 0; headersWidth[i++] = 7; // space group headersWidth[i++] = 10; // completeness headersWidth[i++] = 9; // resolution headersWidth[i++] = 9; // rsymm headersWidth[i++] = 12; // unit cell tableSPG.setWidths(headersWidth); tableSPG.setWidth(100); // percentage tableSPG.setPadding(3); tableSPG.setCellsFitPage(true); tableSPG.setTableFitsPage(true); tableSPG.getDefaultCell().setBorderWidth(1); tableSPG.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); tableSPG.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableSPG.addCell(new Paragraph("Space Group", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Completeness (Inner, Outer, Overall)", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Resolution", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Rsymm (Inner, Outer, Overall)", FONT_DOC_BOLD)); tableSPG.addCell(new Paragraph("Unit Cell (a, b, c, alpha, beta, gamma)", FONT_DOC_BOLD)); tableSPG.getDefaultCell().setGrayFill(GREY_FILL_DATA); // space group if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) { Paragraph p = new Paragraph(autoProcValue.getSpaceGroup(), FONT_DOC); tableSPG.addCell(p); } else tableSPG.addCell(""); // completeness, rsymm, processed resolution String completenessString = new String(); String rSymmString = new String(); String resolutionString = new String(); if (autoProcOverall != null && autoProcInner != null && autoProcOuter != null) { completenessString += df2.format(autoProcInner.getCompleteness()) + "\n" + df2.format(autoProcOuter.getCompleteness()) + "\n" + df2.format(autoProcOverall.getCompleteness()); rSymmString += (autoProcInner.getRmerge() == null ? "" : df2.format(autoProcInner.getRmerge())) + "\n" + (autoProcOuter.getRmerge() == null ? "" : df2.format(autoProcOuter.getRmerge())) + "\n" + (autoProcOverall.getRmerge() == null ? "" : df2.format(autoProcOverall.getRmerge())); resolutionString += autoProcInner.getResolutionLimitLow() + " - " + autoProcInner.getResolutionLimitHigh() + "\n" + autoProcOuter.getResolutionLimitLow() + " - " + autoProcOuter.getResolutionLimitHigh() + "\n" + autoProcOverall.getResolutionLimitLow() + " - " + autoProcOverall.getResolutionLimitHigh(); } tableSPG.addCell(new Paragraph(completenessString, FONT_DOC)); tableSPG.addCell(new Paragraph(resolutionString, FONT_DOC)); tableSPG.addCell(new Paragraph(rSymmString, FONT_DOC)); // unit cell if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) { tableSPG.addCell(new Paragraph("" + autoProcValue.getRefinedCellA() + ", " + autoProcValue.getRefinedCellB() + ", " + autoProcValue.getRefinedCellC() + "\n" + autoProcValue.getRefinedCellAlpha() + ", " + autoProcValue.getRefinedCellBeta() + ", " + autoProcValue.getRefinedCellGamma(), FONT_DOC)); } else { tableSPG.addCell(""); } document.add(tableSPG); } // end autoProc null } // end idDc -1 // document.add(new Paragraph(" ", FONT_SPACE)); }
From source file:jmemorize.core.io.PdfRtfBuilder.java
License:Open Source License
/** * Adds given card to document/*from www . j a va 2 s . c o m*/ * * @param doc document to add to * @param card given card */ private static void writeCard(Document doc, Card card) throws DocumentException { Table table = new Table(2); table.setPadding(3f); table.setBorderWidth(1.0f); table.setTableFitsPage(true); table.complete(); Phrase front = new Phrase(card.getFrontSide().getText().getUnformatted(), frontFont); table.addCell(front); Phrase back = new Phrase(card.getBackSide().getText().getUnformatted(), backFont); table.addCell(back); doc.add(table); }
From source file:org.activityinfo.server.report.renderer.itext.ItextMapRenderer.java
License:Open Source License
private void renderLegend(MapReportElement element, Document doc) throws DocumentException, IOException { Table table = new Table(2); table.setBorderWidth(1);//from ww w .j a v a2s.c o m table.setWidth(100f); table.setBorderColor(new Color(100, 100, 100)); table.setPadding(5); table.setSpacing(0); table.setCellsFitPage(true); table.setTableFitsPage(true); table.setWidths(new int[] { 1, 3 }); Cell cell = new Cell(I18N.CONSTANTS.legend()); cell.setHeader(true); cell.setColspan(2); table.addCell(cell); table.endHeaders(); for (MapLayerLegend legend : element.getContent().getLegends()) { Cell symbolCell = new Cell(); symbolCell.setHorizontalAlignment(Element.ALIGN_CENTER); symbolCell.setVerticalAlignment(Element.ALIGN_MIDDLE); Image symbol = createLegendSymbol(legend, imageCreator); symbolCell.addElement(symbol); Cell descriptionCell = new Cell(); addLegendDescription(element, legend.getDefinition(), descriptionCell); table.addCell(symbolCell); table.addCell(descriptionCell); } doc.add(table); }
From source file:org.inbio.modeling.core.manager.impl.ExportManagerImpl.java
License:Open Source License
private Table create2columnTable() throws BadElementException { // Print the metadata information Table table = new Table(2); table.setBorderColor(Color.GRAY); table.setPadding(2);/*w ww. j a v a 2 s.c o m*/ table.setSpacing(2); table.setBorderWidth(1); table.setTableFitsPage(true); return table; }