Example usage for com.lowagie.text Rectangle BOTTOM

List of usage examples for com.lowagie.text Rectangle BOTTOM

Introduction

In this page you can find the example usage for com.lowagie.text Rectangle BOTTOM.

Prototype

int BOTTOM

To view the source code for com.lowagie.text Rectangle BOTTOM.

Click Source Link

Document

This represents one side of the border of the Rectangle.

Usage

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);//from   ww  w .  j  a  v a  2s .c om
        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_DOC_VAL_RSO.java

License:GNU General Public License

public void writeIndex(Report report) throws Exception {
    ROOT.strName = "ROOT";

    CenterMiddleTable tbl = new CenterMiddleTable(4);
    int width[] = { 5, 5, 80, 10 };
    tbl.setWidths(width);//from   w  w  w .  j ava2 s.c o  m
    tbl.toLeft();
    tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Indice"), 4);
    tbl.setDefaultCellBorder(0);
    tbl.addCell("", 10, 4);
    tbl.setDefaultCellBorder(Rectangle.BOTTOM);
    writePair(tbl, ROOT, 0);
    report.m_document.add(tbl);
}

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

License:GNU General Public License

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

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

    IAttivitaLavorativeHome h = (IAttivitaLavorativeHome) PseudoContext.lookup("AttivitaLavorativeBean");
    IRischioHome home_rs = (IRischioHome) PseudoContext.lookup("RischioBean");
    IMisurePreventiveHome home_mp = (IMisurePreventiveHome) PseudoContext.lookup("MisurePreventiveBean");

    this.bRotate = true;
    initDocument("the doc", null,
            ApplicationConfigurator.LanguageManager.getString("LISTA.DEGLI.INTERVENTI.AZIENDALI"),
            bean_az.getRAG_SCL_AZL(), null);
    AddImage();//  www  .  ja v a 2 s . co  m
    {
        CenterMiddleTable tbl = new CenterMiddleTable(1);
        tbl.setOffset(0);
        tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Azienda/Ente"));
        tbl.addCell(bean_az.getRAG_SCL_AZL());
        tbl.addHeaderCellB(
                ApplicationConfigurator.LanguageManager.getString("LISTA.DEGLI.INTERVENTI.AZIENDALI"));
        m_document.add(tbl);
    }
    writeIndent();
    {
        CenterMiddleTable tbl = null;
        if (!bShowSito) {
            tbl = new CenterMiddleTable(8);
            int width[] = { 5, 6, 12, 5, 25, 15, 7, 10 };
            tbl.setWidths(width);
        } else {
            tbl = new CenterMiddleTable(9);
            int width[] = { 5, 5, 6, 12, 5, 25, 15, 7, 10 };
            tbl.setWidths(width);
        }

        tbl.toLeft();
        tbl.setDefaultCellBorder(Rectangle.BOTTOM | Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);

        if (!bShowSito) {
            Iterator it = h.getAttivitaLavorative_Name_View(lCOD_AZL).iterator();
            while (it.hasNext()) {
                AttivitaLavorative_Name_View w = (AttivitaLavorative_Name_View) it.next();
                drawLuogoFisico(home_rs, home_mp, tbl, w.NOM_MAN, w.COD_MAN, bShowSito);
            }
        } else {
            ISitaAziendeHome home_sa = (ISitaAziendeHome) PseudoContext.lookup("SitaAziendeBean");
            Iterator it = home_sa.getNonEmptySiteAziendaleByAZLID_View(lCOD_AZL).iterator();
            while (it.hasNext()) {
                SiteAziendaleByAZLID_View w = (SiteAziendaleByAZLID_View) it.next();
                tbl.setDefaultCellBorder(Rectangle.BOTTOM | Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
                tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Sito.aziendale"), 9);
                tbl.addHeaderCellI(w.NOM_SIT_AZL, 9);

                Iterator it2 = h.getAttivitaLavorative_Name_ViewBySito(w.COD_SIT_AZL).iterator();

                while (it2.hasNext()) {
                    AttivitaLavorative_Name_View ww = (AttivitaLavorative_Name_View) it2.next();
                    drawLuogoFisico(home_rs, home_mp, tbl, ww.NOM_MAN, ww.COD_MAN, bShowSito);
                }

            }
        }
        m_document.add(tbl);
    }
    closeDocument();
}

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

License:GNU General Public License

public void drawLuogoFisico(IRischioHome home_rs, IMisurePreventiveHome home_mp, CenterMiddleTable tbl,
        String strName, long lCOD_MAN, boolean bShowSito) throws BadElementException {

    int iTmp = bShowSito ? 1 : 0;
    tbl.setDefaultCellBorder(Rectangle.BOTTOM | Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
    if (bShowSito) {
        tbl.setDefaultCellBorder(0);/*w  w  w . j  a  va 2  s. co m*/
        tbl.addCell("", 0, 1);
        tbl.setDefaultCellBorder(Rectangle.BOTTOM | Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
    }
    tbl.addHeaderCellB(ApplicationConfigurator.LanguageManager.getString("Attivit.lavorativa"), 8);
    if (bShowSito) {
        tbl.setDefaultCellBorder(0);
        tbl.addCell("", 0, 1);
        tbl.setDefaultCellBorder(Rectangle.BOTTOM | Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT);
    }
    tbl.addHeaderCellI(strName, 8);
    tbl.setDefaultCellBorder(0);
    {
        Iterator it2 = home_rs.getReportRischioByMAN_Name_View(lCOD_AZL, lCOD_MAN).iterator();
        while (it2.hasNext()) {
            ReportRischio_Name_View ww = (ReportRischio_Name_View) it2.next();
            tbl.addCell("", 0, 1 + iTmp);
            tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Rischio") + ":", 0, 1);
            tbl.addCell(Formatter.format(ww.strNOM_RSO), 0, 4);
            tbl.toRight();
            tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("PxD") + ":", 0, 1);
            tbl.toLeft();
            tbl.addCell(Formatter.format(ww.lSTM_NUM_RSO));
            {
                Iterator it3 = home_mp.getReportMisurePreventive_View(ww.lCOD_RSO_MAN).iterator();
                while (it3.hasNext()) {
                    ReportMisurePreventive_View www = (ReportMisurePreventive_View) it3.next();
                    tbl.addCell("", 0, 2 + iTmp);
                    tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Misure") + ":", 0, 1);
                    tbl.addCell(www.strNOM_MIS_PET + "\n" + www.strDES_MIS_PET, 0, 3);
                    tbl.toRight();
                    tbl.addCellB(ApplicationConfigurator.LanguageManager.getString("Dt.Comp.") + ":", 0, 1);
                    tbl.toLeft();
                    tbl.addCell(Formatter.format(www.dtDAT_CMP));
                    //tbl.setDefaultColspan(7);
                    {
                        CenterMiddleTable tb = tbl;//new CenterMiddleTable(4);
                        //tb.toLeft();
                        tbl.addCell("", 0, 2 + iTmp);
                        tb.addCellB(
                                ApplicationConfigurator.LanguageManager.getString("Data.pianificazione") + ":",
                                0, 2);
                        tb.addCellB(
                                ApplicationConfigurator.LanguageManager.getString("Referente.dell'intervento")
                                        + ":",
                                0, 1);
                        tb.addCellB(ApplicationConfigurator.LanguageManager.getString("Data.bonifica") + ":", 0,
                                1);
                        tb.addCellB(ApplicationConfigurator.LanguageManager.getString("Costo.intervento") + ":",
                                0, 2);

                        tbl.addCell("", 0, 2 + iTmp);
                        tb.addCell(".... / .... / ....", 0, 2);
                        tb.addCell(".............................................");
                        tb.addCell(".... / .... / ....");
                        tb.addCell(".................................", 0, 2);
                        //tbl.insertTable(tb);
                    }
                    //tbl.setDefaultColspan(1);
                }
            }
        }
    }

}

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  w  ww  . j a v a 2s  .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_SCH_RSO_NEW_DVR.java

License:GNU General Public License

private MiddleTable prepareAttivitaTableHeader(short sMOD_CLC_RSO) throws Exception {
    int numberOfColumnsAttivitaLavorative = (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) ? 7 : 5;
    MiddleTable rischioMansioneTable = new MiddleTable(numberOfColumnsAttivitaLavorative);
    rischioMansioneTable.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | Rectangle.BOTTOM);

    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
        int rischiAttivitaLavorativeWidth[] = { 45, 40, 5, 5, 5 };
        rischioMansioneTable.setWidths(rischiAttivitaLavorativeWidth);
    } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
        int rischiAttivitaLavorativeWidth[] = { 45, 30, 5, 5, 5, 5, 5 };
        rischioMansioneTable.setWidths(rischiAttivitaLavorativeWidth);
    }/* w  w  w. j a  v  a2 s  . co m*/

    // Intestazione della tabella
    rischioMansioneTable.addHeaderCellBI(
            ApplicationConfigurator.LanguageManager.getString("Gruppo.omogeneo.di.lavoratori"), 1, true, 8);
    rischioMansioneTable.toCenter();
    rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("MPP.applicate"), 1,
            true, 8);
    rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("P"), 1, true, 8);
    rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("D"), 1, true, 8);
    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
        rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("F"), 1, true,
                8);
        rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("N"), 1, true,
                8);
    }
    rischioMansioneTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("R"), 1, true, 8);
    rischioMansioneTable.toLeft();

    return rischioMansioneTable;
}

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

License:GNU General Public License

private MiddleTable prepareLuogoFisicoTableHeader(short sMOD_CLC_RSO) throws Exception {
    int numberOfColumnsLuoghiFisici = (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) ? 7 : 5;
    MiddleTable rischiLuoghiFisiciTable = new MiddleTable(numberOfColumnsLuoghiFisici);
    rischiLuoghiFisiciTable.setBorder(Rectangle.LEFT | Rectangle.RIGHT | Rectangle.TOP | Rectangle.BOTTOM);

    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_BASE) {
        int rischiLuoghiFisiciWidth[] = { 45, 40, 5, 5, 5 };
        rischiLuoghiFisiciTable.setWidths(rischiLuoghiFisiciWidth);
    } else if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
        int rischiLuoghiFisiciWidth[] = { 45, 30, 5, 5, 5, 5, 5 };
        rischiLuoghiFisiciTable.setWidths(rischiLuoghiFisiciWidth);
    }//from  ww w. java  2  s.c  om

    // Intestazione della tabella
    rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("Luoghi.fisici"),
            1, true, 8);
    rischiLuoghiFisiciTable.toCenter();
    rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("MPP.applicate"),
            1, true, 8);
    rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("P"), 1, true, 8);
    rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("D"), 1, true, 8);
    if (sMOD_CLC_RSO == Azienda_MOD_CLC_RSO.MOD_EXTENDED) {
        rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("F"), 1, true,
                8);
        rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("N"), 1, true,
                8);
    }
    rischiLuoghiFisiciTable.addHeaderCellBI(ApplicationConfigurator.LanguageManager.getString("R"), 1, true, 8);
    rischiLuoghiFisiciTable.toLeft();

    return rischiLuoghiFisiciTable;
}

From source file:uk.ac.bbsrc.tgac.miso.core.data.decorator.itext.ITextProjectDecorator.java

License:Open Source License

public void buildReport() throws DocumentException {
    report = new Document();
    PdfWriter writer = PdfWriter.getInstance(report, stream);
    report.open();/*  ww  w . j av a  2 s .  c  o m*/
    report.add(new Paragraph("Project Summary"));
    PdfContentByte cb = writer.getDirectContent();
    cb.setLineWidth(2.0f); // Make a bit thicker than 1.0 default
    cb.setGrayStroke(0.9f); // 1 = black, 0 = white
    float x = 72f;
    float y = 200f;
    cb.moveTo(x, y);
    cb.lineTo(x + 72f * 6, y);
    cb.stroke();

    report.add(new Paragraph(project.getAlias()));
    report.add(new Paragraph(project.getDescription()));

    PdfPTable t = new PdfPTable(1);
    t.setHorizontalAlignment(Element.ALIGN_CENTER);
    t.setWidthPercentage(100f); // this would be the 100 from setHorizontalLine
    t.setSpacingAfter(5f);
    t.setSpacingBefore(0f);
    t.getDefaultCell().setUseVariableBorders(true);
    t.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
    t.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
    t.getDefaultCell().setBorder(Rectangle.BOTTOM); // This generates the line
    t.getDefaultCell().setBorderWidth(1f); // this would be the 1 from setHorizontalLine
    t.getDefaultCell().setPadding(0);
    t.addCell("");
    report.add(t);

    x = 72f;
    y = 100f;
    cb.moveTo(x, y);
    cb.lineTo(x + 72f * 6, y);
    cb.stroke();

    if (project.getSamples().size() > 0) {
        report.add(new Paragraph("Samples"));
        for (Sample sample : project.getSamples()) {
            Paragraph sPara = new Paragraph(sample.getAlias(), FontFactory.getFont("Helvetica", 12, Font.BOLD));
            sPara.setIndentationLeft(20);
            report.add(sPara);
            report.add(new Paragraph(sample.getDescription()));
        }
    }

    report.close();
}

From source file:wagwaan.reports.ActiveSuppliersPdf.java

public void generatePdf() {

    try {//  w ww  . j a v  a2s. c om

        java.io.File tempFile = java.io.File.createTempFile("REP" + label.getDateLable() + "_", ".pdf");

        tempFile.deleteOnExit();

        java.lang.Runtime rt = java.lang.Runtime.getRuntime();

        java.lang.String debitTotal = null;

        java.lang.String creditTotal = null;
        com.lowagie.text.Document docPdf = new com.lowagie.text.Document(PageSize.A4.rotate());

        try {

            try {

                com.lowagie.text.pdf.PdfWriter.getInstance(docPdf, new java.io.FileOutputStream(tempFile));
                ReportUtil.addCenteredTitlePage(docPdf, connectDB);

                String date = null;
                try {
                    java.sql.Statement st3 = connectDB.createStatement();
                    java.sql.Statement st4 = connectDB.createStatement();

                    java.sql.ResultSet rset4 = st4.executeQuery("SELECT date(now()) as Date");

                    while (rset4.next())
                        date = rset4.getObject(1).toString();

                } catch (java.sql.SQLException SqlExec) {

                    javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage());

                }

                com.lowagie.text.HeaderFooter footer = new com.lowagie.text.HeaderFooter(
                        new Phrase("Active Suppliers- Page: "), true);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 12, Font.BOLDITALIC,java.awt.Color.blue));

                docPdf.setFooter(footer);

                docPdf.open();

                ReportUtil.addCenteredTitlePage(docPdf, connectDB);
                try {

                    com.lowagie.text.pdf.PdfPTable table = new com.lowagie.text.pdf.PdfPTable(10);

                    int headerwidths[] = { 4, 6, 20, 11, 11, 10, 10, 10, 10, 9 };

                    table.setWidths(headerwidths);

                    table.setWidthPercentage((100));
                    table.getDefaultCell().setBorder(Rectangle.BOTTOM);

                    table.getDefaultCell().setColspan(5);

                    Phrase phrase;

                    java.text.DateFormat dateFormat = java.text.DateFormat
                            .getDateInstance(java.text.DateFormat.MEDIUM);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                    phrase = new Phrase("Active Suppliers");
                    table.addCell(phrase);
                    //                        table.getDefaultCell().setColspan(4);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
                    phrase = new Phrase("Printed On  :" + date, pFontHeader);
                    table.addCell(phrase);

                    table.getDefaultCell().setColspan(1);
                    table.getDefaultCell()
                            .setBorder(PdfCell.TOP | PdfCell.BOTTOM | PdfCell.LEFT | PdfCell.RIGHT);

                    phrase = new Phrase("#", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Suplier ID", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Supplier Names", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Address", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Phone No", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Email", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Bank Name", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Account No", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Branch Name", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Reg. Date", pFontHeader);
                    table.addCell(phrase);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);

                    table.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE);

                    try {
                        /*Statement s=connectDB.createStatement();
                        ResultSet r=s.executeQuery("SELECT  sum(ord.price*quantity_received) total  FROM st_receiving_issuing REV, stock_orders ord, stock_items itm "
                            + "where receiving_no='"+issue+"' and itm.item_code=ord.item_code and itm.item_code=rev.item_code");*/

                        java.sql.Statement st = connectDB.createStatement();

                        java.sql.ResultSet rset = st.executeQuery(
                                "select supplier_id, supplier_names, address, phone_no, email_address, bank_name, account_no, "
                                        + "branch_name, date_registered from stock_suppliers where active=true order by 1, 2");
                        int count = 1;
                        while (rset.next()) {

                            table.getDefaultCell().setColspan(1);
                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER);
                            table.getDefaultCell().setColspan(1);
                            numberSeq += 1;

                            phrase = new Phrase("" + count + "   ", pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1);

                            table.addCell(phrase);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1);

                            table.addCell(phrase);
                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(3), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(4), "-"), pFontHeader1);

                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(5), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(6), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(8), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(9), "-"), pFontHeader1);
                            table.addCell(phrase);
                            count++;
                        }

                        docPdf.add(table);

                    } catch (java.sql.SQLException SqlExec) {

                        javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(),
                                SqlExec.getMessage());

                    }

                } catch (com.lowagie.text.BadElementException BadElExec) {

                    javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage());

                }

            } catch (java.io.FileNotFoundException fnfExec) {

                javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), fnfExec.getMessage());

            } catch (SQLException ex) {
                Logger.getLogger(ActiveSuppliersPdf.class.getName()).log(Level.SEVERE, null, ex);
            } catch (BadElementException ex) {
                Logger.getLogger(ActiveSuppliersPdf.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (com.lowagie.text.DocumentException lwDocexec) {

            javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), lwDocexec.getMessage());

        }

        docPdf.close();

        deskTop.open(tempFile);

    } catch (java.io.IOException IOexec) {

        javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), IOexec.getMessage());

    }

}

From source file:wagwaan.reports.BlackListedSuppPdf.java

public void generatePdf() {

    try {//  w  w w. j av a  2 s .  c  om

        java.io.File tempFile = java.io.File.createTempFile("REP" + label.getDateLable() + "_", ".pdf");

        tempFile.deleteOnExit();

        java.lang.Runtime rt = java.lang.Runtime.getRuntime();

        java.lang.String debitTotal = null;

        java.lang.String creditTotal = null;
        com.lowagie.text.Document docPdf = new com.lowagie.text.Document(PageSize.A4.rotate());

        try {

            try {

                com.lowagie.text.pdf.PdfWriter.getInstance(docPdf, new java.io.FileOutputStream(tempFile));

                ReportUtil.addCenteredTitlePage(docPdf, connectDB);
                String date = null;
                try {
                    java.sql.Statement st3 = connectDB.createStatement();
                    java.sql.Statement st4 = connectDB.createStatement();

                    java.sql.ResultSet rset4 = st4.executeQuery("SELECT date(now()) as Date");
                    while (rset4.next())
                        date = rset4.getObject(1).toString();

                } catch (java.sql.SQLException SqlExec) {

                    javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), SqlExec.getMessage());

                }

                com.lowagie.text.HeaderFooter footer = new com.lowagie.text.HeaderFooter(
                        new Phrase("BlackListed Suppliers- Page: "), true);// FontFactory.getFont(com.lowagie.text.FontFactory.HELVETICA, 12, Font.BOLDITALIC,java.awt.Color.blue));

                docPdf.setFooter(footer);

                docPdf.open();

                ReportUtil.addCenteredTitlePage(docPdf, connectDB);
                try {

                    com.lowagie.text.pdf.PdfPTable table = new com.lowagie.text.pdf.PdfPTable(10);

                    int headerwidths[] = { 4, 6, 20, 11, 11, 10, 10, 10, 10, 9 };

                    table.setWidths(headerwidths);

                    table.setWidthPercentage((100));
                    table.getDefaultCell().setBorder(Rectangle.BOTTOM);

                    table.getDefaultCell().setColspan(5);

                    Phrase phrase;

                    java.text.DateFormat dateFormat = java.text.DateFormat
                            .getDateInstance(java.text.DateFormat.MEDIUM);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                    phrase = new Phrase("BlackListed Suppliers");
                    table.addCell(phrase);
                    //                        table.getDefaultCell().setColspan(4);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);
                    phrase = new Phrase("Printed On  :" + date, pFontHeader);
                    table.addCell(phrase);

                    table.getDefaultCell().setColspan(1);
                    table.getDefaultCell()
                            .setBorder(PdfCell.TOP | PdfCell.BOTTOM | PdfCell.LEFT | PdfCell.RIGHT);

                    phrase = new Phrase("#", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Suplier ID", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Supplier Names", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Address", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Phone No", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Email", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Bank Name", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Account No", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Branch Name", pFontHeader);
                    table.addCell(phrase);

                    phrase = new Phrase("Reg. Date", pFontHeader);
                    table.addCell(phrase);
                    table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_RIGHT);

                    table.getDefaultCell().setBackgroundColor(java.awt.Color.WHITE);

                    try {
                        /*Statement s=connectDB.createStatement();
                        ResultSet r=s.executeQuery("SELECT  sum(ord.price*quantity_received) total  FROM st_receiving_issuing REV, stock_orders ord, stock_items itm "
                            + "where receiving_no='"+issue+"' and itm.item_code=ord.item_code and itm.item_code=rev.item_code");*/

                        java.sql.Statement st = connectDB.createStatement();

                        java.sql.ResultSet rset = st.executeQuery(
                                "select supplier_id, supplier_names, address, phone_no, email_address, bank_name, account_no, "
                                        + "branch_name, date_registered from stock_suppliers where active=false order by 1, 2");
                        int count = 1;
                        while (rset.next()) {

                            table.getDefaultCell().setColspan(1);
                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_CENTER);
                            table.getDefaultCell().setColspan(1);
                            numberSeq += 1;

                            phrase = new Phrase("" + count + "   ", pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(1), "-"), pFontHeader1);

                            table.addCell(phrase);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(2), "-"), pFontHeader1);

                            table.addCell(phrase);
                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(3), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(4), "-"), pFontHeader1);

                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(5), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(6), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(7), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(8), "-"), pFontHeader1);
                            table.addCell(phrase);

                            table.getDefaultCell().setHorizontalAlignment(PdfCell.ALIGN_LEFT);
                            phrase = new Phrase(dbObject.getDBObject(rset.getObject(9), "-"), pFontHeader1);
                            table.addCell(phrase);
                            count++;
                        }

                        docPdf.add(table);

                    } catch (java.sql.SQLException SqlExec) {

                        javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(),
                                SqlExec.getMessage());

                    }

                } catch (com.lowagie.text.BadElementException BadElExec) {

                    javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), BadElExec.getMessage());

                }

            } catch (java.io.FileNotFoundException fnfExec) {

                javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), fnfExec.getMessage());

            } catch (SQLException ex) {
                Logger.getLogger(ActiveSuppliersPdf.class.getName()).log(Level.SEVERE, null, ex);
            } catch (BadElementException ex) {
                Logger.getLogger(ActiveSuppliersPdf.class.getName()).log(Level.SEVERE, null, ex);
            }
        } catch (com.lowagie.text.DocumentException lwDocexec) {

            javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), lwDocexec.getMessage());

        }

        docPdf.close();

        deskTop.open(tempFile);

    } catch (java.io.IOException IOexec) {

        javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame(), IOexec.getMessage());

    }

}