List of usage examples for com.lowagie.text Element ALIGN_LEFT
int ALIGN_LEFT
To view the source code for com.lowagie.text Element ALIGN_LEFT.
Click Source Link
From source file:ispyb.client.biosaxs.pdf.DataAcquisitionPDFReport.java
License:Open Source License
private Element getImageTable(Experiment3VO experiment, List<Buffer3VO> buffers) { PdfPTable table = new PdfPTable(ImageColumns.length); table.setWidthPercentage(100f);//from w ww . jav a 2 s .c om table.getDefaultCell().setPadding(3); table.getDefaultCell().setColspan(ImageColumns.length); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setColspan(1); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); for (int i = 0; i < ImageColumns.length; i++) { table.addCell(this.getCell(ImageColumns[i], BaseFont.HELVETICA_BOLD)); } table.getDefaultCell().setBackgroundColor(null); List<Measurement3VO> measurements = experiment.getMeasurements(); Collections.sort(measurements, MeasurementComparator .compare(MeasurementComparator.getComparator(MeasurementComparator.PRIOTIRY_SORT_ASC))); for (int x = 0; x < measurements.size(); x++) { Measurement3VO measurement = measurements.get(x); Specimen3VO specimen = experiment.getSampleById(measurement.getSpecimenId()); if (specimen.getMacromolecule3VO() != null) { SaxsDataCollection3VO dataCollection = experiment .getDataCollectionByMeasurementId(measurement.getMeasurementId()); ArrayList<String> list = this.addAnalysisRow(measurement, experiment, buffers); if (list.size() > 0) { int sizeTable = list.get(0).length(); PdfPTable nested1 = new PdfPTable(sizeTable); nested1.getDefaultCell().setBorder(0); for (int i = 0; i < list.size(); i++) { if (i == 0) { nested1.getDefaultCell().setBackgroundColor(PdfRtfExporter.LIGHT_GREY_COLOR); nested1.getDefaultCell().setBorder(0); Paragraph cell = this.getCell(this.COLUMNS[i] + ": " + list.get(i)); nested1.addCell(cell); } else { nested1.getDefaultCell().setBackgroundColor(null); nested1.getDefaultCell().setBorder(0); PdfPCell cell = new PdfPCell(this.getCell(this.COLUMNS[i] + ": " + list.get(i))); cell.setBorder(0); nested1.addCell(cell); } } table.addCell(new PdfPCell(nested1)); if (dataCollection.getSubstraction3VOs() != null) { if (dataCollection.getSubstraction3VOs().size() > 0) { Subtraction3VO substraction = ((Subtraction3VO) (dataCollection.getSubstraction3VOs() .toArray()[0])); String scatteringImage = BiosaxsActions .checkFilePathForDevelopment(substraction.getScatteringFilePath()); if (scatteringImage != null) { if (new File(scatteringImage).exists()) { try { PdfPCell cell = new PdfPCell(Image.getInstance(scatteringImage), true); cell.setBorder(0); table.addCell(cell); } catch (Exception e) { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); e.printStackTrace(); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } String guinierImage = BiosaxsActions .checkFilePathForDevelopment(substraction.getGuinierFilePath()); if (guinierImage != null) { if (new File(guinierImage).exists()) { try { PdfPCell cell = new PdfPCell(Image.getInstance(guinierImage), true); cell.setBorder(0); table.addCell(cell); } catch (Exception e) { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); e.printStackTrace(); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } String kraktyImage = BiosaxsActions .checkFilePathForDevelopment(substraction.getKratkyFilePath()); if (kraktyImage != null) { if (new File(kraktyImage).exists()) { try { PdfPCell cell = new PdfPCell(Image.getInstance(kraktyImage), true); cell.setBorder(0); table.addCell(cell); } catch (Exception e) { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); e.printStackTrace(); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } String gnomImage = BiosaxsActions .checkFilePathForDevelopment(substraction.getGnomFilePath()); if (gnomImage != null) { if (new File(gnomImage).exists()) { try { PdfPCell cell = new PdfPCell(Image.getInstance(gnomImage), true); cell.setBorder(0); table.addCell(cell); } catch (Exception e) { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); e.printStackTrace(); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } } else { PdfPCell cell = new PdfPCell(this.getCell("Image not found")); cell.setBorder(0); table.addCell(cell); } } } } } } return table; }
From source file:ispyb.client.biosaxs.pdf.DataAcquisitionPDFReport.java
License:Open Source License
private Element getAnalysis(Experiment3VO experiment, List<Buffer3VO> buffers) { PdfPTable table = new PdfPTable(COLUMNS.length); /** SUBTITLE **/ table.getDefaultCell().setColspan(5); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(this.getCell("Sample", BaseFont.HELVETICA_BOLD)); table.getDefaultCell().setColspan(5); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(this.getCell("Guinier", BaseFont.HELVETICA_BOLD)); table.getDefaultCell().setColspan(3); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(this.getCell("Gnom", BaseFont.HELVETICA_BOLD)); table.getDefaultCell().setColspan(2); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(this.getCell("Porod", BaseFont.HELVETICA_BOLD)); table.setWidthPercentage(100f);//w w w . j a v a2s .co m table.getDefaultCell().setPadding(3); table.getDefaultCell().setColspan(COLUMNS.length); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); table.getDefaultCell().setColspan(1); table.getDefaultCell().setBackgroundColor(PdfRtfExporter.BLUE_COLOR); for (int i = 0; i < COLUMNS.length; i++) { table.addCell(this.getCell(COLUMNS[i], BaseFont.HELVETICA_BOLD)); } table.getDefaultCell().setBackgroundColor(null); List<List<String>> data = this.getExperimentAnalysisData(experiment, buffers); for (List<String> list : data) { for (String string : list) { table.addCell(getCell(string)); } } return table; }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/*** * sets the sessions informations in the pdf document for fx or ix accounts * (Issue 1049)/*from w ww .jav a 2 s . c om*/ * * @param document * @throws Exception */ private void setSessionTable(Document document) throws Exception { 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:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set a line for a specified dataCollection in the dataCollection table * /*from w w w . j ava 2 s . c om*/ * @param document * @param table * @param col * @param session * @param df2 * @param df3 * @throws Exception */ private void setDataCollectionData(Document document, Table table, DataCollection3VO col, Session3Service sessionService, AutoProc3VO autoProcValue, AutoProcScalingStatistics3VO autoProcOverall, AutoProcScalingStatistics3VO autoProcInner, AutoProcScalingStatistics3VO autoProcOuter, boolean withAutoProcessing, boolean setEDNAInfo, ScreeningOutput3VO screeningOutput, ScreeningOutputLattice3VO screeningOutputLattice) throws Exception { // Session3VO slv = sessionService.findByPk(col.getSessionId(), false, // false, false); DataCollectionGroup3VO dcGroup = col.getDataCollectionGroupVO(); Session3VO slv = dcGroup.getSessionVO(); // here slv is not null if (col.getNumberOfImages() != null) { if (!DataCollectionExporter.isDataCollectionScreening(col)) { table.getDefaultCell().setGrayFill(GREY_FILL_DATA_COLLECT); } else table.getDefaultCell().setGrayFill(GREY_FILL_DATA); } if (col.getImagePrefix() != null) table.addCell(new Paragraph(col.getImagePrefix(), FONT_DOC)); else table.addCell(""); // The beamline name is only displayed for select by protein or by // sample name if (name != null) { if (slv.getBeamlineName() != null) table.addCell(new Paragraph(slv.getBeamlineName(), FONT_DOC)); else table.addCell(""); } if (col.getDataCollectionNumber() != null) table.addCell(new Paragraph(col.getDataCollectionNumber().toString(), FONT_DOC)); else table.addCell(""); if (col.getNumberOfImages() != null) table.addCell(new Paragraph(col.getNumberOfImages().toString(), FONT_DOC)); else table.addCell(""); if (withAutoProcessing) { // space group if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) { Paragraph p = new Paragraph(autoProcValue.getSpaceGroup(), FONT_DOC); table.addCell(p); } else if (setEDNAInfo && screeningOutputLattice != null && screeningOutputLattice.getSpaceGroup() != null) { Paragraph p = new Paragraph(screeningOutputLattice.getSpaceGroup(), FONT_DOC); table.addCell(p); } else table.addCell(""); // unit cell if (autoProcValue != null && autoProcValue.getSpaceGroup() != null) table.addCell(new Paragraph(autoProcValue.getRefinedCellA() + " (" + autoProcValue.getRefinedCellAlpha() + ")\n" + autoProcValue.getRefinedCellB() + " (" + autoProcValue.getRefinedCellBeta() + ")\n" + autoProcValue.getRefinedCellC() + " (" + autoProcValue.getRefinedCellGamma() + ")", FONT_DOC)); else if (setEDNAInfo && screeningOutputLattice != null && screeningOutputLattice.getUnitCell_a() != null && screeningOutputLattice.getUnitCell_b() != null && screeningOutputLattice.getUnitCell_c() != null && screeningOutputLattice.getUnitCell_alpha() != null && screeningOutputLattice.getUnitCell_beta() != null && screeningOutputLattice.getUnitCell_gamma() != null) { Paragraph p = new Paragraph(df3.format(screeningOutputLattice.getUnitCell_a()) + " (" + df3.format(screeningOutputLattice.getUnitCell_alpha()) + ")\n" + df3.format(screeningOutputLattice.getUnitCell_b()) + " (" + df3.format(screeningOutputLattice.getUnitCell_beta()) + ")\n" + df3.format(screeningOutputLattice.getUnitCell_c()) + " (" + df3.format(screeningOutputLattice.getUnitCell_gamma()) + ")", FONT_DOC); table.addCell(p); } else table.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(); } else if (setEDNAInfo && screeningOutput != null && screeningOutput.getRankingResolution() != null) { resolutionString = df2.format(screeningOutput.getRankingResolution()); } table.addCell(new Paragraph(completenessString, FONT_DOC)); table.addCell(new Paragraph(rSymmString, FONT_DOC)); table.addCell(new Paragraph(resolutionString, FONT_DOC)); } // detector resolution if (col.getResolution() != null) table.addCell(new Paragraph(df2.format(col.getResolution()), FONT_DOC)); else table.addCell(""); // wavelength if (col.getWavelength() != null) table.addCell(new Paragraph(df3.format(col.getWavelength()), FONT_DOC)); else table.addCell(""); // phi range if (col.getAxisRange() != null) table.addCell(new Paragraph(df2.format(col.getAxisRange()), FONT_DOC)); else table.addCell(""); // Column crystalClass only for IFX proposal in case of MXPress // experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // if (col.getCrystalClass() != null && col.getCrystalClass() != "") // table.addCell(new // Paragraph(col.getCrystalClass(), new Font(Font.HELVETICA, 8))); // else table.addCell(""); DataCollectionGroup3Service dataCollectionGroupService = (DataCollectionGroup3Service) ejb3ServiceLocator .getLocalService(DataCollectionGroup3Service.class); DataCollectionGroup3VO group = dataCollectionGroupService.findByPk(col.getDataCollectionGroupVOId(), true, true); boolean firstCollect = group.isFirstCollect(col); if (dcGroup.getCrystalClass() != null) { int idCC = getCrystalClassIndex(listOfCrystalClass, dcGroup.getCrystalClass().trim().toUpperCase()); String crystalS = ""; if (idCC == -1) { crystalS = dcGroup.getCrystalClass().toString(); } else { crystalS = listOfCrystalClass.get(idCC).getCrystalClassName(); } String crystalCell = crystalS; if (!firstCollect && crystalS != null && !crystalS.equals("")) { crystalCell = "(" + crystalS + ")"; } table.addCell(new Paragraph(crystalCell, FONT_DOC)); } else table.addCell(""); } table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); if (col.getComments() != null && col.getComments() != "") table.addCell(new Paragraph(col.getComments(), FONT_DOC)); else table.addCell(""); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the energy scan table// w w w. j a v a 2s . com * * @param document * @throws Exception */ private void setEnergyScansTable(Document document) throws Exception { if (slv == null) {// if session is null, no sense to display energy // scans return; } document.add(new Paragraph("Energy Scans:", FONT_TITLE)); document.add(new Paragraph(" ")); if (energyScanList == null || energyScanList.isEmpty()) { document.add(new Paragraph("There is no energy scan in this report", FONT_DOC)); } else { int NumColumnsES = 12; Table tableES = new Table(NumColumnsES); int headerwidthsSessionES[] = { 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 25 }; // percentage int headerwidthsMXPressES[] = { 7, 7, 7, 7, 7, 7, 6, 6, 7, 7, 7, 8, 17 }; // percentage tableES.setWidths(headerwidthsSessionES); // Column crystalClass added only for IFX proposal in case of // MXPress experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { tableES = new Table(NumColumnsES + 1); tableES.setWidths(headerwidthsMXPressES); } tableES.setWidth(100); // percentage tableES.setPadding(3); tableES.setCellsFitPage(true); tableES.getDefaultCell().setBorderWidth(1); tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // Energy Scan Header tableES.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableES.addCell(new Paragraph("Element", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Inflection Energy\n(keV)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Exposure Time\n(s)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Inflection f'\n(e)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Inflection f''\n(e)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Peak Energy\n(keV)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Peak f'\n(e)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Peak f''\n(e)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Beam size Hor.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Beam size Ver.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Transm. Factor\n(%)", FONT_DOC_BOLD)); // Column crystalClass only for IFX proposal in case of MXPress // experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) tableES.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD)); tableES.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); tableES.getDefaultCell().setGrayFill(GREY_FILL_DATA); tableES.getDefaultCell().setBorderWidth(1); // Energy Scan Rows Iterator<EnergyScan3VO> itES = energyScanList.iterator(); while (itES.hasNext()) { EnergyScan3VO col = itES.next(); if (col.getElement() != null) tableES.addCell(new Paragraph(col.getElement().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getExposureTime() != null) tableES.addCell(new Paragraph(col.getExposureTime().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getInflectionEnergy() != null) tableES.addCell(new Paragraph(col.getInflectionEnergy().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getInflectionFPrime() != null) tableES.addCell(new Paragraph(col.getInflectionFPrime().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getInflectionFDoublePrime() != null) tableES.addCell(new Paragraph(col.getInflectionFDoublePrime().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getPeakEnergy() != null) tableES.addCell(new Paragraph(col.getPeakEnergy().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getPeakFPrime() != null) tableES.addCell(new Paragraph(col.getPeakFPrime().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getPeakFDoublePrime() != null) tableES.addCell(new Paragraph(col.getPeakFDoublePrime().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getBeamSizeHorizontal() != null) tableES.addCell(new Paragraph(col.getBeamSizeHorizontal().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getBeamSizeVertical() != null) tableES.addCell(new Paragraph(col.getBeamSizeVertical().toString(), FONT_DOC)); else tableES.addCell(""); if (col.getTransmissionFactor() != null) tableES.addCell(new Paragraph(col.getTransmissionFactor().toString(), FONT_DOC)); else tableES.addCell(""); if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // if (col.getCrystalClass()!= null) tableES.addCell(new // Paragraph(col.getCrystalClass().toString(), // new Font(Font.HELVETICA, 8))); // else tableES.addCell(""); if (col.getCrystalClass() != null) { int idCC = getCrystalClassIndex(listOfCrystalClass, col.getCrystalClass().trim().toUpperCase()); if (idCC == -1) { tableES.addCell(new Paragraph(col.getCrystalClass().toString(), FONT_DOC)); } else tableES.addCell( new Paragraph(listOfCrystalClass.get(idCC).getCrystalClassName(), FONT_DOC)); } else tableES.addCell(""); } tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); if (col.getComments() != null) tableES.addCell(new Paragraph(col.getComments().toString(), FONT_DOC)); else tableES.addCell(""); tableES.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); } document.add(tableES); } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the XFR Spectra table//from www . j av a 2 s.com * * @param document * @throws Exception */ private void setXfrSpectraTable(Document document) throws Exception { if (slv == null) {// if session is null, no sense to display XFRSpectra return; } document.add(new Paragraph("XRF Spectra:", FONT_TITLE)); document.add(new Paragraph(" ")); if (xfeList == null || xfeList.isEmpty()) { document.add(new Paragraph("There is no XRF spectra in this report", FONT_DOC)); } else { int NumColumnsXRF = 6; Table tableXRF = new Table(NumColumnsXRF); int headerwidthsSessionXRF[] = { 15, 15, 15, 15, 15, 25 }; // percentage int headerwidthsMXPressXRF[] = { 16, 16, 15, 15, 15, 8, 17 }; // percentage tableXRF.setWidths(headerwidthsSessionXRF); // Column crystalClass added only for IFX proposal in case of // MXPress experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { tableXRF = new Table(NumColumnsXRF + 1); tableXRF.setWidths(headerwidthsMXPressXRF); } tableXRF.setWidth(100); // percentage tableXRF.setPadding(3); tableXRF.setCellsFitPage(true); tableXRF.getDefaultCell().setBorderWidth(1); tableXRF.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // XRF Spectra Header tableXRF.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableXRF.addCell(new Paragraph("Energy\n(keV)", FONT_DOC_BOLD)); tableXRF.addCell(new Paragraph("Exposure Time\n(s)", FONT_DOC_BOLD)); tableXRF.addCell(new Paragraph("Beam size Hor.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableXRF.addCell(new Paragraph("Beam size Ver.\n(" + Constants.MICRO + "m)", FONT_DOC_BOLD)); tableXRF.addCell(new Paragraph("Transm. Factor\n(%)", FONT_DOC_BOLD)); // Column crystalClass only for IFX proposal in case of MXPress // experiment if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) tableXRF.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD)); tableXRF.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); tableXRF.getDefaultCell().setGrayFill(GREY_FILL_DATA); tableXRF.getDefaultCell().setBorderWidth(1); // XRF Spectra Rows Iterator<XFEFluorescenceSpectrum3VO> itES = xfeList.iterator(); while (itES.hasNext()) { XFEFluorescenceSpectrum3VO col = itES.next(); if (col.getEnergy() != null) tableXRF.addCell(new Paragraph(col.getEnergy().toString(), FONT_DOC)); else tableXRF.addCell(""); if (col.getExposureTime() != null) tableXRF.addCell(new Paragraph(col.getExposureTime().toString(), FONT_DOC)); else tableXRF.addCell(""); if (col.getBeamSizeHorizontal() != null) tableXRF.addCell(new Paragraph(col.getBeamSizeHorizontal().toString(), FONT_DOC)); else tableXRF.addCell(""); if (col.getBeamSizeVertical() != null) tableXRF.addCell(new Paragraph(col.getBeamSizeVertical().toString(), FONT_DOC)); else tableXRF.addCell(""); if (col.getBeamTransmission() != null) tableXRF.addCell(new Paragraph(col.getBeamTransmission().toString(), FONT_DOC)); else tableXRF.addCell(""); if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX)) { // if (col.getCrystalClass()!= null) tableXRF.addCell(new // Paragraph(col.getCrystalClass().toString(), new // Font(Font.HELVETICA, 8))); // else tableXRF.addCell(""); if (col.getCrystalClass() != null) { int idCC = getCrystalClassIndex(listOfCrystalClass, col.getCrystalClass().trim().toUpperCase()); if (idCC == -1) { tableXRF.addCell(new Paragraph(col.getCrystalClass().toString(), FONT_DOC)); } else tableXRF.addCell( new Paragraph(listOfCrystalClass.get(idCC).getCrystalClassName(), FONT_DOC)); } else tableXRF.addCell(""); } tableXRF.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); if (col.getComments() != null) tableXRF.addCell(new Paragraph(col.getComments().toString(), FONT_DOC)); else tableXRF.addCell(""); tableXRF.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); } document.add(tableXRF); } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set a table for a sessionDataObject/*w w w . jav a 2 s . c om*/ * * @param document * @param sessionDataObject * @param mRequest */ private void setDetailSessionObjectTable(Document document, SessionDataObjectInformation sessionDataObject, HttpServletRequest mRequest) { try { int nbCol = 6; int nbRows = 5; List<Param> listParam = sessionDataObject.getListParameters(); int idParam = 0; int nbParam = listParam.size(); nbRows = Math.max(nbRows, nbParam); boolean secondGraph = sessionDataObject.getGraph2Path() != null && !sessionDataObject.getGraph2Path().isEmpty(); if (secondGraph) nbCol += 1; Table table = new Table(nbCol); int l = 0; int[] headersWidth = new int[nbCol]; headersWidth[l++] = 10; // def headersWidth[l++] = 6; // parameters title headersWidth[l++] = 6; // parameters value headersWidth[l++] = 12; // Thumbnail headersWidth[l++] = 12; // Snapshot headersWidth[l++] = 22; // Graph if (secondGraph) headersWidth[l++] = 22; // Graph2 table.setWidths(headersWidth); table.setWidth(100); // percentage table.setPadding(1); table.setCellsFitPage(true); table.setTableFitsPage(true); table.setBorderWidth(1); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // no header // first Row // firstCell: def : date SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); String collectTime = formatter.format(sessionDataObject.getDataTime()); Cell c = getCellValue(collectTime); c.setBorderWidthBottom(0); table.addCell(c); // second Cell param setCellParam(table, listParam, idParam++, 1); // third Cell : thumbnail Cell cellThumbnail = getCellImage(sessionDataObject.getImageThumbnailPath()); cellThumbnail.setRowspan(nbRows); cellThumbnail.setBorderWidth(0); table.addCell(cellThumbnail); // 4 Cell : snapshot Cell cellSnapshot = getCellImage(sessionDataObject.getCrystalSnapshotPath()); cellSnapshot.setRowspan(nbRows); cellSnapshot.setBorderWidth(0); table.addCell(cellSnapshot); // 5 Cell : graph Cell cellGraph = getCellGraph(sessionDataObject); cellGraph.setRowspan(nbRows); cellGraph.setBorderWidth(0); table.addCell(cellGraph); // 6 Cell : graph2 if (secondGraph) { Cell cellGraph2 = getCellImage(sessionDataObject.getGraph2Path()); cellGraph2.setRowspan(nbRows); cellGraph2.setBorderWidth(0); table.addCell(cellGraph2); } // second row Cell c2 = getCellValue(sessionDataObject.getImagePrefix() + " " + sessionDataObject.getRunNumber()); c2.setBorderWidth(0); table.addCell(c2); // param2 setCellParam(table, listParam, idParam++, 1); // third row Cell c3 = getCellValue(sessionDataObject.getExperimentType()); c3.setBorderWidth(0); table.addCell(c3); // param3 setCellParam(table, listParam, idParam++, 1); // 4 row Cell c4 = getCellValue(sessionDataObject.getSampleNameProtein()); c4.setBorderWidth(0); table.addCell(c4); // param4 setCellParam(table, listParam, idParam++, 1); // 5 row Cell c5 = new Cell(); c5.setHorizontalAlignment(Element.ALIGN_LEFT); c5.add(new Paragraph(sessionDataObject.getComments(), FONT_DOC_ITALIC)); c5.setBorderWidth(0); c5.setRowspan(nbRows - 4); table.addCell(c5); // param4 setCellParam(table, listParam, idParam++, 1); for (int i = 5; i < nbRows; i++) { setCellParam(table, listParam, idParam++, 1); } // results // workflow result status if (sessionDataObject.isWorkflow()) { Cell resultCell = getWorkflowResult(sessionDataObject.getWorkflow(), mRequest); resultCell.setHorizontalAlignment(Element.ALIGN_LEFT); resultCell.setColspan(nbCol); table.addCell(resultCell); } // collect OSC if ((sessionDataObject.isDataCollection() && !sessionDataObject.getDataCollection().getDataCollectionGroupVO().getExperimentType() .equals(Constants.EXPERIMENT_TYPE_CHARACTERIZATION))) { DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode, proposalNumber, mRequest); DataCollection3VO dataCollection = sessionDataObject.getDataCollection(); DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection, getSampleRankingVO(dataCollection.getDataCollectionId()), getAutoProcRankingVO(dataCollection.getDataCollectionId())); Cell resultCell = getAutoProcResultStatus(dcInfo); resultCell.setColspan(nbCol); resultCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(resultCell); document.add(table); document.add(new Paragraph(" ", VERY_SMALL_FONT)); setAutoProcResultsTable(document, dcInfo); } else if (sessionDataObject.isWorkflow() && sessionDataObject.getWorkflow().isMXPressEOIA()) { // MXPRESS // wf DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode, proposalNumber, mRequest); DataCollection3VO dataCollection = sessionDataObject.getListDataCollection().get(0); DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection, getSampleRankingVO(dataCollection.getDataCollectionId()), getAutoProcRankingVO(dataCollection.getDataCollectionId())); Cell resultCell = getAutoProcResultStatus(dcInfo); resultCell.setHorizontalAlignment(Element.ALIGN_LEFT); resultCell.setColspan(nbCol); table.addCell(resultCell); document.add(table); document.add(new Paragraph(" ", VERY_SMALL_FONT)); setAutoProcResultsTable(document, dcInfo); } else if ((sessionDataObject.isDataCollection() && sessionDataObject.getDataCollection().getDataCollectionGroupVO().getExperimentType() .equals(Constants.EXPERIMENT_TYPE_CHARACTERIZATION))) { // Characterization DataCollectionExporter dcExporter = new DataCollectionExporter(df2, df3, proposalCode, proposalNumber, mRequest); DataCollection3VO dataCollection = sessionDataObject.getDataCollection(); DataCollectionInformation dcInfo = dcExporter.getDataCollectionInformation(dataCollection, getSampleRankingVO(dataCollection.getDataCollectionId()), getAutoProcRankingVO(dataCollection.getDataCollectionId())); Cell resultCell = getCharacterizationResultStatus(dcInfo, mRequest); resultCell.setColspan(nbCol); resultCell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(resultCell); document.add(table); document.add(new Paragraph(" ", VERY_SMALL_FONT)); setStrategyTable2(document, dcInfo); } else { List<Param> listResults = sessionDataObject.getListResults(); if (listResults != null) { int nbResults = listResults.size(); for (int j = 0; j < nbResults; j++) { setCellParam(table, listResults, j, 2); Cell eCell = getEmptyCell(nbCol - 3); eCell.setBorderWidth(0); table.addCell(eCell); } } document.add(table); document.add(new Paragraph(" ", FONT_SPACE)); } } catch (Exception e) { e.printStackTrace(); } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set a cell for a param or empty cell if no more param in the list * /*from ww w . j a v a2 s . c o m*/ * @param table * @param listParam * @param id * @param colSpanTitle * @throws Exception */ private void setCellParam(Table table, List<Param> listParam, int id, int colSpanTitle) throws Exception { if (id < listParam.size()) { Param param = listParam.get(id); Cell cellTitle = new Cell(); cellTitle.setBorderWidth(0); cellTitle.setColspan(colSpanTitle); cellTitle.setHorizontalAlignment(Element.ALIGN_RIGHT); cellTitle.add(new Paragraph(param.getText(), FONT_DOC_PARAM_TITLE)); table.addCell(cellTitle); Cell cellValue = new Cell(); cellValue.setBorderWidth(0); cellValue.setHorizontalAlignment(Element.ALIGN_LEFT); cellValue.add(new Paragraph(param.getValue(), FONT_DOC)); table.addCell(cellValue); } else { Cell cellTitle = getEmptyCell(1); cellTitle.setBorderWidth(0); cellTitle.setColspan(colSpanTitle); table.addCell(cellTitle); Cell cellValue = getEmptyCell(1); cellValue.setBorderWidth(0); table.addCell(cellValue); } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * sets the date and if it is a SCREEN or a COLLECT and indexing status * //from www. j av a2s . c o m * @param document * @param dcValue * @param date * @throws Exception */ private void setDataCollectionGeneralInfo(Document document, DataCollection3VO dcValue, DataCollectionInformation dcInfo) throws Exception { String collect = "Collect"; if (DataCollectionExporter.isDataCollectionScreening(dcValue)) { collect = "Screen"; } String date = dcInfo.getDataCollectionDate(); String screeningSuccess = dcInfo.getScreeningSuccess(); String screeningFailure = dcInfo.getScreeningFailure(); String screeningNotDone = dcInfo.getScreeningNotDone(); Table aTable = new Table(3); aTable.setWidth(100); // percentage aTable.setPadding(3); aTable.setCellsFitPage(true); aTable.getDefaultCell().setBorderWidth(0); aTable.setBorderWidth(0); aTable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_LEFT); aTable.addCell(new Paragraph(date, FONT_DOC)); aTable.addCell(new Paragraph(collect, FONT_DOC)); // no indexing availabe if (screeningNotDone != null && !screeningNotDone.equals("")) { aTable.addCell(new Paragraph(screeningNotDone, FONT_INDEXING_NOTDONE)); } else if (screeningFailure != null && !screeningFailure.equals("")) { // indexing // failed aTable.addCell(new Paragraph(screeningFailure, FONT_INDEXING_FAILED)); } else if (screeningSuccess != null && !screeningSuccess.equals("")) { // indexing // successful aTable.addCell(new Paragraph(screeningSuccess, FONT_INDEXING_SUCCESS)); } else { aTable.addCell(new Paragraph(" ")); } 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// w w w . j av a 2s .c om * * @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 }