Search in sources :

Example 1 with Table

use of com.lowagie.text.Table in project OpenClinica by OpenClinica.

the class DownloadDiscrepancyNote method createTableFromBean.

private Table createTableFromBean(DiscrepancyNoteBean discBean) throws BadElementException {
    Table table = new Table(2);
    table.setTableFitsPage(true);
    table.setCellsFitPage(true);
    table.setBorderWidth(1);
    table.setBorderColor(new java.awt.Color(0, 0, 0));
    table.setPadding(4);
    table.setSpacing(4);
    Cell cell = new Cell("Discrepancy note id: " + discBean.getId());
    cell.setHeader(true);
    cell.setColspan(2);
    table.addCell(cell);
    table.endHeaders();
    cell = new Cell("Subject name: " + discBean.getSubjectName());
    table.addCell(cell);
    cell = new Cell("CRF name: " + discBean.getCrfName());
    table.addCell(cell);
    cell = new Cell("Description: " + discBean.getDescription());
    table.addCell(cell);
    if (discBean.getDisType() != null) {
        cell = new Cell("Discrepancy note type: " + discBean.getDisType().getName());
        table.addCell(cell);
    }
    cell = new Cell("Event name: " + discBean.getEventName());
    table.addCell(cell);
    cell = new Cell("Parent note ID: " + (discBean.getParentDnId() > 0 ? discBean.getParentDnId() : ""));
    table.addCell(cell);
    cell = new Cell("Resolution status: " + new DiscrepancyNoteUtil().getResolutionStatusName(discBean.getResolutionStatusId()));
    table.addCell(cell);
    cell = new Cell("Detailed notes: " + discBean.getDetailedNotes());
    table.addCell(cell);
    cell = new Cell("Entity name: " + discBean.getEntityName());
    table.addCell(cell);
    cell = new Cell("Entity value: " + discBean.getEntityValue());
    table.addCell(cell);
    cell = new Cell("Date updated: " + discBean.getUpdatedDateString());
    table.addCell(cell);
    cell = new Cell("Study ID: " + discBean.getStudyId());
    table.addCell(cell);
    return table;
}
Also used : Color(java.awt.Color) Table(com.lowagie.text.Table) DiscrepancyNoteUtil(org.akaza.openclinica.service.DiscrepancyNoteUtil) Cell(com.lowagie.text.Cell)

Example 2 with Table

use of com.lowagie.text.Table in project OpenClinica by OpenClinica.

the class DownloadDiscrepancyNote method createTableThreadHeader.

private Table createTableThreadHeader(DiscrepancyNoteThread discNoteThread) throws BadElementException {
    Table table = new Table(2);
    table.setTableFitsPage(true);
    table.setCellsFitPage(true);
    table.setBorderWidth(1);
    table.setBorderColor(new java.awt.Color(0, 0, 0));
    table.setPadding(4);
    table.setSpacing(4);
    if (discNoteThread == null || discNoteThread.getLinkedNoteList().isEmpty()) {
        return table;
    }
    //Get information for the header; the resolution status, however, has to be the latest
    //resolution status for the DN thread
    DiscrepancyNoteBean dnBean = discNoteThread.getLinkedNoteList().getFirst();
    DiscrepancyNoteUtil discUtil = new DiscrepancyNoteUtil();
    String latestResolutionStatus = discUtil.getResolutionStatusName(discNoteThread.getLinkedNoteList().getFirst().getResolutionStatusId());
    StringBuilder content = new StringBuilder("");
    if (dnBean != null) {
        if (!"".equalsIgnoreCase(dnBean.getEntityName())) {
            content.append("Item field name/value: ");
            content.append(dnBean.getEntityName());
            if (!"".equalsIgnoreCase(dnBean.getEntityValue())) {
                content.append(" = ");
                content.append(dnBean.getEntityValue());
            }
        }
        Paragraph para = new Paragraph(content.toString(), new Font(Font.HELVETICA, 14, Font.BOLD, new Color(0, 0, 0)));
        Cell cell = new Cell(para);
        cell.setHeader(true);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        cell.setColspan(2);
        table.addCell(cell);
        table.endHeaders();
        //Add at least three more rows of data -- dnBean.getSubjectName()
        //row 1
        cell = createCell("Study Subject", dnBean.getSubjectName());
        table.addCell(cell);
        cell = createCell("Study Event", dnBean.getEventName());
        table.addCell(cell);
        //row 2
        cell = createCell("Study Event Date", dnBean.getEventStart() + "");
        table.addCell(cell);
        StringBuilder tmpStrBuilder = new StringBuilder("CRF: ");
        tmpStrBuilder.append(dnBean.getCrfName());
        tmpStrBuilder.append("\n");
        tmpStrBuilder.append("Status: ");
        tmpStrBuilder.append(dnBean.getCrfStatus());
        content.append(dnBean.getCrfName());
        cell = new Cell(new Paragraph(tmpStrBuilder.toString(), new Font(Font.HELVETICA, 14, Font.BOLD, new Color(0, 0, 0))));
        table.addCell(cell);
        //row 3
        cell = createCell("Type", discUtil.getResolutionStatusTypeName(dnBean.getDiscrepancyNoteTypeId()));
        table.addCell(cell);
        cell = createCell("Resolution Status", latestResolutionStatus);
        table.addCell(cell);
        cell = createCell("Number of notes", discNoteThread.getLinkedNoteList().size() + "");
        table.addCell(cell);
        cell = createCell("Discrepancy Note ID", dnBean.getId() + "");
        table.addCell(cell);
        cell = createCell("Days Open", dnBean.getAge() + "");
        table.addCell(cell);
        String daysSinceUpdated = escapeQuotesInCSV(dnBean.getDays() + "");
        cell = createCell("Days Since Updated", daysSinceUpdated.equals("0") ? "" : daysSinceUpdated + "");
        table.addCell(cell);
    }
    return table;
}
Also used : Color(java.awt.Color) Table(com.lowagie.text.Table) DiscrepancyNoteBean(org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean) Color(java.awt.Color) DiscrepancyNoteUtil(org.akaza.openclinica.service.DiscrepancyNoteUtil) Cell(com.lowagie.text.Cell) Font(com.lowagie.text.Font) Paragraph(com.lowagie.text.Paragraph)

Aggregations

Cell (com.lowagie.text.Cell)2 Table (com.lowagie.text.Table)2 Color (java.awt.Color)2 DiscrepancyNoteUtil (org.akaza.openclinica.service.DiscrepancyNoteUtil)2 Font (com.lowagie.text.Font)1 Paragraph (com.lowagie.text.Paragraph)1 DiscrepancyNoteBean (org.akaza.openclinica.bean.managestudy.DiscrepancyNoteBean)1