Example usage for com.lowagie.text Rectangle LEFT

List of usage examples for com.lowagie.text Rectangle LEFT

Introduction

In this page you can find the example usage for com.lowagie.text Rectangle LEFT.

Prototype

int LEFT

To view the source code for com.lowagie.text Rectangle LEFT.

Click Source Link

Document

This represents one side of the border of the Rectangle.

Usage

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 ww w  . j a v  a 2  s  . c  om*/
 */
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./*from   ww w .  j a  v a  2s  .  co m*/
 */
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)./*from   ww  w  .j a  va  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
 *//*from  w  ww.j a v  a 2 s  . 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/* w ww .  j a  v  a  2 s  . c o 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.tags.TagPRE.java

License:Open Source License

/**
 * Creates a PRE tag object./*from  w  w w .ja  va  2 s. co m*/
 *
 * @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 .  ja  va2  s . c  om
 *          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  w  w  w.  ja v  a 2 s.  c  om
 *          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 ww  w . j av a2 s . com
 * @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;
}

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

private void setCellStyle(Font fnt, Map<String, Object> style, RtfCell cell) {
    if (style != null) {
        updateFont(fnt, style);//from   w  w w.j a  v a2  s. c om
        if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
            Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
            cell.setBackgroundColor(val);
        }
        if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
            if (StyleFormatConstants.HORIZONTAL_ALIGN_LEFT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_CENTER
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            }
        }

        if (style.containsKey(StyleFormatConstants.VERTICAL_ALIGN_KEY)) {
            if (StyleFormatConstants.VERTICAL_ALIGN_TOP
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_TOP);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_MIDDLE
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_BOTTOM
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
            }
        }
        // if (style.containsKey(StyleFormatConstants.PADDING_LEFT)) {
        // Float val = (Float) style.get(StyleFormatConstants.PADDING_LEFT);
        // cell.setPaddingLeft(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_RIGHT)) {
        // Float val = (Float)
        // style.get(StyleFormatConstants.PADDING_RIGHT);
        // cell.setPaddingRight(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_TOP)) {
        // Float val = (Float) style.get(StyleFormatConstants.PADDING_TOP);
        // cell.setPaddingTop(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_BOTTOM)) {
        // Float val = (Float)
        // style.get(StyleFormatConstants.PADDING_BOTTOM);
        // cell.setPaddingBottom(val);
        // }
        cell.setBorderWidth(0);

        Float val = Float.valueOf(1);
        RtfBorderGroup bg = new RtfBorderGroup();
        if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_LEFT);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR);
            bg.addBorder(Rectangle.LEFT, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR);
            bg.addBorder(Rectangle.RIGHT, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_TOP)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_TOP);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR);
            bg.addBorder(Rectangle.TOP, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR);
            bg.addBorder(Rectangle.BOTTOM, RtfBorder.BORDER_SINGLE, val, color);
        }
        cell.setBorders(bg);

        // cell.setNoWrap(true);
        // if (bandElement != null) {
        // if (bandElement.isWrapText()) {
        // cell.setNoWrap(false);
        // }
        // }
    }
}