List of usage examples for com.lowagie.text Table setPadding
public void setPadding(float value)
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
private void setEDNATable2(Document document, DataCollectionInformation dcInfo) throws Exception { if (dcInfo.getSpacegroup() != "") { int noCol = 4; Table tableEDNA = new Table(noCol); int headerEDNA[] = { 10, 10, 10, 10 }; // percentage tableEDNA.setWidths(headerEDNA); tableEDNA.setWidth(100); // percentage tableEDNA.setPadding(3); tableEDNA.setCellsFitPage(true); tableEDNA.setTableFitsPage(true); // tableEDNA.getDefaultCell().setBorderWidth(1); tableEDNA.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // EDNA Header tableEDNA.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableEDNA.addCell(new Paragraph("Space Group", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Unit Cell (a, b, c, alpha, beta, gamma)", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Mosaicity (" + Constants.DEGREE + ")", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Ranking Resolution (" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); tableEDNA.getDefaultCell().setBorderWidth(1); tableEDNA.getDefaultCell().setBackgroundColor(WHITE_COLOR); // EDNA data String unitCell = dcInfo.getCellA() + ", " + dcInfo.getCellB() + ", " + dcInfo.getCellC() + "\n" + dcInfo.getCellAlpha() + ", " + dcInfo.getCellBeta() + ", " + dcInfo.getCellGamma(); tableEDNA.addCell(new Paragraph(dcInfo.getSpacegroup(), FONT_DOC)); tableEDNA.addCell(new Paragraph(unitCell, FONT_DOC)); tableEDNA.addCell(new Paragraph(dcInfo.getMosaicity(), FONT_DOC)); tableEDNA.addCell(new Paragraph(dcInfo.getResObserved(), FONT_DOC)); ///*w w w.j a va 2 s .c om*/ document.add(tableEDNA); 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 * /* w w w. j a v a 2s . 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//from w ww . ja va 2 s. c o m * * @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
private void setRankingTable(Document document, DataCollectionInformation dcInfo) throws Exception { SampleRankingVO rankingVO = dcInfo.getSampleRankingVO(); if (rankingVO == null) { return;/*w w w . j a va2s.c o m*/ } DecimalFormat decimalFormat1 = (DecimalFormat) NumberFormat.getInstance(Locale.US); decimalFormat1.applyPattern("0"); DecimalFormat decimalFormat2 = (DecimalFormat) NumberFormat.getInstance(Locale.US); decimalFormat2.applyPattern("0.00"); Table aTable = new Table(6); // aTable.setWidth(100); // percentage aTable.setPadding(3); aTable.setCellsFitPage(true); aTable.getDefaultCell().setBorderWidth(1); aTable.setBorderWidth(1); aTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // header aTable.getDefaultCell().setGrayFill(GREY_FILL_HEADER); aTable.addCell(new Paragraph("Ranking Resolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Exposure Time\n(s)", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Mosaicity\n(" + Constants.DEGREE + ")", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Number of spots", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Number of images", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Total", FONT_DOC_BOLD)); aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // row String rankRes = "#" + decimalFormat1.format(rankingVO.getTheoreticalResolutionRank()); if (rankingVO.getTheoreticalResolutionValue() != null && !Double.isNaN(rankingVO.getTheoreticalResolutionValue())) { rankRes += " " + decimalFormat2.format(rankingVO.getTheoreticalResolutionValue()); } String rankExp = "#" + decimalFormat1.format(rankingVO.getTotalExposureTimeRank()); if (rankingVO.getTotalExposureTimeValue() != null && !Double.isNaN(rankingVO.getTotalExposureTimeValue())) { rankExp += " " + decimalFormat2.format(rankingVO.getTotalExposureTimeValue()); } String rankMos = "#" + decimalFormat1.format(rankingVO.getMosaicityRank()); if (rankingVO.getMosaicityValue() != null && !Double.isNaN(rankingVO.getMosaicityValue())) { rankMos += " " + decimalFormat2.format(rankingVO.getMosaicityValue()); } String rankSpot = "#" + decimalFormat1.format(rankingVO.getNumberOfSpotsIndexedRank()); if (rankingVO.getNumberOfSpotsIndexedValue() != null && !Double.isNaN(rankingVO.getNumberOfSpotsIndexedValue())) { rankSpot += " " + decimalFormat1.format(rankingVO.getNumberOfSpotsIndexedValue()); } String rankImages = "#" + decimalFormat1.format(rankingVO.getNumberOfImagesRank()); if (rankingVO.getNumberOfImagesValue() != null && !Double.isNaN(rankingVO.getNumberOfImagesValue())) { rankImages += " " + decimalFormat1.format(rankingVO.getNumberOfImagesValue()); } String rankTotal = "#" + decimalFormat1.format(rankingVO.getTotalRank()); if (rankingVO.getTotalScore() != null && !Double.isNaN(rankingVO.getTotalScore())) { rankTotal += " " + decimalFormat1.format(rankingVO.getTotalScore()) + " %"; } // ... rank res if (rankingVO.getTheoreticalResolutionRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getTheoreticalResolutionValue() == null || Double.isNaN(rankingVO.getTheoreticalResolutionValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankRes, FONT_DOC)); // ... exp. time if (rankingVO.getTotalExposureTimeRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getTotalExposureTimeValue() == null || Double.isNaN(rankingVO.getTotalExposureTimeValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankExp, FONT_DOC)); // ... mosaicity if (rankingVO.getMosaicityRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getMosaicityValue() == null || Double.isNaN(rankingVO.getMosaicityValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankMos, FONT_DOC)); // ... number of spots if (rankingVO.getNumberOfSpotsIndexedRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getNumberOfSpotsIndexedValue() == null || Double.isNaN(rankingVO.getNumberOfSpotsIndexedValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankSpot, FONT_DOC)); // ... number of images if (rankingVO.getNumberOfImagesRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getNumberOfImagesValue() == null || Double.isNaN(rankingVO.getNumberOfImagesValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankImages, FONT_DOC)); // ... total if (rankingVO.getTotalRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getTotalScore() == null || Double.isNaN(rankingVO.getTotalScore())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankTotal, FONT_DOC)); // document.add(aTable); document.add(new Paragraph(" ", VERY_SMALL_FONT)); }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
private void setAutoProcRankingTable(Document document, DataCollectionInformation dcInfo) throws Exception { AutoProcRankingVO rankingVO = dcInfo.getAutoProcRankingVO(); if (rankingVO == null) { return;//from ww w. j a va 2 s . co m } DecimalFormat decimalFormat1 = (DecimalFormat) NumberFormat.getInstance(Locale.US); decimalFormat1.applyPattern("0"); DecimalFormat decimalFormat2 = (DecimalFormat) NumberFormat.getInstance(Locale.US); decimalFormat2.applyPattern("0.00"); Table aTable = new Table(4); // aTable.setWidth(100); // percentage aTable.setPadding(3); aTable.setCellsFitPage(true); aTable.getDefaultCell().setBorderWidth(1); aTable.setBorderWidth(1); aTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // header aTable.getDefaultCell().setGrayFill(GREY_FILL_HEADER); aTable.addCell(new Paragraph("R-factor\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Highest resolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Completeness\n(%)", FONT_DOC_BOLD)); aTable.addCell(new Paragraph("Total", FONT_DOC_BOLD)); aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); // row String rankRfactor = "#" + decimalFormat1.format(rankingVO.getOverallRFactorRank()); if (rankingVO.getOverallRFactorValue() != null && !Double.isNaN(rankingVO.getOverallRFactorValue())) { rankRfactor += " " + decimalFormat2.format(rankingVO.getOverallRFactorValue()); } String rankHighestRes = "#" + decimalFormat1.format(rankingVO.getHighestResolutionRank()); if (rankingVO.getHighestResolutionValue() != null && !Double.isNaN(rankingVO.getHighestResolutionValue())) { rankHighestRes += " " + decimalFormat2.format(rankingVO.getHighestResolutionValue()); } String rankCom = "#" + decimalFormat1.format(rankingVO.getCompletenessRank()); if (rankingVO.getCompletenessValue() != null && !Double.isNaN(rankingVO.getCompletenessValue())) { rankCom += " " + decimalFormat2.format(rankingVO.getCompletenessValue()); } String rankTotal = "#" + decimalFormat1.format(rankingVO.getTotalRank()); if (rankingVO.getTotalScore() != null && !Double.isNaN(rankingVO.getTotalScore())) { rankTotal += " " + decimalFormat1.format(rankingVO.getTotalScore()) + " %"; } // ... R-factor if (rankingVO.getOverallRFactorRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getOverallRFactorValue() == null || Double.isNaN(rankingVO.getOverallRFactorValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankRfactor, FONT_DOC)); // ... highest resolution if (rankingVO.getHighestResolutionRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getHighestResolutionValue() == null || Double.isNaN(rankingVO.getHighestResolutionValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankHighestRes, FONT_DOC)); // ... completeness if (rankingVO.getCompletenessRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getCompletenessValue() == null || Double.isNaN(rankingVO.getCompletenessValue())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankCom, FONT_DOC)); // ... total if (rankingVO.getTotalRank() == 1) { aTable.getDefaultCell().setBackgroundColor(GREEN_COLOR_RANK); } else if (rankingVO.getTotalScore() == null || Double.isNaN(rankingVO.getTotalScore())) { aTable.getDefaultCell().setBackgroundColor(NULL_COLOR_RANK); } else { aTable.getDefaultCell().setBackgroundColor(WHITE_COLOR); } aTable.addCell(new Paragraph(rankTotal, FONT_DOC)); // document.add(aTable); 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//from w w w .j av a 2 s .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/* www .j av a2 s .co m*/ * * @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:ispyb.client.mx.results.ExportAutoProcAction.java
License:Open Source License
private void setAutoProcInfo(Document document) throws Exception { // header/*from w w w .j a v a2 s .c o m*/ Table headerTable = new Table(1); headerTable.getDefaultCell().setBorderWidth(0); headerTable.setBorderWidth(0); headerTable.setCellsFitPage(true); headerTable.setAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); headerTable.getDefaultCell().setBackgroundColor(PdfRtfExporter.LIGHT_YELLOW_COLOR); headerTable.getDefaultCell().setLeading(3); headerTable.setWidth(100); // percentage headerTable .addCell(new Paragraph("Crystal data and data-collection statistics", PdfRtfExporter.FONT_DOC_11)); headerTable.addCell(new Paragraph("Values in parentheses are for the highest resolution shell.", PdfRtfExporter.FONT_DOC_11)); document.add(headerTable); document.add(new Paragraph(" ", PdfRtfExporter.VERY_SMALL_FONT)); // auto proc table Table autoProcTable = new Table(2); autoProcTable.getDefaultCell().setBorderWidth(0); autoProcTable.setBorderWidth(0); autoProcTable.setCellsFitPage(true); autoProcTable.setAlignment(Element.ALIGN_LEFT); autoProcTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); // autoProcTable.getDefaultCell().setLeading(3); autoProcTable.setPadding(2); autoProcTable.setWidth(100); // percentage // data String spaceGroup = autoProc == null ? "" : autoProc.getSpaceGroup(); String unitCell_a = autoProc == null ? "" : autoProc.getRefinedCellA().toString(); String unitCell_b = autoProc == null ? "" : autoProc.getRefinedCellB().toString(); String unitCell_c = autoProc == null ? "" : autoProc.getRefinedCellC().toString(); String unitCell_alpha = autoProc == null ? "" : autoProc.getRefinedCellAlpha().toString(); String unitCell_beta = autoProc == null ? "" : autoProc.getRefinedCellBeta().toString(); String unitCell_gamma = autoProc == null ? "" : autoProc.getRefinedCellGamma().toString(); String resolutionRange = ""; String nTotalObservations = ""; String nTotalUniqueReflections = ""; String completeness = ""; String multiplicity = ""; String isigma = ""; String rmerge = ""; if (autoProcStatisticsOverall != null) { resolutionRange = autoProcStatisticsOverall.getResolutionLimitLow() + " - " + autoProcStatisticsOverall.getResolutionLimitHigh(); nTotalObservations = "" + autoProcStatisticsOverall.getnTotalObservations(); nTotalUniqueReflections = "" + (autoProcStatisticsOverall.getnTotalUniqueObservations() == null ? "" : autoProcStatisticsOverall.getnTotalUniqueObservations()); completeness = "" + autoProcStatisticsOverall.getCompleteness(); multiplicity = "" + autoProcStatisticsOverall.getMultiplicity(); isigma = "" + autoProcStatisticsOverall.getMeanIoverSigI(); rmerge = "" + (autoProcStatisticsOverall.getRmerge() == null ? "" : autoProcStatisticsOverall.getRmerge()); } if (autoProcStatisticsOuter != null) { resolutionRange += " (" + autoProcStatisticsOuter.getResolutionLimitLow() + " - " + autoProcStatisticsOuter.getResolutionLimitHigh() + ")"; nTotalObservations += " (" + autoProcStatisticsOuter.getnTotalObservations() + ")"; nTotalUniqueReflections += autoProcStatisticsOuter.getnTotalUniqueObservations() == null ? "" : (" (" + autoProcStatisticsOuter.getnTotalUniqueObservations() + ")"); completeness += " (" + autoProcStatisticsOuter.getCompleteness() + ")"; multiplicity += " (" + autoProcStatisticsOuter.getMultiplicity() + ")"; isigma += " (" + autoProcStatisticsOuter.getMeanIoverSigI() + ")"; rmerge += " (" + (autoProcStatisticsOuter.getRmerge() == null ? "" : autoProcStatisticsOuter.getRmerge()) + ")"; } // space group autoProcTable.addCell(new Paragraph("Space Group", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(spaceGroup, PdfRtfExporter.FONT_DOC_11)); // unit cell parameters autoProcTable.addCell( new Paragraph("Unit-cell parameters (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph("", PdfRtfExporter.FONT_DOC_11)); Paragraph pa = new Paragraph("\t a", PdfRtfExporter.FONT_DOC_11); pa.setAlignment(Element.ALIGN_JUSTIFIED); pa.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pa); autoProcTable.addCell(new Paragraph(unitCell_a, PdfRtfExporter.FONT_DOC_11)); Paragraph pb = new Paragraph("\t b", PdfRtfExporter.FONT_DOC_11); pb.setAlignment(Element.ALIGN_JUSTIFIED); pb.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pb); autoProcTable.addCell(new Paragraph(unitCell_b, PdfRtfExporter.FONT_DOC_11)); Paragraph pc = new Paragraph("\t c", PdfRtfExporter.FONT_DOC_11); pc.setAlignment(Element.ALIGN_JUSTIFIED); pc.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pc); autoProcTable.addCell(new Paragraph(unitCell_c, PdfRtfExporter.FONT_DOC_11)); // Issue 1733: cell angles info added Paragraph palpha = new Paragraph("\t alpha", PdfRtfExporter.FONT_DOC_11); palpha.setAlignment(Element.ALIGN_JUSTIFIED); palpha.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(palpha); autoProcTable.addCell(new Paragraph(unitCell_alpha, PdfRtfExporter.FONT_DOC_11)); Paragraph pbeta = new Paragraph("\t beta", PdfRtfExporter.FONT_DOC_11); pbeta.setAlignment(Element.ALIGN_JUSTIFIED); pbeta.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pbeta); autoProcTable.addCell(new Paragraph(unitCell_beta, PdfRtfExporter.FONT_DOC_11)); Paragraph pgamma = new Paragraph("\t gamma", PdfRtfExporter.FONT_DOC_11); pgamma.setAlignment(Element.ALIGN_JUSTIFIED); pgamma.setIndentationLeft(PdfRtfExporter.INDENTATION_LEFT); autoProcTable.addCell(pgamma); autoProcTable.addCell(new Paragraph(unitCell_gamma, PdfRtfExporter.FONT_DOC_11)); // resolution range autoProcTable.addCell( new Paragraph("Resolution range (" + Constants.ANGSTROM + ")", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(resolutionRange, PdfRtfExporter.FONT_DOC_11)); // Observed reflections autoProcTable.addCell(new Paragraph("Observed reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalObservations, PdfRtfExporter.FONT_DOC_11)); // No. of unique reflections autoProcTable.addCell(new Paragraph("No. of unique reflections", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(nTotalUniqueReflections, PdfRtfExporter.FONT_DOC_11)); // Completeness autoProcTable.addCell(new Paragraph("Completeness (%)", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(completeness, PdfRtfExporter.FONT_DOC_11)); // multiplicity autoProcTable.addCell(new Paragraph("Multiplicity", PdfRtfExporter.FONT_DOC_11)); autoProcTable.addCell(new Paragraph(multiplicity, PdfRtfExporter.FONT_DOC_11)); new Phrase(); // I/(I) Phrase p = Phrase.getInstance("<I/" + (char) 963 + "(I)>"); p.setFont(PdfRtfExporter.FONT_DOC_11); autoProcTable.addCell(p); autoProcTable.addCell(new Paragraph(isigma, PdfRtfExporter.FONT_DOC_11)); // Rmerge Chunk c1 = new Chunk("R", PdfRtfExporter.FONT_DOC_11); Chunk c2 = new Chunk("merge", PdfRtfExporter.FONT_DOC_EXPONENT); c2.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); Chunk c3 = new Chunk("(%)", PdfRtfExporter.FONT_DOC_11); Chunk c4 = new Chunk("#", PdfRtfExporter.FONT_DOC_EXPONENT_BLUE); c4.setTextRise(PdfRtfExporter.TEXT_RISE_EXP); Paragraph rMergeParagraph = new Paragraph(); rMergeParagraph.add(c1); rMergeParagraph.add(c2); rMergeParagraph.add(c3); rMergeParagraph.add(c4); autoProcTable.addCell(rMergeParagraph); autoProcTable.addCell(new Paragraph(rmerge, PdfRtfExporter.FONT_DOC_11)); document.add(autoProcTable); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); // nota bene info Paragraph nbParagraph = new Paragraph(); nbParagraph.add(c4); nbParagraph.add(c1); nbParagraph.add(c2); Chunk cesp = new Chunk(" ", PdfRtfExporter.FONT_DOC_11); Chunk c5 = new Chunk(" = ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c5); Phrase pSigma = Phrase.getInstance("" + (char) 931); pSigma.setFont(PdfRtfExporter.FONT_DOC_11); nbParagraph.add(pSigma); Chunk chkl = new Chunk("hkl", PdfRtfExporter.FONT_DOC_EXPONENT); chkl.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); Chunk ci = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT); ci.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(ci); Chunk c8 = new Chunk(" |I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c8); nbParagraph.add(ci); Chunk c9 = new Chunk("(hkl) - (I(hkl))| / ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c9); nbParagraph.add(pSigma); nbParagraph.add(chkl); nbParagraph.add(cesp); nbParagraph.add(pSigma); nbParagraph.add(ci); nbParagraph.add(cesp); Chunk c10 = new Chunk("I", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c10); nbParagraph.add(ci); Chunk c11 = new Chunk("(hkl), where ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c11); Chunk c12 = new Chunk("I", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c12); Chunk cii = new Chunk("i", PdfRtfExporter.FONT_DOC_EXPONENT_ITALIC); cii.setTextRise(PdfRtfExporter.TEXT_RISE_SUB); nbParagraph.add(cii); Chunk c13 = new Chunk("(hkl)", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c13); Chunk c14 = new Chunk(" is the ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c14); Chunk c15 = new Chunk("i", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c15); Chunk c16 = new Chunk("th observation of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c16); Chunk chklI = new Chunk("hkl", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(chklI); Chunk c17 = new Chunk(" and ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c17); Chunk c18 = new Chunk("<I(hkl)> ", PdfRtfExporter.FONT_DOC_11_ITALIC); nbParagraph.add(c18); Chunk c19 = new Chunk(" is the weighted average intensity for all observations of reflection ", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c19); nbParagraph.add(chklI); Chunk c20 = new Chunk(".", PdfRtfExporter.FONT_DOC_11); nbParagraph.add(c20); document.add(nbParagraph); document.add(new Paragraph(" ", PdfRtfExporter.FONT_DOC_11)); }
From source file:ispyb.common.util.export.ExiPdfRtfExporter.java
License:Open Source License
/*** * sets the sessions informations in the pdf document for fx or ix accounts * (Issue 1049)/*from w ww . j a v a 2 s. c om*/ * * @param document * @throws Exception */ private void setSessionTable(Document document) throws Exception { String proposalCode = proposalDesc.substring(0, 2); if (slv != null && (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX) || proposalCode.equals(Constants.PROPOSAL_CODE_IX))) { if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // session // title // only // for // FX // accounts document.add(new Paragraph("Session title:", FONT_TITLE)); document.add(new Paragraph(slv.getSessionTitle(), FONT_DOC)); } Table sessionTable = new Table(2); // sessionTable.setWidth(50); // percentage sessionTable.setPadding(3); sessionTable.setCellsFitPage(true); sessionTable.getDefaultCell().setBorderWidth(0); sessionTable.setBorder(0); sessionTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); boolean hasData = false; // print only if the value > 0 if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // structure // determinations // only // for // FX // accounts if (slv.getStructureDeterminations() != null && !slv.getStructureDeterminations().isNaN() && slv.getStructureDeterminations() != 0) { hasData = true; sessionTable.addCell(new Paragraph("Structure determinations", FONT_DOC_BOLD)); sessionTable.addCell(new Paragraph("" + slv.getStructureDeterminations(), FONT_DOC)); } } if (slv.getDewarTransport() != null && !slv.getDewarTransport().isNaN() && slv.getDewarTransport() != 0) { hasData = true; sessionTable.addCell(new Paragraph("Dewar transport", FONT_DOC_BOLD)); sessionTable.addCell(new Paragraph("" + slv.getDewarTransport(), FONT_DOC)); } if (slv.getDatabackupFrance() != null && !slv.getDatabackupFrance().isNaN() && slv.getDatabackupFrance() != 0) { hasData = true; sessionTable.addCell(new Paragraph("Data backup & Express delivery France", FONT_DOC_BOLD)); sessionTable.addCell(new Paragraph("" + slv.getDatabackupFrance(), FONT_DOC)); } if (slv.getDatabackupEurope() != null && !slv.getDatabackupEurope().isNaN() && slv.getDatabackupEurope() != 0) { hasData = true; sessionTable.addCell(new Paragraph("Data backup & Express delivery Europe", FONT_DOC_BOLD)); sessionTable.addCell(new Paragraph("" + slv.getDatabackupEurope(), FONT_DOC)); } if (hasData) { document.add(sessionTable); } } }
From source file:jmemorize.core.io.PdfRtfBuilder.java
License:Open Source License
/** * Adds given card to document// w w w. j a v a 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); }