Example usage for com.lowagie.text.pdf PdfPCell setBorderWidth

List of usage examples for com.lowagie.text.pdf PdfPCell setBorderWidth

Introduction

In this page you can find the example usage for com.lowagie.text.pdf PdfPCell setBorderWidth.

Prototype

public void setBorderWidth(float borderWidth) 

Source Link

Document

Sets the borderwidth of the table.

Usage

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsAircraftTypes(Airport airport, Document document) {
    // AIRPORT NAME     Aircrafts pictures
    notifyAction("createSheetsAircraftTypes");
    PdfPTable table = new PdfPTable(2);
    {//  ww w. j av a2s  .  c o m

        com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL);
        Paragraph p = new Paragraph(airport.getId(), font);

        PdfPCell cell = new PdfPCell(p);
        cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);

        table.addCell(cell);
    }

    {
        com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.COURIER,
                com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD);
        PdfPCell cell = new PdfPCell(new Paragraph("FLIGHTGEAR", font));
        cell.setBorderWidth(borderWidth);
        //cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsFreqs(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheetsFreqs");
    PdfPTable table = new PdfPTable(2);
    {/*from ww  w .  j ava  2 s . c  om*/
        PdfPCell cell = new PdfPCell();

        cell.setVerticalAlignment(Element.ALIGN_TOP);

        {
            if (_airport.getAtises().size() > 0) {
                String freq = "";
                for (final Atis atis : _airport.getAtises()) {
                    freq = freq + new Double(atis.getFreq()).toString() + " ";
                }

                Paragraph p = createTinyParagraph("ATIS ", freq);
                cell.addElement(p);
            }
        }

        {

            String[] reqs = { "50", "51", "52", "53", "54", "55", "56" };
            for (String req : reqs) {

                List<ATCFreq> tempFreqs = _airport.getATCFreqs(req);
                if (tempFreqs.size() > 0) {
                    String freq = "";
                    for (final ATCFreq tower : tempFreqs) {
                        freq = freq + tower.getFreq() + " ";
                    }

                    Paragraph p = createTinyParagraph(ATCFreq.typeNames.get(req) + " ", freq);
                    cell.addElement(p);

                }
            }

        }

        //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_TOP);

        table.addCell(cell);
    }

    {
        PdfPCell cell = new PdfPCell();
        {
            Paragraph p = new Paragraph("Nearest Navaid:", new com.lowagie.text.Font(
                    com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL));
            cell.addElement(p);
        }

        {
            Paragraph p = new Paragraph(getNEarestBeaconString(airport), new com.lowagie.text.Font(
                    com.lowagie.text.Font.TIMES_ROMAN, 10, com.lowagie.text.Font.NORMAL));
            cell.addElement(p);
        }

        cell.setBorderWidth(borderWidth);
        //cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsAddSvg(Airport airport, PdfWriter writer, Document document, String imageFileName) {
    // FREQs Nearest Navaid
    notifyAction("createSheetsAddSvg");
    PdfPTable table = new PdfPTable(1);
    {/*from w ww . j a  v  a 2s .co  m*/
        PdfPCell cell = new PdfPCell();
        cell.setMinimumHeight(height);

        {
            Paragraph p = new Paragraph();
            com.lowagie.text.Font fontWarning = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                    com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD);
            p.add(new Chunk(" ", fontWarning));
            cell.addElement(p);
        }

        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsFakeShops(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheetsFakeShops");
    PdfPTable table = new PdfPTable(1);
    {/*from w  ww  .  j a  va2  s  .co m*/
        PdfPCell cell = new PdfPCell();

        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setMinimumHeight(20);

        boolean addWorker = false;
        for (final Runway runway : airport.getRunways()) {
            if (runway.getLength() > 1200 / FEET_PER_METER) {
                addWorker = true;
            }
        }

        boolean addFork = (airport.hasTower());

        Paragraph p = new Paragraph();
        p.setLeading((p.leading() / 2) + 4);
        if (addWorker) {
            try {
                p.add(new Chunk("   "));
                p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "avail_work.png")), 0,
                        -3));
            } catch (BadElementException ex) {
                Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        if (addFork) {
            try {
                p.add(new Chunk("   "));
                p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "avail_fork.png")), 0,
                        -3));
            } catch (BadElementException ex) {
                Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
            }
        }

        cell.addElement(p);

        //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_TOP);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsLights(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheetsLights");
    PdfPTable table = new PdfPTable(1);
    {/*from w  ww .ja va2  s  .  c o  m*/
        PdfPCell cell = new PdfPCell();

        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setMinimumHeight(20);

        Paragraph p = new Paragraph();
        p.setLeading((p.leading() / 2) + 4);
        com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 10,
                com.lowagie.text.Font.NORMAL);

        oneLightDone = false;

        try {
            p.add(new Chunk("   ", font));
            p.add(new Chunk(Image.getInstance(getClass().getResource(Main.imgFolder + "light.png")), 0, 0));
            p.add(new Chunk("   ", font));
        } catch (BadElementException ex) {
            Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
        }

        boolean addABN = airport.hasBeacon();
        if (addABN) {
            p.add(addOneLight("ABN", font));
        }

        boolean addALS = false;
        boolean addPAPI = false;
        for (final Runway runway : airport.getRunways()) {
            if ((runway.hasALSF_I(false) || runway.hasALSF_I(true))
                    || (runway.hasALSF_II(false) || runway.hasALSF_II(true))) {
                addALS = true;
            }

            if ((runway.hasPapi(false) || runway.hasPapi(true))) {
                addPAPI = true;
            }
        }
        if (addALS) {
            p.add(addOneLight("ALS", font));
        }

        if (addPAPI) {
            p.add(addOneLight("PAPI ", font));
            String separ = "";
            for (final Runway runway : airport.getRunways()) {
                if (runway.hasPapi(false)) {
                    p.add(new Chunk(separ + runway.getNumber() + " (3.5)" + degrees + " ", font));
                    separ = ", ";
                }
                if (runway.hasPapi(true)) {
                    p.add(new Chunk(separ + runway.getOppositeNumber() + " (3.5)" + degrees + " ", font));
                    separ = ", ";
                }
            }
        }

        cell.addElement(p);

        //cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheetsNotes(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheetsNotes");
    PdfPTable table = new PdfPTable(1);
    {/*from w  w w.  ja v  a 2  s .c  o  m*/
        PdfPCell cell = new PdfPCell();
        cell.setVerticalAlignment(Element.ALIGN_CENTER);

        {
            Paragraph p = new Paragraph();
            com.lowagie.text.Font fontWarning = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                    com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD);
            p.add(new Chunk("Warning !", fontWarning));
            cell.addElement(p);
        }

        {
            Paragraph p = new Paragraph();
            com.lowagie.text.Font fontText = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                    com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL);
            p.add(new Chunk(
                    "Do not use this chart in real life, this is a chart suitable to be used only for FlightGear !!!",
                    fontText));
            cell.addElement(p);
        }

        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_CENTER);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheets2Freqs(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheets2Freqs");
    PdfPTable table = new PdfPTable(2);
    {//  w ww  .  java 2  s . c o  m
        PdfPCell cell = new PdfPCell();
        {
            Paragraph p = new Paragraph("Within Airspace:", new com.lowagie.text.Font(
                    com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL));
            cell.addElement(p);
        }

        cell.setBorderWidth(borderWidth);

        cell.setBorderWidthBottom(borderWidthThin);

        //cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        table.addCell(cell);
    }

    {
        PdfPCell cell = new PdfPCell();

        com.lowagie.text.Font fontBold = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.BOLD);
        com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL);

        {
            Paragraph p = new Paragraph(airport.getId(), fontBold);
            cell.addElement(p);
        }
        {
            Paragraph p = new Paragraph();
            p.add(new Chunk("Elev ", font));

            int feets = (int) (airport.getElevation());
            p.add(new Chunk(new Integer(feets).toString() + "'", fontBold));
            int meters = (int) (feets / FEET_PER_METER);

            p.add(new Chunk("/" + new Integer(meters).toString() + "m", font));

            cell.addElement(p);
        }

        {
            Paragraph p = new Paragraph();
            p.add(new Chunk(airport.getLatitudeString1(airport.getLat(), "N", "S", 2, false) + "\r\n"
                    + airport.getLatitudeString1(airport.getLong(), "W", "E", 3, true), font));

            cell.addElement(p);
        }

        cell.setBorder(com.lowagie.text.Rectangle.NO_BORDER);
        cell.setVerticalAlignment(Element.ALIGN_BOTTOM);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:airportpainter.util.AirportPainter.java

License:Open Source License

private void createSheets2ILS(Airport airport, Document document) {
    // FREQs Nearest Navaid
    notifyAction("createSheets2ILS");
    PdfPTable table = new PdfPTable(2);
    {/*from   w  ww .  java  2 s  . co  m*/
        PdfPCell cell = new PdfPCell();
        {
            Paragraph p = new Paragraph("(TWR)", new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8,
                    com.lowagie.text.Font.NORMAL));
            p.setLeading((p.leading() / 2) + 2);
            cell.addElement(p);
        }

        List<ATCFreq> tempFreqsTwr = _airport.getATCFreqs("54");
        List<ATCFreq> tempFreqsGnd = _airport.getATCFreqs("53");
        if (tempFreqsTwr.size() > 0 || tempFreqsGnd.size() > 0) {

            if (tempFreqsTwr.size() > 0) {
                Paragraph p = new Paragraph();
                p.setLeading((p.leading() / 2) + 6);
                Chunk c = new Chunk(airport.getName().toUpperCase() + " APPROACH ", new com.lowagie.text.Font(
                        com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL));
                p.add(c);
                for (final ATCFreq tower : tempFreqsTwr) {
                    Chunk c2 = new Chunk((tower.getFreq() + "        ").substring(0, 9) + " ",
                            new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8,
                                    com.lowagie.text.Font.BOLD));
                    p.add(c2);

                }
                cell.addElement(p);

            }

            if (tempFreqsGnd.size() > 0) {
                Paragraph p = new Paragraph();
                p.setLeading((p.leading() / 2) + 6);
                Chunk c = new Chunk("GROUND ", new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8,
                        com.lowagie.text.Font.NORMAL));
                p.add(c);
                for (final ATCFreq tower : tempFreqsGnd) {
                    Chunk c2 = new Chunk((tower.getFreq() + "        ").substring(0, 9) + " ",
                            new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8,
                                    com.lowagie.text.Font.BOLD));
                    p.add(c2);

                }
                cell.addElement(p);

            }

        }

        cell.setBorderWidth(borderWidth);
        cell.setBorderWidthTop(borderWidthThin);
        cell.setBorderWidthRight(borderWidthThin);

        //cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        table.addCell(cell);
    }

    {
        com.lowagie.text.Font font = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN,
                com.lowagie.text.Font.DEFAULTSIZE, com.lowagie.text.Font.NORMAL);
        PdfPCell cell = new PdfPCell();

        Paragraph p = new Paragraph();
        p.setLeading((p.leading()) + 6);
        Chunk c = new Chunk("ATIS ",
                new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.NORMAL));
        p.add(c);

        for (final Atis atis : _airport.getAtises()) {
            Chunk c2 = new Chunk((atis.getFreq() + "        ").substring(0, 9) + " ", new com.lowagie.text.Font(
                    com.lowagie.text.Font.TIMES_ROMAN, 8, com.lowagie.text.Font.BOLD));
            p.add(c2);
        }

        cell.addElement(p);

        /// ILS table
        {
            height1 = 0;
            PdfPTable tableILS = new PdfPTable(4);
            tableILS.setWidthPercentage(100);

            // titles
            com.lowagie.text.Font fontTitle = new com.lowagie.text.Font(com.lowagie.text.Font.TIMES_ROMAN, 8,
                    com.lowagie.text.Font.NORMAL);
            {
                PdfPCell cellTitle = new PdfPCell();
                cellTitle.setVerticalAlignment(Element.ALIGN_CENTER);
                cellTitle.setBorderWidth(borderWidthThin);
                Paragraph pt = new Paragraph("RWY", fontTitle);
                pt.setLeading((pt.leading() / 2) + 2);
                pt.setAlignment(Element.ALIGN_CENTER);
                cellTitle.addElement(pt);
                tableILS.addCell(cellTitle);
            }
            {
                PdfPCell cellTitle = new PdfPCell();
                cellTitle.setVerticalAlignment(Element.ALIGN_CENTER);
                cellTitle.setBorderWidth(borderWidthThin);
                Paragraph pt = new Paragraph("ILS", fontTitle);
                pt.setLeading((pt.leading() / 2) + 2);
                pt.setAlignment(Element.ALIGN_CENTER);
                cellTitle.addElement(pt);
                tableILS.addCell(cellTitle);
            }
            {
                PdfPCell cellTitle = new PdfPCell();
                cellTitle.setVerticalAlignment(Element.ALIGN_CENTER);
                cellTitle.setBorderWidth(borderWidthThin);
                Paragraph pt = new Paragraph("RWY", fontTitle);
                pt.setLeading((pt.leading() / 2) + 2);
                pt.setAlignment(Element.ALIGN_CENTER);
                cellTitle.addElement(pt);
                tableILS.addCell(cellTitle);
            }
            {
                PdfPCell cellTitle = new PdfPCell();
                cellTitle.setVerticalAlignment(Element.ALIGN_CENTER);
                cellTitle.setBorderWidth(borderWidthThin);
                Paragraph pt = new Paragraph("ILS", fontTitle);
                pt.setLeading((pt.leading() / 2) + 2);
                pt.setAlignment(Element.ALIGN_CENTER);
                cellTitle.addElement(pt);
                tableILS.addCell(cellTitle);
            }

            int pos = 0;
            int rs = airport.getRunways().size();
            for (final Runway runway : airport.getRunways()) {
                if (runway.getIlsFreq() != 0) {
                    height1 = height1 + 10;
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph(runway.getNumber(), fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph(
                                runway.getIlsFreq() + " " + "... "
                                        + new Integer((int) runway.getHeading()).toString() + degrees,
                                fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }
                } /*else {
                  {
                      PdfPCell cellFreq = new PdfPCell();
                      cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                      cellFreq.setBorderWidth(borderWidthThin);
                      if (pos>0) {
                          cellFreq.setBorderWidthTop(0);
                      }
                      if (pos<rs-1) {
                          cellFreq.setBorderWidthBottom(0);
                      }
                          
                      Paragraph pt=new Paragraph( "",fontTitle);
                      pt.setLeading((pt.leading()/2)+2);
                      pt.setAlignment(Element.ALIGN_CENTER);
                      cellFreq.addElement(pt);
                      tableILS.addCell(cellFreq);
                  }
                  {
                      PdfPCell cellFreq = new PdfPCell();
                      cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                      cellFreq.setBorderWidth(borderWidthThin);
                      if (pos>0) {
                          cellFreq.setBorderWidthTop(0);
                      }
                      if (pos<rs-1) {
                          cellFreq.setBorderWidthBottom(0);
                      }
                          
                      Paragraph pt=new Paragraph( "",fontTitle);
                      pt.setLeading((pt.leading()/2)+2);
                      pt.setAlignment(Element.ALIGN_CENTER);
                      cellFreq.addElement(pt);
                      tableILS.addCell(cellFreq);
                  }
                          
                  }*/

                if (runway.getIlsOppositeFreq() != 0) {
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph(runway.getOppositeNumber(), fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph(runway.getIlsOppositeFreq() + " " + "... "
                                + new Integer((int) (runway.getHeading() + 180) % 180).toString() + degrees,
                                fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }
                } else {
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph("", fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }
                    {
                        PdfPCell cellFreq = new PdfPCell();
                        cellFreq.setVerticalAlignment(Element.ALIGN_CENTER);
                        cellFreq.setBorderWidth(borderWidthThin);
                        if (pos > 0) {
                            cellFreq.setBorderWidthTop(0);
                        }
                        if (pos < rs - 1) {
                            cellFreq.setBorderWidthBottom(0);
                        }

                        Paragraph pt = new Paragraph("", fontTitle);
                        pt.setLeading((pt.leading() / 2) + 2);
                        pt.setAlignment(Element.ALIGN_CENTER);
                        cellFreq.addElement(pt);
                        tableILS.addCell(cellFreq);
                    }

                }

                pos++;

            }

            float[] widths2 = { 1f, 3f, 1f, 3f };
            try {
                tableILS.setWidths(widths2);
            } catch (DocumentException ex) {
                Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
            }

            cell.addElement(tableILS);
        }

        cell.setBorderWidth(borderWidth);
        cell.setVerticalAlignment(Element.ALIGN_TOP);

        table.addCell(cell);
    }

    table.setWidthPercentage(100);
    try {
        document.add(table);
    } catch (DocumentException ex) {
        Logger.getLogger(AirportPainter.class.getName()).log(Level.SEVERE, null, ex);
    }
}

From source file:at.reppeitsolutions.formbuilder.components.pdf.itext.formbuilder.ITextInnerTable.java

License:Open Source License

private PdfPCell getCell() {
    PdfPCell cell = new PdfPCell();
    cell.setPadding(0);
    cell.setBorderWidth(0);
    return cell;
}

From source file:biblivre3.administration.reports.AllUsersReport.java

License:Open Source License

private final ArrayList<PdfPTable> createListTable(Map<String, List<String>> data) {
    try {/*from w  ww . j  a va 2  s  .  c o m*/
        ArrayList<PdfPTable> tabelas = new ArrayList<PdfPTable>();
        PdfPTable table = null;
        PdfPCell cell;
        for (String description : data.keySet()) {
            table = new PdfPTable(4);
            table.setWidthPercentage(100f);
            cell = new PdfPCell(new Paragraph(this.getHeaderChunk(description.toUpperCase())));
            cell.setColspan(4);
            cell.setBorder(PdfPCell.NO_BORDER);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
            table.addCell(cell);

            cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_NAME"))));
            cell.setBackgroundColor(headerBgColor);
            cell.setBorderWidth(headerBorderWidth);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
            table.addCell(cell);

            cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_ENROL"))));
            cell.setBackgroundColor(headerBgColor);
            cell.setBorderWidth(headerBorderWidth);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
            table.addCell(cell);

            cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_INSERTION_DATE"))));
            cell.setBackgroundColor(headerBgColor);
            cell.setBorderWidth(headerBorderWidth);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
            table.addCell(cell);

            cell = new PdfPCell(new Paragraph(this.getHeaderChunk(this.getText("REPORTS_UPDATE_DATE"))));
            cell.setBackgroundColor(headerBgColor);
            cell.setBorderWidth(headerBorderWidth);
            cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
            cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
            table.addCell(cell);

            for (String line : data.get(description)) {
                String[] dados = line.split("\t");
                //Nome
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[0])));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
                cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
                table.addCell(cell);

                //Matricula
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[1])));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
                table.addCell(cell);

                //Data de Inclusao
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[2])));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
                table.addCell(cell);

                //Data de Cancelamento/Alteracao
                cell = new PdfPCell(new Paragraph(this.getNormalChunk(dados[3])));
                cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
                cell.setVerticalAlignment(PdfPCell.ALIGN_MIDDLE);
                table.addCell(cell);
            }
            if (table != null) {
                tabelas.add(table);
            }
        }
        return tabelas;
    } catch (Exception e) {
        logger.error(e.getMessage(), e);
        return null;
    }
}