Search in sources :

Example 16 with Phrase

use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.

the class ICAERTableManager method getPhraseCellCenter.

@Override
public PdfPCell getPhraseCellCenter(String content) {
    PdfPCell c = new PdfPCell(new Phrase(ReportUtil.convertEncode(content), fontManager.getDefaultFont()));
    c.setLeading(12f, 0);
    c.setPadding(5);
    c.setHorizontalAlignment(Element.ALIGN_CENTER);
    c.setVerticalAlignment(Element.ALIGN_MIDDLE);
    return c;
}
Also used : PdfPCell(com.itextpdf.text.pdf.PdfPCell) Phrase(com.itextpdf.text.Phrase)

Example 17 with Phrase

use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.

the class DOC001PDF method buildTableQuadroGeral.

private PdfPTable buildTableQuadroGeral(Long curriculoId) throws DocumentException {
    DisciplinaDTO[] disciplinas = teachingDocumentsService.findAllDisciplinasByCurriculoMinimo(curriculoId);
    PdfPTable table = new PdfPTable(6);
    table.setWidths(new int[] { 1, 2, 3, 1, 1, 1 });
    table.setWidthPercentage(100);
    // for (DisciplinaDTO disciplina : disciplinas) {
    // System.out.print(disciplina.getDescricao());
    // System.out.print("-");
    // System.out.print(disciplina.getCampo().getDescricao());
    // System.out.print("-");
    // System.out.println(disciplina.getAreaEnsino().getNome());
    // }
    @SuppressWarnings("rawtypes") Map mapaGeral = new HashMap();
    for (DisciplinaDTO disciplina : disciplinas) {
        Map mapaCampo = (Map) mapaGeral.get(disciplina.getCampo().getId());
        if (mapaCampo != null) {
            Map mapAreas = (Map) mapaCampo.get("areas");
            if (mapAreas != null) {
                Map mapArea = (Map) mapAreas.get(disciplina.getAreaEnsino().getId());
                if (mapArea != null) {
                    ArrayList disciplinasList = (ArrayList) mapArea.get("disciplinas");
                    if (disciplinasList != null) {
                        disciplinasList.add(disciplina);
                    } else {
                        ArrayList newDisciplinasList = new ArrayList();
                        newDisciplinasList.add(disciplina);
                        mapArea.put("disciplinas", newDisciplinasList);
                    }
                } else {
                    Map newMapArea = new HashMap();
                    newMapArea.put("nome", disciplina.getAreaEnsino().getNome());
                    newMapArea.put("id", disciplina.getAreaEnsino().getId());
                    ArrayList newDisciplinasList = new ArrayList();
                    newDisciplinasList.add(disciplina);
                    newMapArea.put("disciplinas", newDisciplinasList);
                    mapAreas.put(disciplina.getAreaEnsino().getId(), newMapArea);
                }
            } else {
                Map newMapAreas = new HashMap();
                Map newMapArea = new HashMap();
                newMapArea.put("nome", disciplina.getAreaEnsino().getNome());
                newMapArea.put("id", disciplina.getAreaEnsino().getId());
                ArrayList newDisciplinasList = new ArrayList();
                newDisciplinasList.add(disciplina);
                newMapArea.put("disciplinas", newDisciplinasList);
                newMapAreas.put(disciplina.getAreaEnsino().getId(), newMapArea);
                mapaCampo.put("areas", newMapAreas);
            }
        } else {
            Map newMapaCampo = new HashMap();
            newMapaCampo.put("nome", disciplina.getCampo().getDescricao());
            newMapaCampo.put("id", disciplina.getCampo().getId());
            Map newMapAreas = new HashMap();
            Map newMapArea = new HashMap();
            newMapArea.put("nome", disciplina.getAreaEnsino().getNome());
            newMapArea.put("id", disciplina.getAreaEnsino().getId());
            ArrayList newDisciplinasList = new ArrayList();
            newDisciplinasList.add(disciplina);
            newMapArea.put("disciplinas", newDisciplinasList);
            newMapAreas.put(disciplina.getAreaEnsino().getId(), newMapArea);
            newMapaCampo.put("areas", newMapAreas);
            mapaGeral.put(disciplina.getCampo().getId(), newMapaCampo);
        }
    }
    PdfPCell campoHeadCell = new PdfPCell(new Phrase("CAMPO", fontManager.getMiniBoldFont()));
    campoHeadCell.setPadding(10);
    PdfPCell areaHeadCell = new PdfPCell(new Phrase("ÁREA", fontManager.getSmallBoldFont()));
    areaHeadCell.setPadding(10);
    PdfPCell disciplinasHeadCell = new PdfPCell(new Phrase("DISCIPLINAS", fontManager.getSmallBoldFont()));
    disciplinasHeadCell.setPadding(10);
    PdfPCell CHInstrucaoHeadCell = new PdfPCell(new Phrase("CH INSTR.", fontManager.getSmallBoldFont()));
    CHInstrucaoHeadCell.setPadding(10);
    PdfPCell CHAvaliacaoHeadCell = new PdfPCell(new Phrase("CH AV.", fontManager.getSmallBoldFont()));
    CHAvaliacaoHeadCell.setPadding(10);
    PdfPCell CHTotalHeadCell = new PdfPCell(new Phrase("CH", fontManager.getSmallBoldFont()));
    CHTotalHeadCell.setPadding(10);
    table.addCell(campoHeadCell);
    table.addCell(areaHeadCell);
    table.addCell(disciplinasHeadCell);
    table.addCell(CHInstrucaoHeadCell);
    table.addCell(CHAvaliacaoHeadCell);
    table.addCell(CHTotalHeadCell);
    Collection campos = mapaGeral.values();
    for (Object x : campos) {
        Map campo = (Map) x;
        String nomeCampo = (String) campo.get("nome");
        PdfPCell campoCell = new PdfPCell(new Phrase(nomeCampo.toUpperCase(), fontManager.getSmallFont()));
        campoCell.setRotation(90);
        campoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        Long campoId = (Long) campo.get("id");
        int countDisciplinasOnCampo = countDiciplinasOnCampo(mapaGeral, campoId);
        if (countDisciplinasOnCampo > 1) {
            campoCell.setRowspan(countDisciplinasOnCampo);
        }
        campoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        campoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        campoCell.setPadding(10);
        table.addCell(campoCell);
        Map areas = (Map) campo.get("areas");
        Collection listAreas = areas.values();
        for (Object y : listAreas) {
            Map area = (Map) y;
            String nomeArea = (String) area.get("nome");
            PdfPCell areaCell = new PdfPCell(new Phrase(nomeArea.toUpperCase(), fontManager.getSmallFont()));
            Long areaId = (Long) area.get("id");
            int countDisciplinasOnArea = countDiciplinasOnArea(areas, areaId);
            if (countDisciplinasOnArea > 1) {
                areaCell.setRowspan(countDisciplinasOnArea);
            }
            areaCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            areaCell.setHorizontalAlignment(Element.ALIGN_CENTER);
            areaCell.setPadding(10);
            table.addCell(areaCell);
            ArrayList disciplinasList = (ArrayList) area.get("disciplinas");
            for (Object object : disciplinasList) {
                DisciplinaDTO disciplina = (DisciplinaDTO) object;
                PdfPCell disciplinaCell = new PdfPCell(new Phrase(disciplina.getDescricao().toUpperCase(), fontManager.getSmallFont()));
                disciplinaCell.setPadding(10);
                disciplinaCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                PdfPCell CHInstrucaoCell = new PdfPCell(new Phrase(String.valueOf(disciplina.getQuantidadeTemposAula()), fontManager.getSmallFont()));
                CHInstrucaoCell.setPadding(10);
                CHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                CHInstrucaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                PdfPCell CHAvaliacaoCell = new PdfPCell(new Phrase(String.valueOf(disciplina.getQuantidadeTemposAvaliacao()), fontManager.getSmallFont()));
                CHAvaliacaoCell.setPadding(10);
                CHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                CHAvaliacaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                int total = disciplina.getQuantidadeTemposAula() + disciplina.getQuantidadeTemposAvaliacao();
                PdfPCell CHTotalCell = new PdfPCell(new Phrase(String.valueOf(total), fontManager.getSmallFont()));
                CHTotalCell.setPadding(10);
                CHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
                CHTotalCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
                table.addCell(disciplinaCell);
                table.addCell(CHInstrucaoCell);
                table.addCell(CHAvaliacaoCell);
                table.addCell(CHTotalCell);
            }
        }
    }
    for (Object x : campos) {
        Map campo = (Map) x;
        String nomeCampo = (String) campo.get("nome");
        PdfPCell sumCampoCell = new PdfPCell(new Phrase("TOTAL " + nomeCampo, fontManager.getSmallBoldFont()));
        sumCampoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        Long campoId = (Long) campo.get("id");
        sumCampoCell.setColspan(3);
        sumCampoCell.setPadding(10);
        PdfPCell sumCampoCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumCampoCHInstrucaoCell.setPadding(10);
        PdfPCell sumCampoCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumCampoCHAvaliacaoCell.setPadding(10);
        PdfPCell sumCampoCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumCHDiciplinasOnCampo(mapaGeral, campoId)), fontManager.getSmallFont()));
        sumCampoCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumCampoCHTotalCell.setPadding(10);
        table.addCell(sumCampoCell);
        table.addCell(sumCampoCHInstrucaoCell);
        table.addCell(sumCampoCHAvaliacaoCell);
        table.addCell(sumCampoCHTotalCell);
    }
    PdfPCell CFRealCell = new PdfPCell(new Phrase("CARGA HORÁRIA REAL", fontManager.getSmallFont()));
    CFRealCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    CFRealCell.setColspan(3);
    CFRealCell.setPadding(10);
    CFRealCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    PdfPCell CFRealCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    CFRealCHInstrucaoCell.setPadding(10);
    CFRealCHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    PdfPCell CFRealCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    CFRealCHAvaliacaoCell.setPadding(10);
    CFRealCHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    int sumChTotal = 0;
    int sumCHReal = sumCHReal(mapaGeral);
    sumChTotal += sumCHReal;
    PdfPCell CFRealCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumCHReal), fontManager.getSmallFont()));
    CFRealCHTotalCell.setPadding(10);
    CFRealCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    table.addCell(CFRealCell);
    table.addCell(CFRealCHInstrucaoCell);
    table.addCell(CFRealCHAvaliacaoCell);
    table.addCell(CFRealCHTotalCell);
    int sumComplementacao = 0;
    ComplementacaoInstrucaoDTO[] complementacoes = teachingDocumentsService.findAllComplementacoesInstrucaoByPUD(curriculoId);
    for (ComplementacaoInstrucaoDTO complementacao : complementacoes) {
        sumComplementacao += complementacao.getQuantidadeTemposAula();
    }
    sumChTotal += sumComplementacao;
    if (sumComplementacao > 0) {
        PdfPCell sumComplementacaoCell = new PdfPCell(new Phrase("COMPLEMENTAÇÃO DA INSTRUÇÃO", fontManager.getSmallFont()));
        sumComplementacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumComplementacaoCell.setColspan(3);
        sumComplementacaoCell.setPadding(10);
        PdfPCell sumComplementacaoCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumComplementacaoCHInstrucaoCell.setPadding(10);
        sumComplementacaoCHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumComplementacaoCHInstrucaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumComplementacaoCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumComplementacaoCHAvaliacaoCell.setPadding(10);
        sumComplementacaoCHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumComplementacaoCHAvaliacaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumComplementacaoCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumComplementacao), fontManager.getSmallFont()));
        sumComplementacaoCHTotalCell.setPadding(10);
        sumComplementacaoCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumComplementacaoCHTotalCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(sumComplementacaoCell);
        table.addCell(sumComplementacaoCHInstrucaoCell);
        table.addCell(sumComplementacaoCHAvaliacaoCell);
        table.addCell(sumComplementacaoCHTotalCell);
    }
    int sumAtividades = 0;
    AtividadeAdministrativaDTO[] atividades = teachingDocumentsService.findAllAtividadesAdministrativasByPUD(curriculoId);
    for (AtividadeAdministrativaDTO atividade : atividades) {
        sumAtividades += atividade.getQuantidadeTemposAula();
    }
    sumChTotal += sumAtividades;
    if (sumAtividades > 0) {
        PdfPCell sumAtividadeAdministrativaCell = new PdfPCell(new Phrase("ATIVIDADES ADMINISTRATIVAS", fontManager.getSmallFont()));
        sumAtividadeAdministrativaCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumAtividadeAdministrativaCell.setColspan(3);
        sumAtividadeAdministrativaCell.setPadding(10);
        PdfPCell sumAtividadeAdministrativaCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumAtividadeAdministrativaCHInstrucaoCell.setPadding(10);
        sumAtividadeAdministrativaCHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumAtividadeAdministrativaCHInstrucaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumAtividadeAdministrativaCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumAtividadeAdministrativaCHAvaliacaoCell.setPadding(10);
        sumAtividadeAdministrativaCHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumAtividadeAdministrativaCHAvaliacaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumAtividadeAdministrativaCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumAtividades), fontManager.getSmallFont()));
        sumAtividadeAdministrativaCHTotalCell.setPadding(10);
        sumAtividadeAdministrativaCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumAtividadeAdministrativaCHTotalCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(sumAtividadeAdministrativaCell);
        table.addCell(sumAtividadeAdministrativaCHInstrucaoCell);
        table.addCell(sumAtividadeAdministrativaCHAvaliacaoCell);
        table.addCell(sumAtividadeAdministrativaCHTotalCell);
    }
    // PdfPCell sumAtividadeAvaliativaCell = new PdfPCell(new Phrase("ATIVIDADES AVALIATIVAS", fontManager.getSmallFont()));
    // sumAtividadeAvaliativaCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    // 
    // sumAtividadeAvaliativaCell.setColspan(3);
    // sumAtividadeAvaliativaCell.setPadding(10);
    // PdfPCell sumAtividadeAvaliativaCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    // sumAtividadeAvaliativaCHInstrucaoCell.setPadding(10);
    // PdfPCell sumAtividadeAvaliativaCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    // sumAtividadeAvaliativaCHAvaliacaoCell.setPadding(10);
    // PdfPCell sumAtividadeAvaliativaCHTotalCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    // sumAtividadeAvaliativaCHTotalCell.setPadding(10);
    // 
    // table.addCell(sumAtividadeAvaliativaCell);
    // table.addCell(sumAtividadeAvaliativaCHInstrucaoCell);
    // table.addCell(sumAtividadeAvaliativaCHAvaliacaoCell);
    // table.addCell(sumAtividadeAvaliativaCHTotalCell);
    int sumFlexibilidade = 0;
    FlexibilidadeProgramacaoDTO[] flexibilidades = teachingDocumentsService.findAllFlexibilidadesProgramacaoByPUD(curriculoId);
    for (FlexibilidadeProgramacaoDTO flexibilidade : flexibilidades) {
        sumFlexibilidade += flexibilidade.getQuantidadeTemposAula();
    }
    sumChTotal += sumFlexibilidade;
    if (sumFlexibilidade > 0) {
        PdfPCell sumFlexibilidadeCell = new PdfPCell(new Phrase("FLEXIBILIDADE DA PROGRAMAÇÃO", fontManager.getSmallFont()));
        sumFlexibilidadeCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumFlexibilidadeCell.setColspan(3);
        sumFlexibilidadeCell.setPadding(10);
        PdfPCell sumFlexibilidadeCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumFlexibilidadeCHInstrucaoCell.setPadding(10);
        sumFlexibilidadeCHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumFlexibilidadeCHInstrucaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumFlexibilidadeCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
        sumFlexibilidadeCHAvaliacaoCell.setPadding(10);
        sumFlexibilidadeCHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumFlexibilidadeCHAvaliacaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        PdfPCell sumFlexibilidadeCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumFlexibilidade), fontManager.getSmallFont()));
        sumFlexibilidadeCHTotalCell.setPadding(10);
        sumFlexibilidadeCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        sumFlexibilidadeCHTotalCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
        table.addCell(sumFlexibilidadeCell);
        table.addCell(sumFlexibilidadeCHInstrucaoCell);
        table.addCell(sumFlexibilidadeCHAvaliacaoCell);
        table.addCell(sumFlexibilidadeCHTotalCell);
    }
    PdfPCell sumCHTotalCell = new PdfPCell(new Phrase("CARGA HORÁRIA TOTAL", fontManager.getSmallFont()));
    sumCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    sumCHTotalCell.setColspan(3);
    sumCHTotalCell.setPadding(10);
    PdfPCell sumCHTotalCHInstrucaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    sumCHTotalCHInstrucaoCell.setPadding(10);
    sumCHTotalCHInstrucaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    sumCHTotalCHInstrucaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell sumCHTotalCHAvaliacaoCell = new PdfPCell(new Phrase("", fontManager.getSmallFont()));
    sumCHTotalCHAvaliacaoCell.setPadding(10);
    sumCHTotalCHAvaliacaoCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    sumCHTotalCHAvaliacaoCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    PdfPCell sumCHTotalCHTotalCell = new PdfPCell(new Phrase(String.valueOf(sumChTotal), fontManager.getSmallFont()));
    sumCHTotalCHTotalCell.setPadding(10);
    sumCHTotalCHTotalCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    sumCHTotalCHTotalCell.setVerticalAlignment(Element.ALIGN_MIDDLE);
    table.addCell(sumCHTotalCell);
    table.addCell(sumCHTotalCHInstrucaoCell);
    table.addCell(sumCHTotalCHAvaliacaoCell);
    table.addCell(sumCHTotalCHTotalCell);
    return table;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Phrase(com.itextpdf.text.Phrase) AtividadeAdministrativaDTO(com.tomasio.projects.trainning.dto.AtividadeAdministrativaDTO) ComplementacaoInstrucaoDTO(com.tomasio.projects.trainning.dto.ComplementacaoInstrucaoDTO) DisciplinaDTO(com.tomasio.projects.trainning.dto.DisciplinaDTO) ObjetivoDisciplinaDTO(com.tomasio.projects.trainning.dto.ObjetivoDisciplinaDTO) Collection(java.util.Collection) HashMap(java.util.HashMap) Map(java.util.Map) FlexibilidadeProgramacaoDTO(com.tomasio.projects.trainning.dto.FlexibilidadeProgramacaoDTO)

Example 18 with Phrase

use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.

the class DOC001PDF method buildTableDisciplina.

private PdfPTable buildTableDisciplina(DisciplinaDTO disciplina) throws DocumentException {
    PdfPTable table = new PdfPTable(6);
    table.setWidthPercentage(100);
    table.setExtendLastRow(true);
    PdfPCell cellCampo;
    Phrase phraseCampo = new Phrase();
    phraseCampo.add(new Chunk("CAMPO: ", fontManager.getBoldFont()));
    phraseCampo.add(new Chunk(disciplina.getCampo().getDescricao().toUpperCase(), fontManager.getDefaultFont()));
    cellCampo = new PdfPCell(phraseCampo);
    cellCampo.setPadding(10);
    cellCampo.setColspan(3);
    table.addCell(cellCampo);
    PdfPCell cellArea;
    Phrase phraseArea = new Phrase();
    phraseArea.add(new Chunk("ÁREA: ", fontManager.getBoldFont()));
    phraseArea.add(new Chunk(disciplina.getAreaEnsino().getNome().toUpperCase(), fontManager.getDefaultFont()));
    cellArea = new PdfPCell(phraseArea);
    cellArea.setColspan(3);
    cellArea.setPadding(10);
    table.addCell(cellArea);
    PdfPCell cellDescricao;
    Phrase phraseDescricao = new Phrase();
    phraseDescricao.add(new Chunk("DISCIPLINA " + disciplina.getNumeroDisciplina() + ": ", fontManager.getBoldFont()));
    phraseDescricao.add(new Chunk(disciplina.getDescricao().toUpperCase(), fontManager.getDefaultFont()));
    cellDescricao = new PdfPCell(phraseDescricao);
    cellDescricao.setColspan(6);
    cellDescricao.setPadding(10);
    table.addCell(cellDescricao);
    PdfPCell cellCHInstrucao;
    Phrase phraseCHInstrucao = new Phrase();
    phraseCHInstrucao.add(new Chunk("CH INSTR.: ", fontManager.getBoldFont()));
    phraseCHInstrucao.add(new Chunk(disciplina.getQuantidadeTemposAula() + " tempo(s)", fontManager.getDefaultFont()));
    cellCHInstrucao = new PdfPCell(phraseCHInstrucao);
    cellCHInstrucao.setColspan(2);
    cellCHInstrucao.setPadding(10);
    table.addCell(cellCHInstrucao);
    PdfPCell cellCHAvaliacao;
    Phrase phraseCHAvaliacao = new Phrase();
    phraseCHAvaliacao.add(new Chunk("CH AVAL.: ", fontManager.getBoldFont()));
    phraseCHAvaliacao.add(new Chunk(disciplina.getQuantidadeTemposAvaliacao() + " tempo(s)", fontManager.getDefaultFont()));
    cellCHAvaliacao = new PdfPCell(phraseCHAvaliacao);
    cellCHAvaliacao.setColspan(2);
    cellCHAvaliacao.setPadding(10);
    table.addCell(cellCHAvaliacao);
    PdfPCell cellCHTotal;
    Phrase phraseCHTotal = new Phrase();
    int quantidadeTempoTotal = disciplina.getQuantidadeTemposAula() + disciplina.getQuantidadeTemposAvaliacao();
    phraseCHTotal.add(new Chunk("CH TOTAL: ", fontManager.getBoldFont()));
    phraseCHTotal.add(new Chunk(quantidadeTempoTotal + " tempo(s)", fontManager.getDefaultFont()));
    cellCHTotal = new PdfPCell(phraseCHTotal);
    cellCHTotal.setColspan(2);
    cellCHTotal.setPadding(10);
    table.addCell(cellCHTotal);
    PdfPCell cellObjetivos;
    Paragraph objetivosHead = new Paragraph("OBJETIVOS ESPECÍFICOS: ", fontManager.getBoldFont());
    ObjetivoDisciplinaDTO[] objetivosDisciplina = teachingDocumentsService.findAllObjetivosDisciplinas(disciplina.getId());
    // Paragraph objetivos = new Paragraph("asdfasdfasdfasdf", fontManager.getDefaultFont());
    cellObjetivos = new PdfPCell();
    cellObjetivos.addElement(objetivosHead);
    cellObjetivos.addElement(Chunk.NEWLINE);
    List objetivosList = new List(List.ORDERED, List.ALPHABETICAL);
    objetivosList.setLowercase(true);
    for (ObjetivoDisciplinaDTO objetivoDisciplina : objetivosDisciplina) {
        ListItem item = new ListItem(objetivoDisciplina.getDescricao() + " (" + objetivoDisciplina.getNivelAprendizagem().getCodigo() + ")", fontManager.getDefaultFont());
        objetivosList.add(item);
    }
    cellObjetivos.addElement(objetivosList);
    cellObjetivos.setColspan(6);
    cellObjetivos.setPadding(10);
    cellObjetivos.setPaddingBottom(20);
    // cellObjetivos.setMinimumHeight(520);
    table.addCell(cellObjetivos);
    PdfPCell cellEmentas;
    cellEmentas = new PdfPCell();
    Paragraph ementaHead = new Paragraph("EMENTA: ", fontManager.getBoldFont());
    cellEmentas.addElement(ementaHead);
    cellEmentas.addElement(Chunk.NEWLINE);
    UnidadeDidaticaDTO[] unidades = teachingDocumentsService.findAllUnidadesDidaticas(disciplina.getId());
    List unidadesList = new List(List.ORDERED);
    for (UnidadeDidaticaDTO unidade : unidades) {
        ListItem itemUnidade = new ListItem(unidade.getDescricao(), fontManager.getDefaultFont());
        unidadesList.add(itemUnidade);
        SubunidadeDidaticaDTO[] subunidades = teachingDocumentsService.findAllSubunidadesDidaticas(unidade.getId());
        List subuniaddesList = new List(List.UNORDERED);
        subuniaddesList.setIndentationLeft(15);
        for (SubunidadeDidaticaDTO subunidade : subunidades) {
            ListItem itemSubunidade = new ListItem(subunidade.getDescricao(), fontManager.getDefaultFont());
            subuniaddesList.add(itemSubunidade);
        }
        unidadesList.add(subuniaddesList);
    }
    cellEmentas.addElement(unidadesList);
    cellEmentas.setColspan(6);
    cellEmentas.setPadding(10);
    cellEmentas.setPaddingBottom(20);
    table.addCell(cellEmentas);
    return table;
}
Also used : SubunidadeDidaticaDTO(com.tomasio.projects.trainning.dto.SubunidadeDidaticaDTO) Phrase(com.itextpdf.text.Phrase) Chunk(com.itextpdf.text.Chunk) UnidadeDidaticaDTO(com.tomasio.projects.trainning.dto.UnidadeDidaticaDTO) Paragraph(com.itextpdf.text.Paragraph) ArrayList(java.util.ArrayList) List(com.itextpdf.text.List) ListItem(com.itextpdf.text.ListItem) ObjetivoDisciplinaDTO(com.tomasio.projects.trainning.dto.ObjetivoDisciplinaDTO)

Example 19 with Phrase

use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.

the class DOC001PDF method buildCover.

private void buildCover(Document document, CurriculoMinimoDTO curriculoMinimo) throws DocumentException {
    Paragraph spaceParagraph = new Paragraph();
    spaceParagraph.add(new Phrase("\n"));
    document.add(spaceParagraph);
    document.add(spaceParagraph);
    document.add(spaceParagraph);
    document.add(spaceParagraph);
    document.add(spaceParagraph);
    Paragraph p1 = new Paragraph();
    p1.setAlignment(Element.ALIGN_CENTER);
    p1.add(new Phrase("MINISTÉRIO DA DEFESA", fontManager.getH1Font()));
    document.add(p1);
    Paragraph p2 = new Paragraph();
    p2.setAlignment(Element.ALIGN_CENTER);
    p2.add(new Phrase("COMANDO DA AERONÁUTICA", fontManager.getH1Font()));
    document.add(p2);
    Paragraph p3 = new Paragraph();
    p3.setAlignment(Element.ALIGN_CENTER);
    // p3.add(Chunk.NEWLINE);
    // p3.add(new Phrase("DEPARTAMENTO DE CONTROLE DO ESPAÇO AÉREO", fontManager.getDefaultFont()));
    document.add(p3);
    document.add(Chunk.NEWLINE);
    document.add(Chunk.NEWLINE);
    document.add(Chunk.NEWLINE);
    try {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        String path = classLoader.getResource("aer.png").getPath();
        Image image = Image.getInstance(path);
        image.setAlignment(Element.ALIGN_CENTER);
        image.scalePercent(18.5f);
        document.add(image);
    } catch (BadElementException | IOException ex) {
        Logger.getLogger(DOC001PDF.class.getName()).log(Level.SEVERE, null, ex);
    }
    document.add(Chunk.NEWLINE);
    document.add(Chunk.NEWLINE);
    Paragraph p4 = new Paragraph();
    p4.setAlignment(Element.ALIGN_CENTER);
    p4.add(new Phrase("ENSINO", fontManager.getH0Font()));
    document.add(p4);
    document.add(Chunk.NEWLINE);
    document.add(Chunk.NEWLINE);
    PdfPTable t = new PdfPTable(1);
    t.setTotalWidth(286);
    t.setLockedWidth(true);
    PdfPCell unica = new PdfPCell();
    unica.setFixedHeight(140);
    unica.setPaddingTop(5);
    unica.setVerticalAlignment(Element.ALIGN_MIDDLE);
    Paragraph p5 = new Paragraph();
    p5.setAlignment(Element.ALIGN_CENTER);
    p5.add(new Phrase(curriculoMinimo.getNumeroPublicacaoCM(), fontManager.getSmallXBoldFont()));
    Paragraph p6 = new Paragraph();
    p6.setAlignment(Element.ALIGN_CENTER);
    p6.add(new Phrase("CURRÍCULO MÍNIMO DO CURSO " + curriculoMinimo.getCurso().getDescricao(), fontManager.getSmallXBoldFont()));
    Paragraph p7 = new Paragraph();
    p7.setAlignment(Element.ALIGN_CENTER);
    p7.add(new Phrase(curriculoMinimo.getCurso().getCodigo(), fontManager.getSmallXBoldFont()));
    Paragraph p8 = new Paragraph();
    p8.setAlignment(Element.ALIGN_CENTER);
    p8.add(new Phrase(curriculoMinimo.getAnoPublicacaoCM(), fontManager.getSmallXBoldFont()));
    unica.addElement(p5);
    unica.addElement(Chunk.NEWLINE);
    unica.addElement(p6);
    unica.addElement(p7);
    unica.addElement(Chunk.NEWLINE);
    unica.addElement(p8);
    t.addCell(unica);
    document.add(t);
    // document.add(Chunk.NEXTPAGE);
    // 
    // document.add(buildPrefacio(curriculoMinimo));
    document.add(Chunk.NEXTPAGE);
    document.add(Chunk.NEXTPAGE);
}
Also used : BadElementException(com.itextpdf.text.BadElementException) Phrase(com.itextpdf.text.Phrase) IOException(java.io.IOException) Image(com.itextpdf.text.Image) Paragraph(com.itextpdf.text.Paragraph)

Example 20 with Phrase

use of com.itextpdf.text.Phrase in project trainning by fernandotomasio.

the class DOC002PDF method buildTableRecomendacoesMetodologicas.

private PdfPTable buildTableRecomendacoesMetodologicas(DisciplinaDTO disciplina) {
    PdfPTable table = new PdfPTable(1);
    table.setWidthPercentage(100);
    PdfPCell cellHeader;
    cellHeader = new PdfPCell(new Phrase("RECOMENDACÕES METODOLÓGICAS", fontManager.getBoldFont()));
    cellHeader.setPadding(10);
    table.addCell(cellHeader);
    PdfPCell cellContent;
    cellContent = new PdfPCell();
    RecomendacaoMetodologicaDTO[] recomendacoes = teachingDocumentsService.findAllRecomendacoesMetodologicasByDisciplina(disciplina.getId());
    for (RecomendacaoMetodologicaDTO recomendacao : recomendacoes) {
        Paragraph referenciaParagraph = new Paragraph(recomendacao.getTexto(), fontManager.getDefaultFont());
        cellContent.addElement(referenciaParagraph);
    }
    cellContent.setPadding(10);
    table.addCell(cellContent);
    return table;
}
Also used : PdfPCell(com.itextpdf.text.pdf.PdfPCell) PdfPTable(com.itextpdf.text.pdf.PdfPTable) RecomendacaoMetodologicaDTO(com.tomasio.projects.trainning.dto.RecomendacaoMetodologicaDTO) Phrase(com.itextpdf.text.Phrase) Paragraph(com.itextpdf.text.Paragraph)

Aggregations

Phrase (com.itextpdf.text.Phrase)50 PdfPCell (com.itextpdf.text.pdf.PdfPCell)42 PdfPTable (com.itextpdf.text.pdf.PdfPTable)17 Paragraph (com.itextpdf.text.Paragraph)14 Image (com.itextpdf.text.Image)7 IOException (java.io.IOException)7 Chunk (com.itextpdf.text.Chunk)6 Font (com.itextpdf.text.Font)6 BadElementException (com.itextpdf.text.BadElementException)5 DocumentException (com.itextpdf.text.DocumentException)5 ArrayList (java.util.ArrayList)5 KpiVO (com.netsteadfast.greenstep.vo.KpiVO)4 ObjectiveVO (com.netsteadfast.greenstep.vo.ObjectiveVO)4 PerspectiveVO (com.netsteadfast.greenstep.vo.PerspectiveVO)4 ObjetivoDisciplinaDTO (com.tomasio.projects.trainning.dto.ObjetivoDisciplinaDTO)4 BaseColor (com.itextpdf.text.BaseColor)3 List (com.itextpdf.text.List)3 ListItem (com.itextpdf.text.ListItem)3 BaseFont (com.itextpdf.text.pdf.BaseFont)3 PdfContentByte (com.itextpdf.text.pdf.PdfContentByte)3