List of usage examples for com.lowagie.text Table setPadding
public void setPadding(float value)
From source file:io.vertigo.dynamo.plugins.export.pdfrtf.AbstractExporterIText.java
License:Apache License
/** * Mthode principale qui gre l'export d'un tableau vers un fichier ODS. * * @param export paramtres du document exporter * @param out flux de sortie/*w w w .j av a2 s.com*/ * @throws DocumentException Exception */ public final void exportData(final Export export, final OutputStream out) throws DocumentException { // step 1: creation of a document-object final boolean landscape = export.getOrientation() == Export.Orientation.Landscape; final Rectangle pageSize = landscape ? PageSize.A4.rotate() : PageSize.A4; final Document document = new Document(pageSize, 20, 20, 50, 50); // left, // right, // top, // bottom // step 2: we create a writer that listens to the document and directs a // PDF-stream to out createWriter(document, out); // we add some meta information to the document, and we open it final String title = export.getTitle(); if (title != null) { final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } final String author = export.getAuthor(); document.addAuthor(author); document.addCreator(CREATOR); document.open(); try { // pour ajouter l'ouverture automatique de la bote de dialogue // imprimer // (print(false) pour imprimer directement) // ((PdfWriter) writer).addJavaScript("this.print(true);", false); for (final ExportSheet exportSheet : export.getSheets()) { final Table datatable; if (exportSheet.hasDtObject()) { // table datatable = new Table(2); datatable.setCellsFitPage(true); datatable.setPadding(4); datatable.setSpacing(0); // data rows renderObject(exportSheet, datatable); } else { // table datatable = new Table(exportSheet.getExportFields().size()); datatable.setCellsFitPage(true); datatable.setPadding(4); datatable.setSpacing(0); // headers renderHeaders(exportSheet, datatable); // data rows renderList(exportSheet, datatable); } document.add(datatable); } } finally { // we close the document document.close(); } }
From source file:io.vertigo.quarto.plugins.export.pdfrtf.AbstractExporterIText.java
License:Apache License
/** * Mthode principale qui gre l'export d'un tableau vers un fichier ODS. * * @param export paramtres du document exporter * @param out flux de sortie/* ww w . j a va2 s .c o m*/ * @throws DocumentException Exception */ public final void exportData(final Export export, final OutputStream out) throws DocumentException { // step 1: creation of a document-object final boolean landscape = export.getOrientation() == Export.Orientation.Landscape; final Rectangle pageSize = landscape ? PageSize.A4.rotate() : PageSize.A4; final Document document = new Document(pageSize, 20, 20, 50, 50); // left, right, top, bottom // step 2: we create a writer that listens to the document and directs a PDF-stream to out createWriter(document, out); // we add some meta information to the document, and we open it final String title = export.getTitle(); if (title != null) { final HeaderFooter header = new HeaderFooter(new Phrase(title), false); header.setAlignment(Element.ALIGN_LEFT); header.setBorder(Rectangle.NO_BORDER); document.setHeader(header); document.addTitle(title); } final String author = export.getAuthor(); document.addAuthor(author); document.addCreator(CREATOR); document.open(); try { // pour ajouter l'ouverture automatique de la bote de dialogue imprimer (print(false) pour imprimer directement) // ((PdfWriter) writer).addJavaScript("this.print(true);", false); for (final ExportSheet exportSheet : export.getSheets()) { final Table datatable; if (exportSheet.hasDtObject()) { // table datatable = new Table(2); datatable.setCellsFitPage(true); datatable.setPadding(4); datatable.setSpacing(0); // data rows renderObject(exportSheet, datatable); } else { // table datatable = new Table(exportSheet.getExportFields().size()); datatable.setCellsFitPage(true); datatable.setPadding(4); datatable.setSpacing(0); // headers renderHeaders(exportSheet, datatable); // data rows renderList(exportSheet, datatable); } document.add(datatable); } } finally { // we close the document document.close(); } }
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 w w.j a va2 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 the header for the dataCollection table * /*w ww . j a va 2 s . c o m*/ * @param document * @param table * @throws Exception */ private Table setDataCollectionHeader(Document document, Table table, boolean withAutoProcessing) throws Exception { int nbCol = NB_COL_DATACOLLECTION; boolean withoutAutoProc = !withAutoProcessing; boolean withSampleName = name != null; boolean isIfx = proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX); if (withoutAutoProc) { nbCol -= 5; } if (withSampleName) { nbCol += 1; } if (isIfx) { nbCol += 1; } table = new Table(nbCol); int[] headersWidth = new int[nbCol]; int i = 0; // image prefix headersWidth[i] = 12; if (withSampleName && !withAutoProcessing) headersWidth[i] = 10; i++; // beamline if (withSampleName) { headersWidth[i++] = 5; } // run no headersWidth[i++] = 5; // nb images headersWidth[i++] = 6; // auto proc if (withAutoProcessing) { headersWidth[i++] = 9; // space group headersWidth[i++] = 9; // unit cell headersWidth[i++] = 10; // completeness headersWidth[i++] = 9; // rsymm headersWidth[i++] = 9; // resolution } // detector headersWidth[i++] = 7; // wavelength headersWidth[i++] = 8; // phi range headersWidth[i++] = 5; // crytsl class if (isIfx) { headersWidth[i++] = 8; } // comments headersWidth[i++] = 17; // table.setWidths(headersWidth); table.setWidth(100); // percentage table.setPadding(3); table.setCellsFitPage(true); table.getDefaultCell().setBorderWidth(1); table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // DataCollection Header table.getDefaultCell().setGrayFill(GREY_FILL_HEADER); table.addCell(new Paragraph("Image prefix", FONT_DOC_BOLD)); if (withSampleName) table.addCell(new Paragraph("Beamline", FONT_DOC_BOLD)); table.addCell(new Paragraph("Run no", FONT_DOC_BOLD)); table.addCell(new Paragraph("# images", FONT_DOC_BOLD)); if (withAutoProcessing) { table.addCell(new Paragraph("Space Group", FONT_DOC_BOLD)); table.addCell(new Paragraph("Unit Cell", FONT_DOC_BOLD)); table.addCell(new Paragraph("Completeness (Inner, Outer, Overall)", FONT_DOC_BOLD)); table.addCell(new Paragraph("Rsymm (Inner, Outer, Overall)", FONT_DOC_BOLD)); table.addCell(new Paragraph("Resolution", FONT_DOC_BOLD)); } table.addCell(new Paragraph("Detector\nResolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); table.addCell(new Paragraph("Wavelength\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); table.addCell(new Paragraph("Phi range\n(" + Constants.DEGREE + ")", FONT_DOC_BOLD)); // Column crystalClass only for IFX proposal in case of MXPress // experiment if (isIfx) table.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD)); table.addCell(new Paragraph("Comments", FONT_DOC_BOLD)); table.getDefaultCell().setBorderWidth(1); return table; }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the energy scan table//from w w w.j a v a2 s.co m * * @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// w w w . ja va 2s.c o m * * @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 the summary - IFX proposal//from w w w . j a v a 2 s. c om * * @param document * @throws Exception */ private void setSummary(Document document) throws Exception { if (proposalCode.toLowerCase().equals(Constants.PROPOSAL_CODE_FX) && name == null) { document.add(new Paragraph(" ")); document.add(new Paragraph("Summary:", FONT_TITLE)); document.add(new Paragraph(" ")); int NumColumnsCC = 2; Table tableCC = new Table(NumColumnsCC); int headerwidthsCC[] = { 30, 15 }; // percentage tableCC.setWidths(headerwidthsCC); tableCC.setWidth(50); // percentage tableCC.setPadding(3); tableCC.setCellsFitPage(true); tableCC.getDefaultCell().setBorderWidth(1); tableCC.getDefaultCell().setGrayFill(GREY_FILL_HEADER); tableCC.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); tableCC.addCell(new Paragraph("Crystal class", FONT_DOC_BOLD)); tableCC.addCell(new Paragraph("Number of crystals", FONT_DOC_BOLD)); tableCC.getDefaultCell().setGrayFill(GREY_FILL_DATA); int nbCC = listOfCrystalClass.size(); for (int cc = 0; cc < nbCC; cc++) { if (listOfNbCrystalPerClass.get(cc) > 0) { tableCC.addCell(new Paragraph(listOfCrystalClass.get(cc).getCrystalClassName() + " (" + listOfCrystalClass.get(cc).getCrystalClassCode() + ")", FONT_DOC)); tableCC.addCell(new Paragraph(listOfNbCrystalPerClass.get(cc).toString(), FONT_DOC)); } LOG.debug("classe " + listOfCrystalClass.get(cc).getCrystalClassCode() + ": " + listOfNbCrystalPerClass.get(cc).toString()); } document.add(tableCC); // total // int nbPuckScreen = nbCrystal3; // int nbTotal = nbCrystal1 + nbCrystal2 + nbCrystalT; int nbPuckScreen = listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "PS")); // nbTotal = C+CR+T+SC+SCR int nbTotal = listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "C")) + listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "SC")) + listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "T")) + listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "CR")) + listOfNbCrystalPerClass.get(getCrystalClassIndex(listOfCrystalClass, "SCR")); document.add(new Paragraph(" ")); document.add(new Paragraph("Total number of tests: " + new String(new Integer(nbTotal).toString()), FONT_DOC)); document.add(new Paragraph("Nb of puck screens: " + new String(new Integer(nbPuckScreen).toString()), FONT_DOC)); document.add(new Paragraph( "Total number of samples: " + new String(new Integer(nbTotal + (nbPuckScreen * 10)).toString()), FONT_DOC)); } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set a table for a sessionDataObject//from ww w .j ava 2 s . c o m * * @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
/** * sets the date and if it is a SCREEN or a COLLECT and indexing status * /* w w w .ja va 2 s. c om*/ * @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 EDNA Table//from www . java2 s . c o m * * @param document * @param dcInfo * @throws Exception */ private void setEDNATable(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(70); // percentage tableEDNA.setPadding(3); tableEDNA.setCellsFitPage(true); tableEDNA.setTableFitsPage(true); // tableEDNA.getDefaultCell().setBorderWidth(1); tableEDNA.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER); // EDNA Header tableEDNA.getDefaultCell().setBackgroundColor(BLUE_COLOR); tableEDNA.addCell(new Paragraph("Space Group", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Unit Cell", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Mosaicity\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); tableEDNA.addCell(new Paragraph("Ranking Resolution\n(" + Constants.ANGSTROM + ")", FONT_DOC_BOLD)); tableEDNA.getDefaultCell().setBorderWidth(1); tableEDNA.getDefaultCell().setBackgroundColor(WHITE_COLOR); // EDNA data String unitCell = dcInfo.getCellA() + " (" + dcInfo.getCellAlpha() + ")\n" + dcInfo.getCellB() + " (" + dcInfo.getCellBeta() + ")\n" + dcInfo.getCellC() + " (" + 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)); // document.add(tableEDNA); document.add(new Paragraph(" ", VERY_SMALL_FONT)); } }