List of usage examples for com.lowagie.text Rectangle RIGHT
int RIGHT
To view the source code for com.lowagie.text Rectangle RIGHT.
Click Source Link
Rectangle
. From source file:org.areasy.common.doclet.document.elements.CellBorderPadding.java
License:Open Source License
/** * Creates a PdfPCell with a border and a padding of 6. * * @param data The cell content.//from www .ja v a2 s.c o m */ public CellBorderPadding(Phrase data) { super(data); super.setBorder(Rectangle.TOP + Rectangle.LEFT + Rectangle.BOTTOM + Rectangle.RIGHT); super.setPadding(6); super.setBorderWidth(1); super.setBorderColor(Color.gray); }
From source file:org.areasy.common.doclet.document.elements.CellBorderPadding.java
License:Open Source License
/** * Creates a PdfPCell with no bottom border. * * @param data The cell content./* ww w. ja va 2 s . c om*/ */ public CellBorderPadding(Paragraph data) { super(data); super.setBorder(Rectangle.TOP + Rectangle.LEFT + Rectangle.RIGHT); super.setPadding(6); super.setBorderWidth(1); super.setBorderColor(Color.gray); }
From source file:org.areasy.common.doclet.document.elements.CustomPdfPCell.java
License:Open Source License
/** * A coloured title bar (for the "Fields", "Methods" and * "Constructors" titles)./* w w w. j a v a 2 s . c o m*/ */ public CustomPdfPCell(String title) { super(new Phrase(title, Fonts.getFont(TEXT_FONT, 18))); super.setPaddingTop((float) 0.0); super.setPaddingBottom((float) 5.0); super.setPaddingLeft((float) 3.0); super.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); super.setBackgroundColor(COLOR_SUMMARY_HEADER); super.setBorder(Rectangle.TOP + Rectangle.LEFT + Rectangle.BOTTOM + Rectangle.RIGHT); super.setBorderWidth(1); super.setBorderColor(Color.gray); }
From source file:org.areasy.common.doclet.document.elements.CustomPdfPCell.java
License:Open Source License
/** * A coloured title bar (for summary tables etc.) * * @param paragraph The text for the title. * @param backgroundColor Color of the cell *//* ww w. java 2s . c o m*/ public CustomPdfPCell(Paragraph paragraph, Color backgroundColor) { super(paragraph); super.setPaddingTop((float) 0.0); super.setPaddingBottom((float) 5.0); super.setPaddingLeft((float) 3.0); super.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE); super.setBackgroundColor(backgroundColor); super.setBorder(Rectangle.TOP + Rectangle.LEFT + Rectangle.BOTTOM + Rectangle.RIGHT); super.setBorderWidth(1); super.setBorderColor(Color.gray); }
From source file:org.areasy.common.doclet.document.Inherited.java
License:Open Source License
/** * Prints inherited methods and fields from superclasses * * @param supercls class source to get inherited fields and methods for. * @param show SHOW_METHODS or SHOW_FIELDS * @throws Exception//from w ww . ja va 2s . co m */ public static void print(ClassDoc supercls, int show) throws Exception { String type; FieldDoc[] fields = supercls.fields(); Arrays.sort(fields); if (supercls.isInterface()) type = "interface"; else type = "class"; // Create cell for additional spacing below PdfPCell spacingCell = new PdfPCell(); spacingCell.addElement(new Chunk(" ")); spacingCell.setFixedHeight((float) 4.0); spacingCell.setBorder(Rectangle.BOTTOM + Rectangle.LEFT + Rectangle.RIGHT); spacingCell.setBorderColor(Color.gray); if ((fields.length > 0) && (show == SHOW_FIELDS)) { Document.instance().add(new Paragraph((float) 6.0, " ")); PdfPTable table = new PdfPTable(1); table.setWidthPercentage((float) 100); Paragraph newLine = new Paragraph(); newLine.add(new Chunk("Fields inherited from " + type + " ", Fonts.getFont(TEXT_FONT, BOLD, 10))); newLine.add(new LinkPhrase(supercls.qualifiedTypeName(), null, 10, false)); table.addCell(new CustomPdfPCell(newLine, COLOR_INHERITED_SUMMARY)); Paragraph paraList = new Paragraph(); for (int i = 0; i < fields.length; i++) { paraList.add(new LinkPhrase(fields[i].qualifiedName(), fields[i].name(), 10, false)); if (i != (fields.length - 1)) paraList.add(new Chunk(", ", Fonts.getFont(TEXT_FONT, BOLD, 12))); } PdfPCell contentCell = new CellBorderPadding(paraList); float leading = (float) contentCell.getLeading() + (float) 1.1; contentCell.setLeading(leading, leading); table.addCell(contentCell); table.addCell(spacingCell); Document.instance().add(table); } MethodDoc[] meth = supercls.methods(); Arrays.sort(meth); if ((meth.length > 0) && (show == SHOW_METHODS)) { Document.instance().add(new Paragraph((float) 6.0, " ")); PdfPTable table = new CustomPdfPTable(); Paragraph newLine = new Paragraph(); newLine.add(new Chunk("Methods inherited from " + type + " ", Fonts.getFont(TEXT_FONT, BOLD, 10))); newLine.add(new LinkPhrase(supercls.qualifiedTypeName(), null, 10, false)); table.addCell(new CustomPdfPCell(newLine, COLOR_INHERITED_SUMMARY)); Paragraph paraList = new Paragraph(); for (int i = 0; i < meth.length; i++) { String methodLabel = meth[i].name(); // Do not list static initializers like "<clinit>" if (!methodLabel.startsWith("<")) { paraList.add(new LinkPhrase(supercls.qualifiedTypeName() + "." + meth[i].name(), meth[i].name(), 10, false)); if (i != (meth.length - 1)) paraList.add(new Chunk(", ", Fonts.getFont(CODE_FONT, 10))); } } PdfPCell contentCell = new CellBorderPadding(paraList); float leading = (float) contentCell.getLeading() + (float) 1.1; contentCell.setLeading(leading, leading); table.addCell(contentCell); table.addCell(spacingCell); Document.instance().add(table); } // Print inherited interfaces / class methods and fields recursively ClassDoc supersupercls = null; if (supercls.isClass()) supersupercls = supercls.superclass(); if (supersupercls != null) { String className = supersupercls.qualifiedName(); if (ifClassMustBePrinted(className)) Inherited.print(supersupercls, show); } ClassDoc[] interfaces = supercls.interfaces(); for (int i = 0; i < interfaces.length; i++) { supersupercls = interfaces[i]; String className = supersupercls.qualifiedName(); if (ifClassMustBePrinted(className)) Inherited.print(supersupercls, show); } }
From source file:org.areasy.common.doclet.document.Summary.java
License:Open Source License
/** * Creates the inner table for both columns. The left column * already contains the declaration text part. * * @param text The text (like "static final"..) *//*from w w w.j ava 2 s. com*/ private static PdfPTable addDeclaration(String text, Phrase returnType) throws DocumentException { PdfPTable innerTable = new PdfPTable(2); innerTable.setWidthPercentage(100f); innerTable.getDefaultCell().setBorder(Rectangle.NO_BORDER); innerTable.setWidths(new int[] { 24, 76 }); Paragraph declarationParagraph = new Paragraph((float) 9.0); Chunk leftPart = new Chunk(text, Fonts.getFont(CODE_FONT, 9)); declarationParagraph.add(leftPart); if (returnType != null) { declarationParagraph.add(returnType); declarationParagraph.add(new Chunk(" ", Fonts.getFont(CODE_FONT, 9))); } PdfPCell cell = new CustomPdfPCell(Rectangle.RIGHT, declarationParagraph, 1, Color.gray); cell.setPaddingTop((float) 4.0); cell.setVerticalAlignment(PdfPCell.ALIGN_TOP); innerTable.addCell(cell); return innerTable; }
From source file:org.areasy.common.doclet.document.tags.TagPRE.java
License:Open Source License
/** * Creates a PRE tag object./* w w w. ja v a 2s. c om*/ * * @param parent The parent HTML object. * @param type The type for this tag. */ public TagPRE(HtmlTag parent, int type) { super(parent, type); setPre(true); cellPara = new Paragraph("", getFont()); colorTitleCell = new PdfPCell(cellPara); colorTitleCell.setBorder(Rectangle.TOP + Rectangle.LEFT + Rectangle.RIGHT + Rectangle.BOTTOM); colorTitleCell.setPadding(6); colorTitleCell.setPaddingBottom(12); colorTitleCell.setPaddingLeft(10); colorTitleCell.setPaddingRight(10); colorTitleCell.setBorderWidth(1); colorTitleCell.setBorderColor(Color.gray); colorTitleCell.setBackgroundColor(COLOR_LIGHTER_GRAY); colorTitleCell.addElement(cellPara); mainTable.addCell(colorTitleCell); }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfBorderGroup.java
License:Open Source License
/** * Adds borders to the PatchRtfBorderGroup * * @param bordersToAdd/*from w w w . java 2 s . co m*/ * The borders to add (Rectangle.LEFT, Rectangle.RIGHT, Rectangle.TOP, Rectangle.BOTTOM, Rectangle.BOX) * @param borderStyle * The style of border to add (from PatchRtfBorder) * @param borderWidth * The border width to use * @param borderColor * The border color to use */ public void addBorder(int bordersToAdd, int borderStyle, float borderWidth, Color borderColor) { if ((bordersToAdd & Rectangle.LEFT) == Rectangle.LEFT) { setBorder(PatchRtfBorder.LEFT_BORDER, borderStyle, borderWidth, borderColor); } if ((bordersToAdd & Rectangle.TOP) == Rectangle.TOP) { setBorder(PatchRtfBorder.TOP_BORDER, borderStyle, borderWidth, borderColor); } if ((bordersToAdd & Rectangle.RIGHT) == Rectangle.RIGHT) { setBorder(PatchRtfBorder.RIGHT_BORDER, borderStyle, borderWidth, borderColor); } if ((bordersToAdd & Rectangle.BOTTOM) == Rectangle.BOTTOM) { setBorder(PatchRtfBorder.BOTTOM_BORDER, borderStyle, borderWidth, borderColor); } if ((bordersToAdd & Rectangle.BOX) == Rectangle.BOX && this.borderType == PatchRtfBorder.ROW_BORDER) { setBorder(PatchRtfBorder.VERTICAL_BORDER, borderStyle, borderWidth, borderColor); setBorder(PatchRtfBorder.HORIZONTAL_BORDER, borderStyle, borderWidth, borderColor); } }
From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.itext.PatchRtfBorderGroup.java
License:Open Source License
/** * Removes borders from the list of borders * * @param bordersToRemove//from www .j a v a 2 s .c o m * The borders to remove (from Rectangle) */ public void removeBorder(int bordersToRemove) { if ((bordersToRemove & Rectangle.LEFT) == Rectangle.LEFT) { this.borders.remove(new Integer(PatchRtfBorder.LEFT_BORDER)); } if ((bordersToRemove & Rectangle.TOP) == Rectangle.TOP) { this.borders.remove(new Integer(PatchRtfBorder.TOP_BORDER)); } if ((bordersToRemove & Rectangle.RIGHT) == Rectangle.RIGHT) { this.borders.remove(new Integer(PatchRtfBorder.RIGHT_BORDER)); } if ((bordersToRemove & Rectangle.BOTTOM) == Rectangle.BOTTOM) { this.borders.remove(new Integer(PatchRtfBorder.BOTTOM_BORDER)); } if ((bordersToRemove & Rectangle.BOX) == Rectangle.BOX && this.borderType == PatchRtfBorder.ROW_BORDER) { this.borders.remove(new Integer(PatchRtfBorder.VERTICAL_BORDER)); this.borders.remove(new Integer(PatchRtfBorder.HORIZONTAL_BORDER)); } }
From source file:org.revager.export.PDFExporter.java
License:Open Source License
/** * Creates an empty PdfPTable cell with a defined height and colspan. * /*from w w w . j a v a2 s . co m*/ * @param height * the height of the created cell * @param colspan * the colspan * * @return Empty cell with defined minimum height */ protected PdfPCell createVerticalStrut(float height, int colspan) { PdfPCell fill = new PdfPCell(); fill.setColspan(colspan); fill.setMinimumHeight(height); fill.disableBorderSide(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | Rectangle.BOTTOM); return fill; }