Example usage for com.lowagie.text Element ALIGN_TOP

List of usage examples for com.lowagie.text Element ALIGN_TOP

Introduction

In this page you can find the example usage for com.lowagie.text Element ALIGN_TOP.

Prototype

int ALIGN_TOP

To view the source code for com.lowagie.text Element ALIGN_TOP.

Click Source Link

Document

A possible value for vertical alignment.

Usage

From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java

License:Open Source License

public PdfPCell createCellNoBorder() {
    PdfPCell cell = new PdfPCell();
    cell.setBorderColor(sBorderColor);//from  w w  w  .jav  a 2  s .c om
    cell.setPadding(3);
    cell.setBorderWidth(0);
    cell.setVerticalAlignment(Element.ALIGN_TOP);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    return cell;
}

From source file:org.unitime.timetable.webutil.timegrid.PdfExamGridTable.java

License:Open Source License

public void addText(PdfPCell cell, String text, boolean bold) {
    if (text == null)
        return;// w w  w .j  a v  a 2  s .co m
    if (text.indexOf("<span") >= 0)
        text = text.replaceAll("</span>", "").replaceAll("<span .*>", "");
    text = text.replaceAll("<br>", "\n");
    text = text.replaceAll("<BR>", "\n");
    if (cell.getPhrase() == null) {
        cell.setPhrase(new Paragraph(text, PdfFont.getFont(bold)));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    } else {
        cell.getPhrase().add(new Chunk("\n" + text, PdfFont.getFont(bold)));
    }
}

From source file:org.unitime.timetable.webutil.timegrid.PdfTimetableGridTable.java

License:Open Source License

public void addText(PdfPCell cell, String text, boolean bold) {
    if (text == null)
        return;//from  w w w .  j  a va2s.  c  o  m
    if (text.indexOf("<span") >= 0)
        text = text.replaceAll("</span>", "").replaceAll("<span .*>", "");
    if (cell.getPhrase() == null) {
        cell.setPhrase(new Paragraph(text, PdfFont.getSmallFont(bold)));
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    } else {
        cell.getPhrase().add(new Chunk("\n" + text, PdfFont.getSmallFont(bold)));
    }
}

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);/*ww  w . j  av a  2  s  .com*/
        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);
        // }
        // }
    }
}

From source file:s2s.luna.reports.Report_REP_AZL_GSE.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {
    String strTemp = "";
    IAziendaHome home = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean = home.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc", null,
            IncludeLogo ? ApplicationConfigurator.LanguageManager.getString("SCHEDA.AZIENDALE")
                    : ApplicationConfigurator.LanguageManager.getString("Informazioni.preliminari"),
            bean.getRAG_SCL_AZL(), null);
    if (IncludeLogo) {
        AddImage();/*from  www .  ja v  a2 s. c  o  m*/
    }
    // writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.addHeaderCellB(IncludeLogo ? ApplicationConfigurator.LanguageManager.getString("SCHEDA.AZIENDALE")
                : ApplicationConfigurator.LanguageManager.getString("Informazioni.preliminari"));
        tbl.addTitleCell(bean.getRAG_SCL_AZL());
        m_document.add(tbl);
    }
    {// Dati anagrafici
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Dati.anagrafici"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Attivit.svolta")); //ok
        tbl.addCell(bean.getDES_ATI_SVO_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Indirizzo.n.civico"));// ok
        tbl.addCell(bean.getIDZ_AZL() + ", " + bean.getNUM_CIC_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Citt.C.A.P."));// ok
        if (bean.getCAP_AZL() != null) {
            tbl.addCell(bean.getCIT_AZL() + " - " + bean.getCAP_AZL());
        } else {
            tbl.addCell(bean.getCIT_AZL());
        }
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Provincia"));// ok
        tbl.addCell(bean.getPRV_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Nazionalit"));// ok
        strTemp = "";
        INazionalitaHome h = (INazionalitaHome) PseudoContext.lookup("NazionalitaBean");
        INazionalita b = h.findByPrimaryKey(new Long(bean.getCOD_STA()));
        tbl.addCell(b.getNOM_STA());
        m_document.add(tbl);
    }
    {// Dati sulla sicurezza
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Dati.sulla.sicurezza"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Datore.di.lavoro"));// ok
        tbl.addCell(bean.getNOM_RSP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Qualifica.del.datore.lavoro"));//ok
        tbl.addCell(bean.getQLF_RSP_AZL());

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Resp.aziendale.SPP"));// ok
        tbl.addCell(bean.getNOM_RSP_SPP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Medico.competente"));// ok
        tbl.addCell(bean.getNOM_MED_AZL());
        m_document.add(tbl);
    }
    {// Altro
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Altro"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("E-mail.aziendale"));// ok
        tbl.addCell(bean.getIDZ_PSA_ELT_RSP_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Sito.internet.aziendale"));// ok
        tbl.addCell(bean.getSIT_INT_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Azienda.associata"));
        if (bean.getCOD_AZL_ASC() == 0) {
            tbl.addCell("");
        } else {
            strTemp = "";
            IAziendaHome h = (IAziendaHome) PseudoContext.lookup("AziendaBean");
            IAzienda b = h.findByPrimaryKey(new Long(bean.getCOD_AZL_ASC()));

            tbl.addCell(b.getRAG_SCL_AZL());
        }
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Codice.ISTAT"));//ok
        tbl.addCell(bean.getCOD_IST_TAT_AZL());
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Telefoni.utili"));//ok
        strTemp = "";
        IAziendaTelefonoHome h = (IAziendaTelefonoHome) PseudoContext.lookup("AziendaTelefonoBean");
        Iterator it = h.getAziendaTelefoniByAZLID_View(lCOD_AZL).iterator();
        while (it.hasNext()) {
            AziendaTelefoniByAZLID_View w = (AziendaTelefoniByAZLID_View) it.next();
            strTemp += w.NUM_TEL;
            if (it.hasNext()) {
                strTemp += ", ";
            }
        }
        tbl.addCell(strTemp);
        m_document.add(tbl);
    }
    {// Rappresentanti dei lavoratori
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Rappresentanti.dei.lavoratori"));
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 30, 79 };
        tbl.setWidths(width);

        Cell rlsCell = new Cell(ApplicationConfigurator.LanguageManager.getString("R.L.S."));
        rlsCell.setVerticalAlignment(Element.ALIGN_TOP);
        tbl.addCell(rlsCell);//ok
        strTemp = "";
        IDipendenteHome home_dpd = (IDipendenteHome) PseudoContext.lookup("DipendenteBean");
        java.util.Iterator it_dip = home_dpd.getDipendentiByAZLID_RLS_View(lCOD_AZL).iterator();
        while (it_dip.hasNext()) {
            DipendentiByAZLID_View dt = (DipendentiByAZLID_View) it_dip.next();
            strTemp += Formatter.format(dt.COG_DPD);
            strTemp += " " + Formatter.format(dt.NOM_DPD);
            if (it_dip.hasNext()) {
                strTemp += "\n";
            }
        }
        tbl.addCell(strTemp);
        m_document.add(tbl);
    }
    {// Siti aziendali
        writeParagraph1(ApplicationConfigurator.LanguageManager.getString("Sedi"));
        CenterMiddleTable tbl = new CenterMiddleTable(5);
        tbl.toLeft();
        int width[] = { 22, 25, 25, 20, 8 };
        tbl.setWidths(width);

        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Sede"));// ok
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Immobile"));// ok
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Indirizzo"));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Citt.C.A.P."));
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Prov."));
        tbl.endHeaders();

        IImmobili3lvHome imm3lv = (IImmobili3lvHome) PseudoContext.lookup("Immobili3lvBean");
        Iterator imm3lv_it = imm3lv.findEx(lCOD_AZL, null, null, null, null, null, null, null, null, 0)
                .iterator();
        String previousNOM_SIT_AZL = "";
        while (imm3lv_it.hasNext()) {
            Immobili3liv_View immobile3lv = (Immobili3liv_View) imm3lv_it.next();
            Cell nomSitAzlCell = null;
            // Cambio sede
            if (previousNOM_SIT_AZL.equals(immobile3lv.NOM_SIT_AZL) == false) {
                nomSitAzlCell = new Cell(immobile3lv.NOM_SIT_AZL);
                if (imm3lv_it.hasNext()) {
                    nomSitAzlCell.setBorder(Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
                }
                // Sede uguale alle precedente
            } else {
                nomSitAzlCell = new Cell("");
                if (imm3lv_it.hasNext()) {
                    nomSitAzlCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT);
                } else {
                    nomSitAzlCell.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM);
                }
            }
            tbl.addCell(nomSitAzlCell);
            previousNOM_SIT_AZL = immobile3lv.NOM_SIT_AZL;
            tbl.addCell(Formatter.format(immobile3lv.NOM_IMM));
            tbl.addCell(Formatter.format(immobile3lv.IND_IMM)
                    + (StringManager.isNotEmpty(immobile3lv.IND_IMM)
                            && StringManager.isNotEmpty(immobile3lv.NUM_CIV_IMM) ? ", " : "")
                    + Formatter.format(immobile3lv.NUM_CIV_IMM));
            tbl.addCell(Formatter.format(immobile3lv.CIT_IMM)
                    + (StringManager.isNotEmpty(immobile3lv.CIT_IMM)
                            && StringManager.isNotEmpty(immobile3lv.CAP_IMM) ? " - " : "")
                    + Formatter.format(immobile3lv.CAP_IMM));
            tbl.addCell(Formatter.format(immobile3lv.PRO_IMM));
        }
        m_document.add(tbl);
    }
    closeDocument();
}

From source file:s2s.luna.reports.Report_REP_SOP.java

License:GNU General Public License

@Override
public void doReport() throws DocumentException, IOException, BadElementException, Exception {

    SecurityWrapper Security = SecurityWrapper.getInstance();
    ISopraluogoHome home1 = (ISopraluogoHome) PseudoContext.lookup("SopraluogoBean");
    ISopraluogo bean = home1.findByPrimaryKey(new Long(new Long(request.getParameter("ID"))));
    IAnagrProcedimentoHome home_pro = (IAnagrProcedimentoHome) PseudoContext.lookup("AnagrProcedimentoBean");
    IAnagrProcedimento bean_pro = home_pro.findByPrimaryKey(new Long(bean.getCOD_PRO()));
    IDipendenteHome home_dpd = (IDipendenteHome) PseudoContext.lookup("DipendenteBean");

    ICantiereHome home_can = (ICantiereHome) PseudoContext.lookup("CantiereBean");
    ICantiere bean_can = home_can.findByPrimaryKey(new Long(bean.getCOD_CAN()));

    IAnagrOpereHome home_ope = (IAnagrOpereHome) PseudoContext.lookup("AnagrOpereBean");
    IAnagrOpere bean_ope = null;/*from   w w  w . jav  a2 s .c  o m*/
    long COD_OPE = bean.getCOD_OPE();
    if (COD_OPE != 0) {
        bean_ope = home_ope.findByPrimaryKey(COD_OPE);
    }

    lCOD_AZL = Security.getAziendaR();
    IAziendaHome home_az = (IAziendaHome) PseudoContext.lookup("AziendaBean");
    IAzienda bean_az = home_az.findByPrimaryKey(new Long(lCOD_AZL));

    initDocument("the doc",
            // Intestazione - Cella a sinistra
            bean_pro.getstrDES(),
            // Intestazione - Cella centrale
            bean_can.getNOM_CAN() + " - " + bean.getNUM_SOP(),
            // Pi di pagina Cella a sinistra
            bean_az.getRAG_SCL_AZL(),
            // Pi di pagina Cella a destra
            formatPlain(bean.getDAT_SOP()));

    m_handler.bShowDate = false;

    // LOGO E TITOLO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.setDefaultCellBorder(0);
        int width[] = { 15, 75 };
        tbl.setWidths(width);
        if (IncludeLogo) {
            Image png = loadImage("LOGO");
            png.scalePercent(50);
            png.setAlignment(Image.ALIGN_LEFT);
            Cell cImage = new Cell(png);
            tbl.addCell(cImage);
        } else {
            tbl.addCell("");
        }
        CenterMiddleTable tbl2 = new CenterMiddleTable(1);
        tbl2.setDefaultCellBorder(0);
        tbl2.addCellBU(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), 15);
        tbl2.addCellBU(ApplicationConfigurator.LanguageManager.getString("Coordinamento.sicurezza.cantieri")
                .toUpperCase(), 15);

        Cell cText = new Cell(tbl2);
        tbl.addCell(cText);
        m_document.add(tbl);
    }

    writeIndent();
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        if (bStandAlone) {
        }
        m_document.add(tbl);
    }

    // DATI DEL SOPRALLUOGO
    {
        CenterMiddleTable tbl = new CenterMiddleTable(4);
        tbl.toLeft();
        int width[] = { 30, 20, 25, 25 };
        tbl.setWidths(width);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Sopralluogo.N") + "  " + bean.getNUM_SOP(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("del") + "  "
                + formatPlain(bean.getDAT_SOP()), defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Inizio.h")
                        + (bean.getORA_INI() != null ? bean.getORA_INI().toString().substring(0, 5) : ""),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Fine.h")
                        + (bean.getORA_FIN() != null ? bean.getORA_FIN().toString().substring(0, 5) : ""),
                defaultFontSize);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(3);
        tbl.toLeft();
        int width[] = { 34, 33, 33 };
        tbl.setWidths(width);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Linea") + ":  " + bean_pro.getstrDES(),
                defaultFontSize);
        tbl.addCell(
                ApplicationConfigurator.LanguageManager.getString("Stazione") + ":  " + bean_can.getNOM_CAN(),
                defaultFontSize);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Opera") + ":  "
                + (bean_ope != null ? bean_ope.getstrNOM_OPE() : ""), defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI AZIENDA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiBySOP_View(lCOD_SOP);
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.RM"), defaultFontSize);
        java.util.Iterator it = col.iterator();
        String presentiRM = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiRM += (StringManager.isEmpty(presentiRM) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD;
        }
        tbl.addCell(presentiRM, defaultFontSize);
        m_document.add(tbl);
    }

    // PRESENTI IMPRESA
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        tbl.setPadding(1 / 2);
        int width[] = { 25, 70 };
        tbl.setWidths(width);
        tbl.border();
        java.util.Collection col = home_dpd.getDipendentiEstBySOP_View(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.addCell(ApplicationConfigurator.LanguageManager.getString("Presenti.impresa"), defaultFontSize);
        String presentiIMP = "";
        while (it.hasNext()) {
            DipendentiBySOP_View obj = (DipendentiBySOP_View) it.next();
            presentiIMP += (StringManager.isEmpty(presentiIMP) ? "" : ", ") + obj.COG_DPD + " " + obj.NOM_DPD
                    + " (" + obj.IMPRESA + ")";
        }
        tbl.addCell(presentiIMP, defaultFontSize);
        m_document.add(tbl);
    }
    writeLine();

    // CONSTATAZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 100 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("CONSTATAZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        tbl.setWidths(width);
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        String constElementSeparator = " - ";
        Alphabet c = new Alphabet();
        String REV1 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV1), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Constatazione
            tbl.addCell(Formatter.format(
                    (StringManager.isNotEmpty(obj.sRAG_SCL_DTE) ? obj.sRAG_SCL_DTE + constElementSeparator : "")
                            + (StringManager.isNotEmpty(obj.sNOM_ATT)
                                    ? obj.sNOM_ATT + constElementSeparator
                                    : "")
                            + (StringManager.isNotEmpty(obj.sDES_LIB) ? obj.sDES_LIB + constElementSeparator
                                    : "")
                            + obj.sDESC),
                    defaultFontSize);
            REV1 = c.getNextElement(REV1);
        }
        m_document.add(tbl);
    }
    writeLine();

    // DISPOSIZIONI
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.toLeft();
        int width[] = { 85 };
        tbl.setWidths(width);
        tbl.addHeaderCellB2(ApplicationConfigurator.LanguageManager.getString("DISPOSIZIONI"), 1, false, 11);
        m_document.add(tbl);
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        tbl.toLeft();
        int width[] = { 5, 85 };
        java.util.Collection col = home1.getConstatazioniSop(lCOD_SOP);
        java.util.Iterator it = col.iterator();
        tbl.setWidths(width);
        Alphabet c = new Alphabet();
        String REV2 = c.getNextElement("1");
        while (it.hasNext()) {
            jbConstatazione obj = (jbConstatazione) it.next();

            // Numerazione alfabetica
            Cell cell = new Cell(new Phrase(Formatter.format(REV2), REPORT_SETTINGS.ftText9B));
            cell.setVerticalAlignment(Element.ALIGN_TOP);
            tbl.addCell(cell);

            // Disposizione generata
            tbl.addCell(Formatter.format(obj.sDIS_GEN), defaultFontSize);
            REV2 = c.getNextElement(REV2);
        }
        m_document.add(tbl);
    }

    // FIRME
    // Spazio per le firme
    for (int i = 1; i <= 5; i++) {
        writeLine();
    }
    {
        CenterMiddleTable tbl = new CenterMiddleTable(2);
        int width[] = { 50, 50 };
        tbl.setWidths(width);
        tbl.setDefaultCellBorder(0);

        // Firme del personale dell'azienda
        Cell cell = new Cell(
                new Phrase(ApplicationConfigurator.CUSTOMER_NAME.toUpperCase(), REPORT_SETTINGS.ftText9));
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
        tbl.addCell(cell);

        // Firme del personale delle imprese
        Cell cell2 = new Cell(
                new Phrase(ApplicationConfigurator.LanguageManager.getString("Impresa").toUpperCase(),
                        REPORT_SETTINGS.ftText9));
        cell2.setHorizontalAlignment(Element.ALIGN_RIGHT);
        tbl.addCell(cell2);

        m_document.add(tbl);
    }

    // FOTO
    {
        Collection<jbMedia> listaFoto = home1.getMediaSOP(lCOD_SOP);
        if (listaFoto != null && listaFoto.size() > 0) {

            // STAMPA L'INDICE DELLE FOTO.
            boolean firstFoto = true;
            int fotoIndex = 0;
            for (jbMedia foto : listaFoto) {
                try {
                    // Verifica che l'immagine sia in un formato supportato.
                    Image.getInstance(foto.mediaData);
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.foto.allegate"));
                        firstFoto = false;
                    }
                    writeLine();
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2Bold(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo il "nome" o se questo  assente, "il nome file".
                    writeText2(StringManager.isNotEmpty(foto.sNOM_MED) ? Formatter.format(foto.sNOM_MED)
                            : Formatter.format(foto.sFile));
                    // Stampo, se presente, la "descrizione".
                    writeText2(StringManager.isNotEmpty(foto.sDES_MED) ? Formatter.format(foto.sDES_MED) : "");
                } catch (Exception ex) {
                    // Eccezione silenziosa.
                    // Gestisce il caso in cui l'allegato non sia un immagine
                }
            }
            // STAMPA LE FOTO.
            firstFoto = true;
            fotoIndex = 0;
            byte SPACE_FOR_TITLE = 20;
            byte SPACE_FOR_BOTTOM_MARGIN = 20;
            boolean strictImageSequence = m_writer.isStrictImageSequence();
            m_writer.setStrictImageSequence(true);
            for (jbMedia foto : listaFoto) {
                Element image = prepareImage(m_document, foto.mediaData);
                if (image != null) {
                    fotoIndex++;
                    if (firstFoto) {
                        writePage();
                        firstFoto = false;
                    }
                    if (m_document.getPageSize().getHeight() - m_document.topMargin()
                            + 20 < getAvailablePageSpace(m_document, m_writer)) {
                        writeLine();
                    }
                    if (getAvailablePageSpace(m_document, m_writer)
                            - (SPACE_FOR_TITLE + SPACE_FOR_BOTTOM_MARGIN) < ((Image) image).getScaledHeight()) {
                        writePage();
                    }
                    // Stampo il progessivo della foto, nel formato "Foto n".
                    writeText2(ApplicationConfigurator.LanguageManager.getString("Foto") + " " + fotoIndex);
                    // Stampo l'immagine.
                    m_document.add(image);
                }
            }
            m_writer.setStrictImageSequence(strictImageSequence);
        }
    }
    // DOCUMENTI ALLEGATI
    Collection<DocumentiAssociati_Sopralluogo_View> listadocumenti = home1
            .getDocumentiCantiereSOP_STAMPA(lCOD_SOP);
    if (listadocumenti != null && listadocumenti.size() > 0) {

        // STAMPA L'INDICE DEI DOCUMENTI ALLEGATI
        // i documenti allegati sono quei documenti la cui tipologia risulta avere attivo
        //il flag di stampa in sopralluogo.
        boolean firstdocument = true;
        int documentIndex = 0;
        for (DocumentiAssociati_Sopralluogo_View documento : listadocumenti) {
            try {
                // Verifica che l'immagine sia in un formato supportato.
                documentIndex++;
                if (firstdocument) {
                    writePage();
                    writeTitle(ApplicationConfigurator.LanguageManager.getString("Indice.documenti.allegati"));
                    firstdocument = false;
                }
                writeLine();
                // Stampo il "titolo" del documento.
                writeText3Bold(documentIndex + ")"
                        + (StringManager.isNotEmpty(documento.TIT_DOC) ? Formatter.format(documento.TIT_DOC)
                                : Formatter.format(documento.NOM_TPL_DOC)));
                // Stampo, se presente, la "descrizione".
                if (!(documento.DES).equals("")) {
                    writeLine();
                }
                writeText3_3(StringManager.isNotEmpty(documento.DES) ? Formatter.format(documento.DES) : "");

                IAnagrDocumentoHome doc_home = (IAnagrDocumentoHome) PseudoContext.lookup("AnagrDocumentoBean");
                AnagDocumentoFileInfo fileInfo = null;
                AnagDocumentoFileInfo fileInfoLink = null;
                fileInfo = doc_home.getFileInfoU("", documento.lCOD_DOC);
                fileInfoLink = doc_home.getFileInfoULink("", documento.lCOD_DOC);

                // se esiste stampo il file allegato
                if (fileInfo != null) {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  " + fileInfo.strName));
                } else {
                    writeLine();
                    writeText3_3(Formatter.format("   " + "File Allegato:  "));
                }

                // se esiste stampo il file link allegato
                if (fileInfoLink != null) {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  " + fileInfoLink.strName));
                } else {
                    writeText3_3(Formatter.format("   " + "File Link Allegato:  "));
                }
                writeLine();
            } catch (Exception ex) {
                // Eccezione silenziosa.
                // Gestisce il caso in cui l'allegato non sia un immagine
            }

        }
        writePage();
        // Stampa documenti allegati
        boolean endWithNewPage = false;
        endWithNewPage = StampaDocumenti(home1, bean.getCOD_SOP(), m_document, m_writer);

    }
    closeDocument();
}

From source file:s2s.report.MiddleTable.java

License:GNU General Public License

public void toTop() {
    this.setDefaultVerticalAlignment(Element.ALIGN_TOP);
}