List of usage examples for com.lowagie.text Cell setColspan
public void setColspan(int value)
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellFirstBold(String strCaption, int iColspan, boolean bColor, int iSize, int iSecondSize) throws BadElementException { Font firstFont = null;/* w w w.j a v a2 s.c o m*/ Font secondFont = null; switch (iSize) { case 8: firstFont = REPORT_SETTINGS.ftTableHeader8B; break; case 9: firstFont = REPORT_SETTINGS.ftTableHeader9B; break; case 12: firstFont = REPORT_SETTINGS.ftTableHeader12B; break; default: firstFont = REPORT_SETTINGS.ftTableHeaderB; break; } switch (iSecondSize) { case 8: secondFont = REPORT_SETTINGS.ftTableHeader8; break; case 9: secondFont = REPORT_SETTINGS.ftTableHeader9; break; case 12: secondFont = REPORT_SETTINGS.ftTableHeader12; break; default: secondFont = REPORT_SETTINGS.ftTableHeader; break; } String firstChar = (StringManager.isNotEmpty(strCaption) ? String.valueOf(strCaption.charAt(0)) : ""); String otherPart = (StringManager.isNotEmpty(strCaption) ? strCaption.substring(1, strCaption.length()) : ""); Chunk firstCharChunk = new Chunk(firstChar, firstFont); Phrase str = new Phrase(otherPart, secondFont); str.add(0, firstCharChunk); Cell cl = new Cell(str); if (bColor) { cl.setBackgroundColor(REPORT_SETTINGS.clTableHeader); } cl.setColspan(iColspan); this.addCell(cl); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addCellFirstLineBold(String strCaption, int iColspan, int iSize, int iSecondSize) throws BadElementException { Font firstFont = null;/* w w w. j a v a2 s.c o m*/ Font secondFont = null; switch (iSize) { case 8: firstFont = REPORT_SETTINGS.ftText8B; break; case 9: firstFont = REPORT_SETTINGS.ftText9B; break; default: firstFont = REPORT_SETTINGS.ftText12B; break; } switch (iSecondSize) { case 8: secondFont = REPORT_SETTINGS.ftText8; break; case 9: secondFont = REPORT_SETTINGS.ftText9; break; default: secondFont = REPORT_SETTINGS.ftText12; break; } String newLineChar = "\n"; String firstPart = StringManager.isNotEmpty(strCaption) ? strCaption.substring(0, strCaption.indexOf(newLineChar) + newLineChar.length()) : ""; String otherPart = StringManager.isNotEmpty(strCaption) ? strCaption.substring(firstPart.length()) : ""; Chunk firstCharChunk = new Chunk(firstPart, firstFont); Phrase str = new Phrase(otherPart, secondFont); str.add(0, firstCharChunk); Cell cl = new Cell(str); cl.setColspan(iColspan); this.addCell(cl); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addCellBU(String strCaption, int iSize, int iColspan) throws BadElementException { strCaption = strCaption == null ? "" : strCaption; Cell cell = null; switch (iSize) { case 8://www .j av a 2s . c om cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText8BU)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText9BU)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText10BU)); break; case 11: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText11BU)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText12BU)); break; case 13: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText13BU)); break; case 14: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText14BU)); break; case 15: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText15BU)); break; case 16: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText16BU)); break; case 17: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText17BU)); break; case 18: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText18BU)); break; case 19: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText19BU)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText12BU)); break; } cell.setColspan(iColspan); this.addCell(cell); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addCellB(String strCaption, int iSize, int iColspan) throws BadElementException { strCaption = strCaption == null ? "" : strCaption; Cell cell = null; switch (iSize) { case 8:/*from w ww . j av a 2s . c o m*/ cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText8B)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText9B)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText10B)); break; case 11: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText11B)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText12B)); break; case 13: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText13B)); break; case 14: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText14B)); break; case 15: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText15B)); break; case 16: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText16B)); break; case 17: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText17B)); break; case 18: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText18B)); break; case 19: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText19B)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText12B)); break; } cell.setColspan(iColspan); this.addCell(cell); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addCell(String strCaption, int iSize, int iColspan, int iRowspan) throws BadElementException { strCaption = strCaption == null ? "" : strCaption; Cell cell = null; switch (iSize) { case 8:// ww w .j av a2s . c o m cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText8)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText9)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText10)); break; case 11: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText11)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText12)); break; case 13: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText13)); break; case 14: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText14)); break; case 15: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText15)); break; case 16: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText16)); break; case 17: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText17)); break; case 18: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText18)); break; case 19: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftText19)); break; default: cell = new Cell(strCaption); break; } cell.setColspan(iColspan); cell.setRowspan(iRowspan); this.addCell(cell); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellI(String strCaption, int iColspan, boolean bColor, int iSize) throws BadElementException { Cell cell = null; switch (iSize) { case 9:/*www .j a v a2 s . co m*/ cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader9I)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader12I)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeaderI)); break; } if (bColor) { cell.setBackgroundColor(REPORT_SETTINGS.clTableHeader); } cell.setColspan(iColspan); this.addCell(cell); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellBI(String strCaption, int iColspan, boolean bColor, int iSize) throws BadElementException { Cell cell = null; switch (iSize) { case 8://from ww w . ja v a 2 s . c o m cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader8BI)); break; case 9: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader9BI)); break; case 10: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader10BI)); break; case 12: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeader12BI)); break; default: cell = new Cell(new Phrase(strCaption, REPORT_SETTINGS.ftTableHeaderBI)); break; } if (bColor) { cell.setBackgroundColor(REPORT_SETTINGS.clTableHeader); } cell.setColspan(iColspan); this.addCell(cell); }
From source file:se.idega.idegaweb.commune.school.report.business.ReportPDFWriter.java
License:Open Source License
/** * Builds the report column headers./* w w w.j a v a 2s . co m*/ */ protected void buildColumnHeaders(Table table) throws BadElementException { Header[] headers = this._reportModel.getColumnHeaders(); com.lowagie.text.Cell cell = new com.lowagie.text.Cell(); cell.setRowspan(2); table.addCell(cell, new Point(0, 0)); int column = 1; for (int i = 0; i < headers.length; i++) { Header header = headers[i]; Header[] children = header.getChildren(); if (children == null) { String s = null; if (header.getHeaderType() == Header.HEADERTYPE_COLUMN_NONLOCALIZED_HEADER) { s = header.getLocalizationKey(); } else { s = localize(header.getLocalizationKey(), header.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._normalFont)); cell.setRowspan(2); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); table.addCell(cell, new Point(0, column)); setColSize(s, column, true); column++; } else { String s = null; if (header.getHeaderType() == Header.HEADERTYPE_COLUMN_NONLOCALIZED_HEADER) { s = header.getLocalizationKey(); } else { s = localize(header.getLocalizationKey(), header.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._normalFont)); cell.setColspan(children.length); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell, new Point(0, column)); if (children.length == 1) { setColSize(s, column, false); } for (int j = 0; j < children.length; j++) { Header child = children[j]; s = null; if (child.getHeaderType() == Header.HEADERTYPE_COLUMN_NONLOCALIZED_HEADER) { s = child.getLocalizationKey(); } else { s = localize(child.getLocalizationKey(), child.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._normalFont)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_BOTTOM); cell.setNoWrap(true); table.addCell(cell, new Point(1, column + j)); setColSize(s, column + j, false); } column += children.length; } } }
From source file:se.idega.idegaweb.commune.school.report.business.ReportPDFWriter.java
License:Open Source License
/** * Builds the report row headers./* w w w .jav a 2 s . c o m*/ */ protected void buildRowHeaders(Table table) throws BadElementException { Header[] headers = this._reportModel.getRowHeaders(); int row = 2; String s = null; com.lowagie.text.Cell cell = null; for (int i = 0; i < headers.length; i++) { Header header = headers[i]; Header[] children = header.getChildren(); if (children == null) { int headerType = header.getHeaderType(); if (headerType == Header.HEADERTYPE_ROW_SPACER) { s = " "; } else if (headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER || header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) { s = header.getLocalizationKey(); } else { s = localize(header.getLocalizationKey(), header.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._boldFont)); if (headerType == Header.HEADERTYPE_ROW_LABEL || headerType == Header.HEADERTYPE_ROW_SPACER) { cell.setColspan(this._reportModel.getColumnSize() + 1); } cell.setNoWrap(true); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (headerType == Header.HEADERTYPE_ROW_LABEL) { cell.setBackgroundColor(new java.awt.Color(0xe0, 0xe0, 0xe0)); } table.addCell(cell, new Point(row, 0)); setColSize(s, 0, false); row++; } else { if (header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER || header.getHeaderType() == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) { s = header.getLocalizationKey(); } else { s = localize(header.getLocalizationKey(), header.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._normalFont)); cell.setColspan(this._reportModel.getColumnSize() + 1); cell.setLeading(16); table.addCell(cell, new Point(row, 0)); row++; for (int j = 0; j < children.length; j++) { Header child = children[j]; int headerType = child.getHeaderType(); if (headerType == Header.HEADERTYPE_ROW_SPACER) { s = " "; } else if (headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_HEADER || headerType == Header.HEADERTYPE_ROW_NONLOCALIZED_NORMAL) { s = child.getLocalizationKey(); } else { s = localize(child.getLocalizationKey(), child.getLocalizationKey()); } cell = new com.lowagie.text.Cell(new Phrase(s, this._boldFont)); if (headerType == Header.HEADERTYPE_ROW_LABEL || headerType == Header.HEADERTYPE_ROW_SPACER) { cell.setColspan(this._reportModel.getColumnSize() + 1); } cell.setNoWrap(true); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); if (headerType == Header.HEADERTYPE_ROW_LABEL) { cell.setBackgroundColor(new java.awt.Color(0xe0, 0xe0, 0xe0)); } table.addCell(cell, row, 0); setColSize(s, 0, false); row++; } } } }