Java 类com.itextpdf.text.pdf.GrayColor 实例源码

项目:BudgetMaster    文件:ReportGenerator.java   
private PdfPTable generateCategoryBudgets()
{
    PdfPTable table = new PdfPTable(2);
    table.setWidthPercentage(100);
    Font font = FontFactory.getFont(FONT, BaseFont.IDENTITY_H, BaseFont.EMBEDDED, 8, Font.NORMAL, BaseColor.BLACK);

    //header cells
    PdfPCell cellHeaderCategory = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_CATEGORY), font));
    cellHeaderCategory.setBackgroundColor(GrayColor.LIGHT_GRAY);
    cellHeaderCategory.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cellHeaderCategory);
    PdfPCell cellHeaderAmount = new PdfPCell(new Phrase(Localization.getString(Strings.TITLE_AMOUNT), font));
    cellHeaderAmount.setBackgroundColor(GrayColor.LIGHT_GRAY);
    cellHeaderAmount.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(cellHeaderAmount);        

    for(CategoryBudget budget : categoryBudgets)
    {               
        PdfPCell cellName = new PdfPCell(new Phrase(budget.getCategory().getName(), font));
        cellName.setBackgroundColor(new BaseColor(Color.WHITE));
        cellName.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellName.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(cellName);

        PdfPCell cellAmount = new PdfPCell(new Phrase(Helpers.getCurrencyString(budget.getBudget() / 100.0, currency), font));
        cellAmount.setBackgroundColor(new BaseColor(Color.WHITE));
        cellAmount.setHorizontalAlignment(Element.ALIGN_CENTER);
        cellAmount.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(cellAmount);
    }

    return table;
}
项目:testarea-itext5    文件:CertifiedSchoolListExtractionStrategy.java   
@Override
public void renderText(TextRenderInfo renderInfo)
{
    try
    {
        Vector startPoint = renderInfo.getBaseline().getStartPoint();
        BaseColor fillColor = renderInfo.getFillColor();
        if (fillColor instanceof GrayColor && ((GrayColor)fillColor).getGray() == 0)
        {
            if (debug)
                data.append(String.format("%4d\t%3.3f %3.3f\t%s\n", chunk, startPoint.get(I1), startPoint.get(I2), renderInfo.getText()));
            for (TextRenderInfo info : renderInfo.getCharacterRenderInfos())
            {
                renderCharacter(info);
            }
        }
        else
        {
            if (debug)
                nonData.append(String.format("%4d\t%3.3f %3.3f\t%s\n", chunk, startPoint.get(I1), startPoint.get(I2), renderInfo.getText()));
            if (currentField > -1)
                finishEntry();
            entryBuilder.append(renderInfo.getText());
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
    finally
    {
        chunk++;
    }
}