本文整理汇总了Java中com.lowagie.text.Table.setWidths方法的典型用法代码示例。如果您正苦于以下问题:Java Table.setWidths方法的具体用法?Java Table.setWidths怎么用?Java Table.setWidths使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Table
的用法示例。
在下文中一共展示了Table.setWidths方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderGroup
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders all the records that are part of a group.
*
* @param document the current report
* @param groupingKey the grouping key
* @param list the items in the group
* @throws DocumentException for any errors encountered
*/
private void renderGroup(Document document, GroupingKey groupingKey, List<ChangeHistoryReportResponseItem> list)
throws DocumentException {
Table table = new Table(1);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {100});
String groupLabel = "{0} {1}";
String groupHeader = MessageFormat.format(groupLabel, groupingKey.date, groupingKey.user);
Cell headerCell = new Cell(new Phrase(groupHeader, ReportHelper.TABLE_HEADER_FONT));
headerCell.setBorder(Cell.BOTTOM);
table.addCell(headerCell);
for (ChangeHistoryReportResponseItem row : list) {
table.addCell(new Phrase(row.getDescription(), ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
document.add(new Phrase(" ")); // spacer
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:32,代码来源:ChangeHistoryReportService.java
示例2: renderSummary
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the summary of adjustments.
*
* @param document the current document
* @param userChangeCount the map representing the number of changes per user
* @param userAccounts the map representing the number of accounts per user
* @throws DocumentException for any errors encountered
*/
private void renderSummary(Document document, Map<String, Integer> userChangeCount,
Map<String, Set<String>> userAccounts) throws DocumentException {
Table table = new Table(1);
table.setBorder(Table.TOP | Table.LEFT | Table.BOTTOM);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {100});
String groupLabel = "{0} made {1} changes to {2} accounts during this reporting period.";
for (Map.Entry<String, Integer> user : userChangeCount.entrySet()) {
Set<String> accountsModified = userAccounts.get(user.getKey());
String userSummary = MessageFormat.format(groupLabel, user.getKey(), user.getValue(),
accountsModified.size());
table.addCell(new Phrase(userSummary, ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:29,代码来源:MonthlyAdjustmentReportService.java
示例3: renderGrandTotal
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the grand total.
* @param response the response object
* @param document the document report
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderGrandTotal(PaymentPendingApprovalReportResponse response, Document document)
throws DocumentException {
Table table = new Table(2);
table.setWidths(new float[]{80, 20});
table.setBorder(Table.NO_BORDER);
table.setWidth(40);
table.setPadding(1);
Cell cell = new Cell(new Phrase("Grand Total", ReportHelper.TABLE_HEADER_FONT));
cell.setBorder(Cell.BOTTOM);
cell.setBorderWidth(1f);
table.addCell(cell);
Cell subTotal = new Cell(new Phrase(response.getItems().size() + "", ReportHelper.TABLE_HEADER_FONT));
subTotal.setBorder(Cell.BOTTOM);
subTotal.setBorderWidth(1f);
table.addCell(subTotal);
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:24,代码来源:PaymentPendingApprovalReportService.java
示例4: renderGrouping
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Render grouping.
* @param response The response object
* @param document The document report
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderGrouping(PaymentPendingApprovalReportResponse response, Document document)
throws DocumentException {
Table table = new Table(2);
table.setWidths(new float[]{80, 20});
table.setBorder(Table.NO_BORDER);
table.setWidth(40);
table.setPadding(1);
Cell cell = new Cell(new Phrase("Recievables Technician", ReportHelper.TABLE_HEADER_FONT));
cell.setBorder(Cell.TOP | Cell.BOTTOM);
table.addCell(cell);
Cell subTotal = new Cell(new Phrase(response.getItems().size() + "", ReportHelper.TABLE_HEADER_FONT));
subTotal.setBorder(Cell.TOP | Cell.BOTTOM);
table.addCell(subTotal);
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:22,代码来源:PaymentPendingApprovalReportService.java
示例5: getFooter
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* This message creates the footer element for the exported document.
*
* @param queryInstance
* The query instance to extract needed data from.
* @param user
* The user.
* @param resourcesManager
* The resources manager to retreive resources from.
* @return An object to be used as a header.
* @throws MalformedURLException
* {@link MalformedURLException}.
* @throws BadElementException
* {@link BadElementException}.
*/
private Element getFooter(NoteQueryParameters queryInstance, User user,
ResourceBundleManager resourcesManager) throws MalformedURLException,
BadElementException {
Table table = new Table(2);
table.setWidths(new float[] { 60, 40 });
table.setWidth(100);
table.setPadding(5);
table.setBorder(Table.TOP);
Cell serviceCell = new Cell();
serviceCell.setBorder(Cell.TOP);
serviceCell.add(RtfElementFactory.createChunk(
resourcesManager.getText("export.post.footer.service", user.getLanguageLocale())
+ " ", null));
serviceCell.add(RtfElementFactory.createChunk(resourcesManager.getText(
"export.post.footer.service.provider", user.getLanguageLocale())));
Cell pageNumberCell = new Cell();
pageNumberCell.setHorizontalAlignment(Cell.ALIGN_RIGHT);
pageNumberCell.setBorder(Cell.TOP);
pageNumberCell.add(RtfElementFactory.createChunk(resourcesManager.getText(
"export.post.footer.page", user.getLanguageLocale()) + " "));
pageNumberCell.add(new RtfPageNumber());
pageNumberCell
.add(RtfElementFactory.createChunk(" "
+ resourcesManager.getText("export.post.footer.of",
user.getLanguageLocale()) + " "));
pageNumberCell.add(new RtfTotalPageNumber());
table.addCell(serviceCell);
table.addCell(pageNumberCell);
return table;
}
示例6: renderHeaders
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Effectue le rendu des headers.
*
* @param table
* MBasicTable
* @param datatable
* Table
* @throws BadElementException
* e
*/
protected void renderHeaders(final MBasicTable table, final Table datatable)
throws BadElementException {
final int columnCount = table.getColumnCount();
final TableColumnModel columnModel = table.getColumnModel();
// size of columns
float totalWidth = 0;
for (int i = 0; i < columnCount; i++) {
totalWidth += columnModel.getColumn(i).getWidth();
}
final float[] headerwidths = new float[columnCount];
for (int i = 0; i < columnCount; i++) {
headerwidths[i] = 100f * columnModel.getColumn(i).getWidth() / totalWidth;
}
datatable.setWidths(headerwidths);
datatable.setWidth(100f);
// table header
final Font font = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
datatable.getDefaultCell().setBorderWidth(2);
datatable.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
// datatable.setDefaultCellGrayFill(0.75f);
String text;
Object value;
for (int i = 0; i < columnCount; i++) {
value = columnModel.getColumn(i).getHeaderValue();
text = value != null ? value.toString() : "";
datatable.addCell(new Phrase(text, font));
}
// end of the table header
datatable.endHeaders();
}
示例7: renderSummaryTable
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the summary table.
* @param grandTotal the report total
* @param response the report model
* @param document the current document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderSummaryTable(ManualPaymentReportResponse response, Document document, BigDecimal grandTotal)
throws DocumentException {
// render grand total
// table styling
Table table = new Table(7);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {17, 10, 10, 10, 12, 17, 24});
// label for the total
Cell summaryCell = new Cell(new Phrase("Grand Total:", ReportHelper.TABLE_HEADER_FONT));
summaryCell.setColspan(3);
summaryCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
table.addCell(summaryCell);
// group total value
Cell subTotalCell = ReportHelper.moneyCell(ReportHelper.formatMoney(grandTotal),
ReportHelper.TABLE_HEADER_FONT);
table.addCell(subTotalCell);
// complete the table with empty cells
Cell spacerCell = new Cell(new Phrase("in " + response.getItems().size() + " Payment(s)",
ReportHelper.TABLE_HEADER_FONT));
spacerCell.setColspan(3);
table.addCell(spacerCell);
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:41,代码来源:ManualPaymentReportService.java
示例8: renderGroup
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders all the records that are part of a group.
*
* @param document the current report
* @param groupingKey the grouping key
* @param items the items in the group
* @throws DocumentException for any errors encountered
*/
private void renderGroup(Document document, GroupingKey groupingKey,
List<MonthlyAdjustmentReportResponseItem> items) throws DocumentException {
Table table = new Table(2);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {10, 90});
String groupLabel = "{0} {1} changed account #{2}";
String groupHeader = MessageFormat.format(groupLabel, groupingKey.date, groupingKey.user,
groupingKey.claimNumber);
Cell headerCell = new Cell(new Phrase(groupHeader, ReportHelper.TABLE_HEADER_FONT));
headerCell.setColspan(2);
headerCell.setBorder(Cell.BOTTOM);
table.addCell(headerCell);
for (MonthlyAdjustmentReportResponseItem row : items) {
table.addCell(new Phrase(ReportHelper.formatDate(row.getDate(), "hh:mm a"), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getDescription(), ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
document.add(new Phrase(" ")); // spacer
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:37,代码来源:MonthlyAdjustmentReportService.java
示例9: addItemsTable
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Adds the table for items to the report.
*
* @param document
* the report document.
* @param items
* the list of items.
* @param itemType
* the item type.
* @param alignments
* the alignments.
* @param cellWidths
* the table cell widths.
* @param total
* the total.
* @throws com.lowagie.text.DocumentException
* if any error occurs.
*/
private static void addItemsTable(com.lowagie.text.Document document,
List<BalancedScorecardAccountReportResponseItem> items,
String itemType, int[] alignments, int[] cellWidths, Integer total)
throws com.lowagie.text.DocumentException {
if (items != null) {
Table table = new Table(4);
table.setWidths(cellWidths);
ReportServiceHelper.addReportTableRow(table, new String[]{
itemType, "Type", "Account Status Description", "Number"
}, ReportServiceHelper.RTF_REPORT_HEADER_FONT,
null,
alignments, ReportServiceHelper.RTF_BORDER_BOTTOM);
for (int i = 0; i < items.size(); i++) {
BalancedScorecardAccountReportResponseItem item = items.get(i);
ReportServiceHelper.addReportTableRow(table, new Object[]{
"", item.getAccountType(), item.getAccountStatus(), item.getNumber()
}, ReportServiceHelper.RTF_REPORT_CONTENT_FONT, null, alignments,
i == items.size() - 1 ?
ReportServiceHelper.RTF_BORDER_BOTTOM : ReportServiceHelper.RTF_NO_BORDER);
}
table.addCell(ReportServiceHelper.createEmptyCell(2, ReportServiceHelper.RTF_BORDER_BOTTOM));
table.addCell(ReportServiceHelper.createTableCell("Total Number of " + itemType,
ReportServiceHelper.RTF_REPORT_CONTENT_FONT, null, ReportServiceHelper.RTF_ALIGN_CENTER,
ReportServiceHelper.RTF_BORDER_BOTTOM, 1));
table.addCell(ReportServiceHelper.createTableCell(total,
ReportServiceHelper.RTF_REPORT_CONTENT_FONT, null, ReportServiceHelper.RTF_ALIGN_RIGHT,
ReportServiceHelper.RTF_BORDER_BOTTOM, 1));
document.add(table);
}
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:49,代码来源:BalancedScorecardAccountReportService.java
示例10: addItems
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Adds the items to the report.
*
* @param document
* the report document.
* @param items
* the items.
* @param width
* the table width.
* @param widths
* the table cell widths.
* @param alignments
* the alignments.
* @param columnsCount
* the columns count.
* @param totalLabel
* the total label text.
* @return the array containing the item number and total number.
* @throws com.lowagie.text.DocumentException
* if any error occurs.
*/
private static Object[] addItems(com.lowagie.text.Document document,
List<BalancedLockboxReportResponseItem> items, int width, int[] widths,
int[] alignments, int columnsCount, String totalLabel)
throws com.lowagie.text.DocumentException {
if (items != null) {
Table table = new Table(columnsCount);
table.setWidth(width);
table.setWidths(widths);
table.setAlignment(ReportServiceHelper.RTF_ALIGN_LEFT);
String[] titles = columnsCount == 2 ? new String[]{ "Import Status", "# Items" } :
new String[]{ "Import Status", "# Items", "Imported Total" };
ReportServiceHelper.addReportTableRow(table, titles, ReportServiceHelper.RTF_REPORT_UNDERLINE_FONT,
null, alignments, ReportServiceHelper.RTF_NO_BORDER);
int totalItemNumber = 0;
BigDecimal totalTotalNumber = new BigDecimal(0);
for (int i = 0; i < items.size(); i++) {
BalancedLockboxReportResponseItem item = items.get(i);
Object[] contents = columnsCount == 2 ? new Object[]{ item.getImportStatus(), item.getItemNumber() } :
new Object[]{ item.getImportStatus(), item.getItemNumber(), item.getTotalNumber() };
ReportServiceHelper.addReportTableRow(table, contents, ReportServiceHelper.RTF_REPORT_CONTENT_FONT,
null, alignments, i == items.size() - 1 ? ReportServiceHelper.RTF_BORDER_BOTTOM :
ReportServiceHelper.RTF_NO_BORDER);
totalItemNumber += item.getItemNumber();
if (item.getTotalNumber() != null) {
totalTotalNumber = totalTotalNumber.add(item.getTotalNumber());
}
}
Object[] totalColumns = columnsCount == 2 ? new Object[]{ totalLabel, totalItemNumber } :
new Object[]{ totalLabel, totalItemNumber, totalTotalNumber };
ReportServiceHelper.addReportTableRow(table, totalColumns, ReportServiceHelper.RTF_REPORT_HEADER_FONT,
null, alignments, ReportServiceHelper.RTF_BORDER_BOTTOM);
document.add(table);
return new Object[]{ totalItemNumber, totalTotalNumber };
}
return null;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:59,代码来源:BalancedLockboxReportService.java
示例11: renderResults
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the records into the table.
*
* @param response the report model
* @param document the current document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderResults(PaymentByTypeRangeReportResponse response, Document document) throws DocumentException {
// table styling
Table table = new Table(4);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {25, 25, 25, 25});
table.addCell(new Phrase("Retirement Type", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("CSD", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(ReportHelper.moneyCell("Amount", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Date", ReportHelper.TABLE_HEADER_UNDERLINE));
// process rows
List<PaymentByTypeRangeReportResponseItem> items = response.getItems();
for (PaymentByTypeRangeReportResponseItem row : items) {
table.addCell(new Phrase(row.getRetirementType(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getCsd(), ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(row.getPaymentAmount()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatDate(row.getDate(), "EEEE, MMMM dd, yyyy"),
ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:37,代码来源:PaymentByTypeRangeReportService.java
示例12: renderAccountHolder
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders account holder.
* @param response the response object.
* @param document the document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderAccountHolder(PaymentHistoryReportResponse response, Document document)
throws DocumentException {
Table table = new Table(2);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(80);
table.setPadding(0);
// table header and column widths
table.setWidths(new float[] {80, 20});
table.addCell(new Phrase(response.getUsername(), ReportHelper.TABLE_HEADER_FONT));
table.addCell(new Phrase("CSD#" + response.getCsd(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(response.getAddress1(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("", ReportHelper.TABLE_DATA_FONT));
if (response.getAddress2() != null) {
table.addCell(new Phrase(response.getAddress2(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("", ReportHelper.TABLE_DATA_FONT));
}
table.addCell(new Phrase(formatStateLine(response), ReportHelper.TABLE_DATA_FONT));
document.add(table);
document.add(new Paragraph(" "));
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:33,代码来源:PaymentHistoryReportService.java
示例13: renderSummmary
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the summary details.
* @param response the response object
* @param document the report document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderSummmary(TotalPaymentSummaryReportResponse response, Document document)
throws DocumentException {
// table styling
Table table = new Table(2);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(80);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {80, 20});
table.addCell(new Phrase("Total Pre 10/82 Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getTotalDepositsPre1082()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("Total Post 9/82 Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getTotalDepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("CSRS Post 9/82 Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getCsrsDepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("FERS Post 9/82 Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getFersDepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("FERS Post 9/82 Postal Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getFersPostalDepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("FERS Post 9/82 Non-Postal Deposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getFersNonPostalDepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("Total Pre 10/82 Redeposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getTotalRedepositsPre1082()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("Total Post 9/82 Redeposit Payments:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getTotalRedepositsPost982()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("Total Payments on File:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(response.getTotalPaymentsOnFile()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("Number of Accounts on File:", ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatInteger(response.getAccountNumberOnFile()),
ReportHelper.TABLE_DATA_FONT));
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:63,代码来源:TotalPaymentSummaryReportService.java
示例14: renderItems
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders the items.
* @param response the response object
* @param document the report document
* @param txCode the transaction code
* @return the sub total
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private BigDecimal renderItems(ResolvedSuspenseHistoryReportResponse response, Document document,
PaymentTransactionCodes txCode) throws DocumentException {
// group title
Paragraph paragraph = new Paragraph(getHistogramLabel(txCode), ReportHelper.TABLE_HEADER_FONT);
// table styling
Table table = new Table(9);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {3, 3, 3, 10, 10, 12, 8, 8, 34});
table.addCell(new Phrase("Bat", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Blk", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Seq", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("CSD", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("BirthDate", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Amount", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Deposit Date", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Technician", ReportHelper.TABLE_HEADER_UNDERLINE));
table.addCell(new Phrase("Note", ReportHelper.TABLE_HEADER_UNDERLINE));
// process rows
List<ResolvedSuspenseHistoryReportResponseItem> items = response.getDataItems();
BigDecimal subTotal = new BigDecimal(0);
int rows = 0;
for (ResolvedSuspenseHistoryReportResponseItem row : items) {
if (!String.valueOf(txCode.getCode()).equalsIgnoreCase(row.getStatusCode())) {
continue;
}
rows++;
subTotal = subTotal.add(row.getAmount());
table.addCell(new Phrase(row.getBatchNumber(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getBlkNumber(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getSequenceNumber(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getCsd(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatDate(row.getBirthday()), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatMoney(row.getAmount()), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatDate(row.getDepositDate()), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getTechnician(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(row.getNote(), ReportHelper.TABLE_DATA_FONT));
}
// label for the total
Cell summaryCell = new Cell(new Phrase(rows + " Payments Totalling" , ReportHelper.TABLE_HEADER_FONT));
summaryCell.setColspan(5);
summaryCell.setBorder(Cell.TOP);
summaryCell.setHorizontalAlignment(Element.ALIGN_CENTER);
table.addCell(summaryCell);
// group total value
Cell subTotalCell = new Cell(new Phrase(ReportHelper.formatMoney(subTotal), ReportHelper.TABLE_HEADER_FONT));
subTotalCell.setBorder(Cell.TOP);
table.addCell(subTotalCell);
// group total value
Cell titleCell = new Cell(new Phrase(getHistogramLabel(txCode), ReportHelper.TABLE_HEADER_FONT));
titleCell.setColspan(3);
titleCell.setBorder(Cell.TOP);
table.addCell(titleCell);
if (rows > 0) {
document.add(paragraph);
document.add(table);
document.add(new Paragraph(" "));
document.add(new Paragraph(" "));
}
return subTotal;
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:82,代码来源:ResolvedSuspenseHistoryReportService.java
示例15: renderDetails
import com.lowagie.text.Table; //导入方法依赖的package包/类
/**
* Renders a table of account details.
*
* @param item the report model
* @param document the current document
* @throws DocumentException may be thrown by the iText library while rendering the elements
*/
private void renderDetails(GeneralLedgerReportResponseItem item, Document document)
throws DocumentException {
// table styling
Table table = new Table(10);
table.setBorder(Table.NO_BORDER);
Cell cell = new Cell();
cell.setBorder(Cell.NO_BORDER);
table.setDefaultCell(cell);
table.setWidth(100);
table.setPadding(1);
// table header and column widths
table.setWidths(new float[] {10, 10, 5, 15, 10, 10, 10, 10, 10, 10});
table.addCell(ReportHelper.linedCell("\nPlan", ReportHelper.TABLE_HEADER_FONT));
table.addCell(ReportHelper.linedCell("\nAgency", ReportHelper.TABLE_HEADER_FONT));
table.addCell(ReportHelper.linedCell("\nType", ReportHelper.TABLE_HEADER_FONT));
table.addCell(ReportHelper.linedCell("Accounting \nCode", ReportHelper.TABLE_HEADER_FONT));
Cell glInfo = ReportHelper.linedCell("\nGL Date, Filler & Code", ReportHelper.TABLE_HEADER_FONT);
glInfo.setColspan(3);
table.addCell(glInfo);
table.addCell(ReportHelper.linedCell("Source \nCode", ReportHelper.TABLE_HEADER_FONT));
table.addCell(ReportHelper.centeredLinedCell("# \nPayments", ReportHelper.TABLE_HEADER_FONT));
table.addCell(ReportHelper.centeredLinedMoneyCell("Receipt \nAmount", ReportHelper.TABLE_HEADER_FONT));
// table data
table.addCell(new Phrase(item.getPlan(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getAgency(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getType(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getAccountingCode(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(ReportHelper.formatDate(item.getGlDate()), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getGlFiller(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getGlCode(), ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase(item.getSourceCode(), ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatInteger(item.getPaymentsNumber()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(item.getReceiptAmount()),
ReportHelper.TABLE_DATA_FONT));
// spacer
Cell spacerCell = new Cell("");
spacerCell.setColspan(10);
table.addCell(spacerCell);
// payment details
List<GeneralLedgerReportResponsePaymentDetails> payments = item.getPayments();
for (GeneralLedgerReportResponsePaymentDetails payment : payments) {
table.addCell(new Phrase("", ReportHelper.TABLE_DATA_FONT));
table.addCell(new Phrase("ID: " + payment.getId(), ReportHelper.TABLE_DATA_FONT));
Cell claimCell = new Cell(new Phrase("CSD: " + payment.getCsd() + " DOB: "
+ payment.getClaimantDateOfBirth(), ReportHelper.TABLE_DATA_FONT));
claimCell.setColspan(2);
claimCell.setHorizontalAlignment(Element.ALIGN_LEFT);
table.addCell(claimCell);
Cell nameCell = new Cell(new Phrase("Name: " + payment.getClaimantName(), ReportHelper.TABLE_DATA_FONT));
nameCell.setColspan(4);
nameCell.setHorizontalAlignment(Element.ALIGN_LEFT);
table.addCell(nameCell);
table.addCell(ReportHelper.moneyCell(ReportHelper.formatDate(payment.getPaymentDate()),
ReportHelper.TABLE_DATA_FONT));
table.addCell(ReportHelper.moneyCell(ReportHelper.formatMoney(payment.getPaymentAmount()),
ReportHelper.TABLE_DATA_FONT));
}
document.add(table);
}
开发者ID:NASA-Tournament-Lab,项目名称:CoECI-OPM-Service-Credit-Redeposit-Deposit-Application,代码行数:77,代码来源:GeneralLedgerReportService.java