List of usage examples for com.lowagie.text Cell setHorizontalAlignment
public void setHorizontalAlignment(String alignment)
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * set the table for a given MXPressO//from w ww.j av a2 s . 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 }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * returns the cell for the mesh map/*www. ja v a 2s . com*/ * * @param wfMesh * @return */ private Cell getMeshMapCell(WorkflowMesh3VO wfMesh) { String imgMap = null; String cartographyPath = wfMesh.getCartographyPath(); if (cartographyPath != null) { imgMap = PathUtils.FitPathToOS(cartographyPath); } try { if (imgMap != null) { Image jpgMap = Image.getInstance(imgMap); // System.out.println(jpgMap.getWidth()+" * "+jpgMap.getHeight()); jpgMap.scaleAbsolute(jpgMap.getWidth() * IMAGE_HEIGHT / jpgMap.getHeight(), IMAGE_HEIGHT); Cell cellImage = new Cell(jpgMap); cellImage.setLeading(0); cellImage.setBorderWidth(0); cellImage.setHorizontalAlignment(Element.ALIGN_CENTER); return cellImage; } else { return new Cell(new Paragraph("no map found", FONT_DOC)); } } catch (IOException e) { try { return new Cell(new Paragraph(imgMap + " not found", FONT_DOC)); } catch (BadElementException e1) { e1.printStackTrace(); return null; } } catch (Exception e) { try { return new Cell(new Paragraph(imgMap + " not found", FONT_DOC)); } catch (BadElementException e1) { e1.printStackTrace(); return null; } } }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * returns a simple cell witha given value inside * /*from w ww . j a va2 s .c o m*/ * @param value * @return */ private Cell getCellValue(String value) { Cell cell = new Cell(); cell.setHorizontalAlignment(Element.ALIGN_LEFT); cell.add(new Paragraph(value, FONT_DOC_BOLD)); cell.setColspan(1); return cell; }
From source file:ispyb.client.mx.collection.PdfRtfExporter.java
License:Open Source License
/** * returns a cell with a given image inside * //ww w . j a va 2 s. co m * @param image * @return * @throws Exception */ private Cell getCellImage(String image) throws Exception { if (image != null && !image.equals("")) { try { Image jpg1 = Image.getInstance(image); jpg1.scaleAbsolute(jpg1.getWidth() * IMAGE_HEIGHT / jpg1.getHeight(), IMAGE_HEIGHT); Cell cell = new Cell(jpg1); cell.setLeading(0); cell.setBorderWidth(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); return cell; } catch (IOException e) { return new Cell(new Paragraph(image + " not found", FONT_DOC)); } } return new Cell(new Paragraph("", FONT_DOC)); }
From source file:ispyb.common.util.export.ExiPdfRtfExporter.java
License:Open Source License
/** * returns a cell with a given image inside * /* w ww . j a v a 2 s. com*/ * @param image * @return * @throws Exception */ private Cell getCellImage(Map<String, Object> dataCollectionMapItem, String imageParam) throws Exception { if (dataCollectionMapItem.get(imageParam) != null && !(dataCollectionMapItem.get(imageParam).toString()).equals("")) { String image = dataCollectionMapItem.get(imageParam).toString(); image = PathUtils.getPath(image); try { Image jpg1 = Image.getInstance(image); jpg1.scaleAbsolute(jpg1.getWidth() * IMAGE_HEIGHT / jpg1.getHeight(), IMAGE_HEIGHT); Cell cell = new Cell(jpg1); cell.setLeading(0); cell.setBorderWidth(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); return cell; } catch (IOException e) { return new Cell(new Paragraph(image + " not found", FONT_DOC)); } } return new Cell(new Paragraph("", FONT_DOC)); }
From source file:ispyb.common.util.export.ExiPdfRtfExporter.java
License:Open Source License
/** * returns a cell with a given image inside * /* ww w. jav a 2s. co m*/ * @param image * @return * @throws Exception */ private Cell getCellImage(String imagePath) throws Exception { if (imagePath != null) { String image = PathUtils.getPath(imagePath); try { Image jpg1 = Image.getInstance(image); jpg1.scaleAbsolute(jpg1.getWidth() * IMAGE_HEIGHT / jpg1.getHeight(), IMAGE_HEIGHT); Cell cell = new Cell(jpg1); cell.setLeading(0); cell.setBorderWidth(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_CENTER); return cell; } catch (IOException e) { return new Cell(new Paragraph(image + " not found", FONT_DOC)); } } return new Cell(new Paragraph("", FONT_DOC)); }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createDetailSection(List details, Document doc) throws CoreException, DocumentException { Table table = new Table(4); table.setSpaceInsideCell(10);/*from w w w .j a v a 2s. c om*/ table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 30, 30, 10, 30 }); Cell resourceHeader = new Cell(new Chunk(Messages.MarkerStatsView_fileColumn, tableHeaderAndFooterFont)); resourceHeader.setHorizontalAlignment(Element.ALIGN_CENTER); resourceHeader.setHeader(true); table.addCell(resourceHeader); Cell folderHeader = new Cell(new Chunk(Messages.MarkerStatsView_folderColumn, tableHeaderAndFooterFont)); folderHeader.setHorizontalAlignment(Element.ALIGN_CENTER); folderHeader.setHeader(true); table.addCell(folderHeader); Cell lineHeader = new Cell(new Chunk(Messages.MarkerStatsView_lineColumn, tableHeaderAndFooterFont)); lineHeader.setHorizontalAlignment(Element.ALIGN_CENTER); lineHeader.setHeader(true); table.addCell(lineHeader); Cell messageHeader = new Cell(new Chunk(Messages.MarkerStatsView_messageColumn, tableHeaderAndFooterFont)); messageHeader.setHorizontalAlignment(Element.ALIGN_CENTER); messageHeader.setHeader(true); table.addCell(messageHeader); Cell resourceCell; Cell fileCell; Cell lineCell; Cell messageCell; for (Iterator iter = details.iterator(); iter.hasNext();) { IMarker marker = (IMarker) iter.next(); resourceCell = new Cell(new Chunk(marker.getResource().getName(), mainFont)); table.addCell(resourceCell); fileCell = new Cell(new Chunk(marker.getResource().getParent().getFullPath().toString(), mainFont)); table.addCell(fileCell); lineCell = new Cell(new Chunk(marker.getAttribute(IMarker.LINE_NUMBER).toString(), mainFont)); lineCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(lineCell); messageCell = new Cell(new Chunk(marker.getAttribute(IMarker.MESSAGE).toString(), mainFont)); table.addCell(messageCell); } doc.add(table); }
From source file:net.sf.eclipsecs.ui.stats.export.internal.RTFStatsExporter.java
License:Open Source License
private void createSummaryTable(Stats stats, Document doc) throws DocumentException { Table table = new Table(2); table.setSpaceInsideCell(10);/*from w w w. j ava2 s.c o m*/ table.setAlignment(Element.ALIGN_LEFT); table.setWidth(100); table.setWidths(new float[] { 80, 20 }); Cell typeHeader = new Cell(new Chunk(Messages.MarkerStatsView_kindOfErrorColumn, tableHeaderAndFooterFont)); typeHeader.setHorizontalAlignment(Element.ALIGN_CENTER); typeHeader.setHeader(true); table.addCell(typeHeader); Cell countHeader = new Cell( new Chunk(Messages.MarkerStatsView_numberOfErrorsColumn, tableHeaderAndFooterFont)); countHeader.setHorizontalAlignment(Element.ALIGN_CENTER); countHeader.setHeader(true); table.addCell(countHeader); ArrayList markerStatsSortedList = new ArrayList(stats.getMarkerStats()); Collections.sort(markerStatsSortedList, new Comparator() { public int compare(Object arg0, Object arg1) { MarkerStat markerStat0 = (MarkerStat) arg0; MarkerStat markerStat1 = (MarkerStat) arg1; return markerStat1.getCount() - markerStat0.getCount(); } }); Cell typeCell; Cell countCell; for (Iterator iter = markerStatsSortedList.iterator(); iter.hasNext();) { MarkerStat markerStat = (MarkerStat) iter.next(); typeCell = new Cell(new Chunk(markerStat.getIdentifiant(), mainFont)); table.addCell(typeCell); countCell = new Cell(new Chunk(markerStat.getCount() + "", mainFont)); countCell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(countCell); } doc.add(table); }
From source file:open.dolphin.client.AuditController.java
License:Open Source License
private void makePDF() { //- ?//from www . jav a 2s . c o m Document doc = new Document(PageSize.A4, 20.0F, 20.0F, 40.0F, 40.0F); try { SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); String fileName = "_" + sdf.format(new java.util.Date()) + ".pdf"; //()?? FileOutputStream fos = new FileOutputStream(outputDir.getText() + fileName); PdfWriter pdfwriter = PdfWriter.getInstance(doc, fos); Font font_header = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 15.0F, 1); Font font_g11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); Font font_g10 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 10.0F); //- ? Font font_m8 = new Font(BaseFont.createFont("HeiseiMin-W3", "UniJIS-UCS2-HW-H", false), 8.0F); Font font_underline_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F, 4); Font font_red_11 = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 11.0F); font_red_11.setColor(new Color(255, 0, 0)); Font font_empty = new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 9.0F); font_empty.setColor(new Color(255, 255, 255)); Paragraph para_NF = new Paragraph(5, "\r\n", new Font(BaseFont.createFont("HeiseiKakuGo-W5", "UniJIS-UCS2-H", false), 13, Font.NORMAL)); para_NF.setAlignment(Element.ALIGN_CENTER); // ?? String author = Project.getProjectStub().getUserModel().getCommonName(); doc.addAuthor(author); doc.addSubject(""); HeaderFooter header = new HeaderFooter(new Phrase("", font_header), false); header.setAlignment(1); doc.setHeader(header); HeaderFooter footer = new HeaderFooter(new Phrase("--"), new Phrase("--")); footer.setAlignment(1); footer.setBorder(0); doc.setFooter(footer); doc.open(); SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy''MM''dd'' HH''mm''"); String today = sdf1.format(new java.util.Date()); Paragraph para_0 = new Paragraph("?" + today, font_g11); para_0.setAlignment(2); doc.add(para_0); Paragraph para_1 = new Paragraph("?" + author, font_g11); para_1.setAlignment(2); doc.add(para_1); doc.add(new Paragraph("")); // doc.add(para_NF); doc.add(para_NF); for (int cnt = 0; cnt < outputList.size(); cnt++) { InnerBean bean = outputList.get(cnt); Person person = bean.getPerson(); Paragraph para_2 = new Paragraph("ID" + person.idProperty().get(), font_underline_11); para_2.setAlignment(0); doc.add(para_2); Paragraph para_3 = new Paragraph("???" + person.nameProperty().get(), font_underline_11); para_3.setAlignment(0); doc.add(para_3); Paragraph para_4 = new Paragraph("" + person.nameKanaProperty().get(), font_underline_11); para_4.setAlignment(0); doc.add(para_4); Paragraph para_5 = new Paragraph("" + person.sexProperty().get(), font_underline_11); para_5.setAlignment(0); doc.add(para_5); Paragraph para_6 = new Paragraph("" + person.birthdayProperty().get(), font_underline_11); para_6.setAlignment(0); doc.add(para_6); Table karteHistoryTable = new Table(5); karteHistoryTable.setWidth(100.0F); int[] uriage_table_width = { 25, 20, 30, 20, 25 }; karteHistoryTable.setWidths(uriage_table_width); //karteHistoryTable.setDefaultHorizontalAlignment(1); //karteHistoryTable.setDefaultVerticalAlignment(5); karteHistoryTable.setPadding(3.0F); karteHistoryTable.setSpacing(0.0F); karteHistoryTable.setBorderColor(new Color(0, 0, 0)); Cell cell_01 = new Cell(new Phrase("?", font_g10)); cell_01.setGrayFill(0.8F); cell_01.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_11 = new Cell(new Phrase("?", font_g10)); cell_11.setGrayFill(0.8F); cell_11.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_21 = new Cell(new Phrase("", font_g10)); cell_21.setGrayFill(0.8F); cell_21.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_31 = new Cell(new Phrase("", font_g10)); cell_31.setGrayFill(0.8F); cell_31.setHorizontalAlignment(Element.ALIGN_CENTER); Cell cell_41 = new Cell(new Phrase("", font_g10)); cell_41.setGrayFill(0.8F); cell_41.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); List<KarteBean> list = bean.getResult(); KarteBean karteInfo = list.get(0); List<DocInfoModel> docInfoList = karteInfo.getDocInfoList(); //- ??? int stepCount = 22; int tempCount = 0; int pageCount = 0; String firstKarteMaker = null; String karteMakeDate = null; if (docInfoList != null) { for (int i = 0; i < docInfoList.size(); ++i) { DocInfoModel docInfo = docInfoList.get(i); Cell cell = new Cell(new Phrase(docInfo.getFirstConfirmDateTime(), font_m8)); if (karteMakeDate == null || !karteMakeDate.equals(docInfo.getFirstConfirmDateTime())) { karteMakeDate = docInfo.getFirstConfirmDateTime(); firstKarteMaker = docInfo.getPurpose(); } cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(firstKarteMaker, font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); //- String addTitle = docInfo.getTitle(); addTitle = addTitle.replace("\r\n", ""); addTitle = addTitle.replace("\n", ""); cell = new Cell(new Phrase(addTitle, font_m8)); cell.setHorizontalAlignment(0); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getPurpose(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); cell = new Cell(new Phrase(docInfo.getConfirmDateTime(), font_m8)); cell.setHorizontalAlignment(0); cell.setHorizontalAlignment(Element.ALIGN_CENTER); karteHistoryTable.addCell(cell); if (stepCount == tempCount) { if (pageCount == 0) { stepCount += 5; pageCount++; } tempCount = 0; doc.add(karteHistoryTable); doc.newPage(); karteHistoryTable.deleteAllRows(); karteHistoryTable.addCell(cell_01); karteHistoryTable.addCell(cell_11); karteHistoryTable.addCell(cell_21); karteHistoryTable.addCell(cell_31); karteHistoryTable.addCell(cell_41); } else { tempCount++; } } // Cell Empty_Cell = new Cell(new Phrase("empty", font_empty)); // for (int i = docInfoList.size(); i < docInfoList.size() + 4; ++i) { // for (int j = 0; j < 4; ++j) { // karteHistoryTable.addCell(Empty_Cell); // } // } // // Cell cell_goukei = new Cell(new Phrase("?", font_g10)); // cell_goukei.setGrayFill(0.8F); // cell_goukei.setColspan(3); // karteHistoryTable.addCell(cell_goukei); // Cell cell_sum = new Cell(new Phrase("136,900", font_m10)); // cell_sum.setHorizontalAlignment(2); // karteHistoryTable.addCell(cell_sum); doc.add(karteHistoryTable); doc.newPage(); } else { // doc.add(para_NF); Paragraph noData = new Paragraph("??", font_m8); noData.setAlignment(0); doc.add(noData); doc.newPage(); } } } catch (DocumentException | IOException e) { Logger.getLogger(AuditController.class.getName()).log(Level.SEVERE, null, e); } finally { doc.close(); } }
From source file:org.activityinfo.server.report.renderer.itext.ItextMapRenderer.java
License:Open Source License
private void renderLegend(MapReportElement element, Document doc) throws DocumentException, IOException { Table table = new Table(2); table.setBorderWidth(1);/*from ww w . j ava2s . c o m*/ table.setWidth(100f); table.setBorderColor(new Color(100, 100, 100)); table.setPadding(5); table.setSpacing(0); table.setCellsFitPage(true); table.setTableFitsPage(true); table.setWidths(new int[] { 1, 3 }); Cell cell = new Cell(I18N.CONSTANTS.legend()); cell.setHeader(true); cell.setColspan(2); table.addCell(cell); table.endHeaders(); for (MapLayerLegend legend : element.getContent().getLegends()) { Cell symbolCell = new Cell(); symbolCell.setHorizontalAlignment(Element.ALIGN_CENTER); symbolCell.setVerticalAlignment(Element.ALIGN_MIDDLE); Image symbol = createLegendSymbol(legend, imageCreator); symbolCell.addElement(symbol); Cell descriptionCell = new Cell(); addLegendDescription(element, legend.getDefinition(), descriptionCell); table.addCell(symbolCell); table.addCell(descriptionCell); } doc.add(table); }