Example usage for com.lowagie.text Element ALIGN_LEFT

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

Introduction

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

Prototype

int ALIGN_LEFT

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

Click Source Link

Document

A possible value for paragraph alignment.

Usage

From source file:org.tellervo.desktop.print.SeriesReport.java

License:Open Source License

/**
 * Get PdfPTable containing the ring width data for this series
 * //from  ww  w . j a v a 2s . com
 * @return PdfPTable
 * @throws DocumentException 
 * @throws IOException 
 * @throws MalformedURLException 
 */
private void getDataTable(Boolean wj) throws DocumentException, MalformedURLException, IOException {
    // THE actual table
    PdfPTable mainTable = new PdfPTable(11);
    // Cell for column headers
    PdfPCell colHeadCell = new PdfPCell();
    // Model for data
    DecadalModel model;
    // Flag to show if there are *any* ring remarks
    Boolean hasRemarks = false;

    float[] columnWidths = new float[] { 20f, 8f, 8f, 8f, 8f, 8f, 8f, 8f, 8f, 8f, 8f };
    mainTable.setWidths(columnWidths);
    mainTable.setWidthPercentage(100f);

    if (wj == true) {
        if (s.hasWeiserjahre() == true) {
            model = new WJTableModel(s);
            document.add(new Chunk("Weiserjahre:", subSubSectionFont));
        } else {
            return;
        }
    } else {
        model = new UnitAwareDecadalModel(s);
        document.add(new Chunk("Ring widths:", subSubSectionFont));
    }

    int rows = model.getRowCount();

    // Do column headers
    if (wj == true) {
        colHeadCell.setPhrase(new Phrase("inc/dec", tableHeaderFont));
    } else if (this.s.getTridasUnits() == null) {
        // Unitless
        colHeadCell.setPhrase(new Phrase(" ", tableHeaderFont));
    } else {
        // Normal tridas units
        try {
            /*if(this.s.getTridasUnits().getNormalTridas().equals(NormalTridasUnit.MICROMETRES))
            {
               colHeadCell.setPhrase(new Phrase("microns", tableHeaderFont));
            }*/

            // Use the current default display units

            colHeadCell.setPhrase(new Phrase(displayUnits.value(), tableHeaderFont));

            /*if(displayUnits.equals(NormalTridasUnit.MICROMETRES))
            {
               colHeadCell.setPhrase(new Phrase("microns", tableHeaderFont));
            }
            else if(displayUnits.equals(NormalTridasUnit.HUNDREDTH_MM))
            {
               colHeadCell.setPhrase(new Phrase("1/100th mm", tableHeaderFont));
            }
            */

        } catch (Exception e) {
            colHeadCell.setPhrase(new Phrase(" ", tableHeaderFont));
        }
    }
    colHeadCell.setBorderWidthBottom(headerLineWidth);
    colHeadCell.setBorderWidthTop(headerLineWidth);
    colHeadCell.setBorderWidthLeft(headerLineWidth);
    colHeadCell.setBorderWidthRight(headerLineWidth);
    mainTable.addCell(colHeadCell);
    for (int i = 0; i < 10; i++) {
        colHeadCell.setPhrase(new Phrase(Integer.toString(i), tableHeaderFont));
        colHeadCell.setHorizontalAlignment(Element.ALIGN_CENTER);
        colHeadCell.setBorderWidthBottom(headerLineWidth);
        colHeadCell.setBorderWidthTop(headerLineWidth);
        colHeadCell.setBorderWidthLeft(lineWidth);
        colHeadCell.setBorderWidthRight(lineWidth);

        if (i == 0)
            colHeadCell.setBorderWidthLeft(headerLineWidth);
        if (i == 9)
            colHeadCell.setBorderWidthRight(headerLineWidth);
        mainTable.addCell(colHeadCell);
    }

    // Loop through rows
    for (int row = 0; row < rows; row++) {
        // Loop through columns
        for (int col = 0; col < 11; col++) {
            // Mini table to hold remark icons
            PdfPTable remarksMiniTable = new PdfPTable(3);
            float[] widths = { 0.3f, 0.3f, 0.6f };
            remarksMiniTable.setWidths(widths);
            remarksMiniTable.setWidthPercentage(100);

            // Get ring value or year number for first column
            Phrase cellValuePhrase = null;
            Object value = model.getValueAt(row, col);
            if (value == null) {
                cellValuePhrase = new Phrase("");
            } else {
                /*if(displayUnits.equals(NormalTridasUnit.HUNDREDTH_MM))
                {
                   try{
                   Integer val = (Integer) value;
                   val =val/10;
                   cellValuePhrase = new Phrase(String.valueOf(val), getTableFont(col));
                   } catch (Exception e){
                      cellValuePhrase = new Phrase(value.toString(), getTableFont(col));
                        
                   }
                }
                else if(displayUnits.equals(NormalTridasUnit.FIFTIETH_MM))
                {
                   try{
                   Integer val = (Integer) value;
                   val =val/20;
                   cellValuePhrase = new Phrase(String.valueOf(val), getTableFont(col));
                   } catch (Exception e){
                      cellValuePhrase = new Phrase(value.toString(), getTableFont(col));
                        
                   }               
                }
                else if(displayUnits.equals(NormalTridasUnit.TWENTIETH_MM))
                {
                   try{
                   Integer val = (Integer) value;
                   val =val/50;
                   cellValuePhrase = new Phrase(String.valueOf(val), getTableFont(col));
                   } catch (Exception e){
                      cellValuePhrase = new Phrase(value.toString(), getTableFont(col));
                        
                   }               
                }
                else if(displayUnits.equals(NormalTridasUnit.TENTH_MM))
                {
                   try{
                   Integer val = (Integer) value;
                   val =val/100;
                   cellValuePhrase = new Phrase(String.valueOf(val), getTableFont(col));
                   } catch (Exception e){
                      cellValuePhrase = new Phrase(value.toString(), getTableFont(col));
                        
                   }               
                }
                else if(displayUnits.equals(NormalTridasUnit.MICROMETRES))
                {*/
                cellValuePhrase = new Phrase(value.toString(), getTableFont(col));
                //}
            }

            // Get any remarks and compile them into a mini table
            org.tellervo.desktop.Year year = model.getYear(row, col);
            List<TridasRemark> remarksList = null;
            remarksList = s.getRemarksForYear(year);

            // If there are remarks, cycle through them adding cells to the mini table
            if (col != 0 && remarksList.size() > 0) {
                hasRemarks = true;
                // Get icons for remarks
                int cellnum = 1;
                int remarknum = 0;
                for (TridasRemark remark : remarksList) {
                    // Keep track of which remark we are on.
                    remarknum++;
                    // String for holding remark name for debugging
                    String remstr = "?";
                    // The actual remark icon
                    Image icon = null;
                    // A table cell for the remark
                    PdfPCell remarkCell = new PdfPCell();

                    // Set default attributes for remark and value cells
                    remarkCell.setBorderWidthBottom(0);
                    remarkCell.setBorderWidthTop(0);
                    remarkCell.setBorderWidthLeft(0);
                    remarkCell.setBorderWidthRight(0);
                    remarkCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
                    remarkCell.setPadding(0);
                    remarkCell.setUseBorderPadding(true);

                    // A table cell for the ring width value
                    PdfPCell valueCell = new PdfPCell();
                    valueCell = remarkCell;

                    // Get actual icon (either tridas or tellervo)
                    if (remark.isSetNormalTridas()) {
                        remstr = remark.getNormalTridas().toString();
                        icon = getTridasIcon(remark.getNormalTridas());
                        if (icon == null)
                            icon = Builder.getITextImageMissingIcon();
                    } else if (TELLERVO.equals(remark.getNormalStd())) {
                        remstr = remark.getNormal();
                        icon = getCorinaIcon(remark.getNormal());
                        if (icon == null)
                            icon = Builder.getITextImageMissingIcon();
                    } else {
                        if (remark.isSetValue()) {
                            remstr = remark.getValue();
                        } else if (remark.isSetNormal()) {
                            remstr = remark.getNormal();
                        } else {
                            remstr = "Unknown";
                        }
                        icon = Builder.getITextImageIcon("user.png");

                    }

                    // Print debug info for this remark
                    String errStr = "Getting icon for " + remstr + " for year " + year.toString()
                            + "(cell value = " + cellnum + ")";
                    System.out.print(errStr);

                    // Shrink the icon a bit
                    icon.scalePercent(20);

                    // Add icon to minitable
                    remarkCell.addElement(icon);
                    remarksMiniTable.addCell(remarkCell);
                    cellnum++;

                    if (cellnum == 1 && remarksList.size() < cellnum) {
                        // First cell and no remark so print blank
                        valueCell.setPhrase(new Phrase(""));
                        remarksMiniTable.addCell(valueCell);
                        cellnum++;
                    }
                    if (cellnum == 2 && remarksList.size() < cellnum) {
                        // Second cell and no remark so print blank
                        valueCell.setPhrase(new Phrase(""));
                        remarksMiniTable.addCell(valueCell);
                        cellnum++;
                    }
                    if (cellnum == 3) {
                        // In third cell so print value
                        valueCell.setPhrase(cellValuePhrase);
                        remarksMiniTable.addCell(valueCell);
                        cellnum++;
                    } else if (cellnum % 3 == 0) {
                        // In third column so print blank
                        valueCell.setPhrase(new Phrase(""));
                        remarksMiniTable.addCell(valueCell);
                        cellnum++;
                    }

                    if (remarknum == remarksList.size()) {
                        valueCell.setPhrase(new Phrase(""));
                        remarksMiniTable.addCell(valueCell);
                        remarksMiniTable.addCell(valueCell);
                    }

                    remarkCell = null;
                    valueCell = null;
                }
            } else {
                // No remarks so make mini table have blank, blank, value

                // Create blank and value cells
                PdfPCell blankCell = new PdfPCell();
                PdfPCell valueCell = new PdfPCell();

                // Set up style
                blankCell.setBorderWidthBottom(0);
                blankCell.setBorderWidthTop(0);
                blankCell.setBorderWidthLeft(0);
                blankCell.setBorderWidthRight(0);
                blankCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
                blankCell.setPadding(0);
                blankCell.setUseBorderPadding(true);
                valueCell = blankCell;

                // Add cells to mini table
                remarksMiniTable.addCell(blankCell);
                remarksMiniTable.addCell(blankCell);
                valueCell.setPhrase(cellValuePhrase);
                remarksMiniTable.addCell(valueCell);
            }

            // Set border styles depending on where we are in the table

            // Defaults
            PdfPCell mainTableCell = new PdfPCell();
            mainTableCell.setBorderWidthBottom(lineWidth);
            mainTableCell.setBorderWidthTop(lineWidth);
            mainTableCell.setBorderWidthLeft(lineWidth);
            mainTableCell.setBorderWidthRight(lineWidth);
            mainTableCell.setHorizontalAlignment(Element.ALIGN_RIGHT);

            // Row headers
            if (col == 0) {
                mainTableCell.setHorizontalAlignment(Element.ALIGN_LEFT);
                mainTableCell.setBorderWidthLeft(headerLineWidth);
                mainTableCell.setBorderWidthRight(headerLineWidth);
            }

            // First data column
            if (col == 1) {
                mainTableCell.setBorderWidthLeft(headerLineWidth);
            }

            // Last data column
            if (col == 10) {
                mainTableCell.setBorderWidthRight(headerLineWidth);
            }

            // Last row
            if (row == model.getRowCount() - 1) {
                mainTableCell.setBorderWidthBottom(headerLineWidth);
            }

            // Write mini table to cell       
            mainTableCell.addElement(remarksMiniTable);

            //mainTableCell.addElement(userRemarksMiniTable);

            // Write cell to main table
            mainTable.addCell(mainTableCell);

        }
    }

    // Add table to document
    document.add(mainTable);

    if (!wj && hasRemarks)
        getTableKey();
}

From source file:org.unitime.timetable.export.PDFPrinter.java

License:Open Source License

@Override
public void printHeader(String... fields) {
    iTable = new PdfPTable(fields.length - iHiddenColumns.size());
    iMaxWidth = new float[fields.length];
    iTable.setHeaderRows(1);//from  w  w w  .ja  va 2  s . co m
    iTable.setWidthPercentage(100);

    for (int idx = 0; idx < fields.length; idx++) {
        if (iHiddenColumns.contains(idx))
            continue;
        String f = fields[idx];

        PdfPCell cell = new PdfPCell();
        cell.setBorder(Rectangle.BOTTOM);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setHorizontalAlignment(Element.ALIGN_LEFT);

        Font font = PdfFont.getFont(true);
        cell.addElement(new Chunk(f, font));
        iTable.addCell(cell);

        float width = 0;
        if (f.indexOf('\n') >= 0) {
            for (StringTokenizer s = new StringTokenizer(f, "\n"); s.hasMoreTokens();)
                width = Math.max(width, font.getBaseFont().getWidthPoint(s.nextToken(), font.getSize()));
        } else
            width = Math.max(width, font.getBaseFont().getWidthPoint(f, font.getSize()));
        iMaxWidth[idx] = width;
    }
}

From source file:org.unitime.timetable.export.PDFPrinter.java

License:Open Source License

@Override
public void printLine(String... fields) {
    PdfPCellEvent setLineDashEvent = new PdfPCellEvent() {
        @Override/*from  w  w  w.ja v a 2s .  c o m*/
        public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) {
            PdfContentByte cb = canvas[PdfPTable.LINECANVAS];
            cb.setLineDash(new float[] { 2, 2 }, 0);
        }
    };

    for (int idx = 0; idx < fields.length; idx++) {
        if (iHiddenColumns.contains(idx))
            continue;
        String f = fields[idx];
        if (f == null || f.isEmpty() || (iCheckLast
                && f.equals(iLastLine == null || idx >= iLastLine.length ? null : iLastLine[idx])))
            f = "";

        boolean number = sNumber.matcher(f).matches();

        Font font = PdfFont.getFont();
        Phrase p = new Phrase(f, PdfFont.getSmallFont());

        PdfPCell cell = new PdfPCell(p);
        cell.setBorder(iLastLine == null ? Rectangle.TOP : Rectangle.NO_BORDER);
        cell.setVerticalAlignment(Element.ALIGN_TOP);
        cell.setHorizontalAlignment(number ? Element.ALIGN_RIGHT : Element.ALIGN_LEFT);
        cell.setPaddingBottom(4f);
        cell.setCellEvent(setLineDashEvent);
        if (number)
            cell.setPaddingRight(10f);
        iTable.addCell(cell);

        float width = 0;
        if (f.indexOf('\n') >= 0) {
            for (StringTokenizer s = new StringTokenizer(f, "\n"); s.hasMoreTokens();)
                width = Math.max(width, font.getBaseFont().getWidthPoint(s.nextToken(), font.getSize()));
        } else
            width = Math.max(width, font.getBaseFont().getWidthPoint(f, font.getSize()));
        iMaxWidth[idx] = Math.max(iMaxWidth[idx], width + (number ? 10 : 0));
    }
    iLastLine = fields;
}

From source file:org.unitime.timetable.webutil.pdf.PdfClassAssignmentReportListTableBuilder.java

License:Open Source License

@Override
protected PdfPCell pdfBuildInstructor(PreferenceGroup prefGroup, boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();//from www. ja v  a 2  s  . co m

    if (prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        if (aClass.isDisplayInstructor()) {
            TreeSet sortedInstructors = new TreeSet(new InstructorComparator());
            sortedInstructors.addAll(aClass.getClassInstructors());
            for (Iterator i = sortedInstructors.iterator(); i.hasNext();) {
                ClassInstructor ci = (ClassInstructor) i.next();
                String label = ci.getInstructor().getName(getInstructorNameFormat());
                addText(cell, label, false, false, Element.ALIGN_LEFT, color, true);
            }
        }
    }

    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfClassListTableBuilder.java

License:Open Source License

protected PdfPCell pdfBuildPrefGroupLabel(CourseOffering co, PreferenceGroup prefGroup, String indentSpaces,
        boolean isEditable, String prevLabel) {
    if (prefGroup instanceof Class_) {
        Color color = (isEditable ? Color.BLACK : Color.GRAY);
        String label = prefGroup.toString();
        Class_ aClass = (Class_) prefGroup;
        label = aClass.getClassLabel(co);
        if (prevLabel != null && label.equals(prevLabel)) {
            label = "";
        }/*  w  w w . j  a v  a2 s  . co  m*/
        PdfPCell cell = createCell();
        addText(cell, indentSpaces + label, co.isIsControl(), false, Element.ALIGN_LEFT, color, true);
        return cell;
    } else
        return super.pdfBuildPrefGroupLabel(co, prefGroup, indentSpaces, isEditable, null);
}

From source file:org.unitime.timetable.webutil.pdf.PdfEventTableBuilder.java

License:Open Source License

public void addText(PdfPCell cell, String text) {
    addText(cell, text, false, iTextItalic, Element.ALIGN_LEFT, iTextColor, true);
}

From source file:org.unitime.timetable.webutil.pdf.PdfEventTableBuilder.java

License:Open Source License

protected void pdfBuildTableHeader(boolean events, boolean mainContact, int numEventsOrMeetings) {
    if (events) {
        PdfPCell c;//  w ww  .ja  v  a  2 s . c om
        if (numEventsOrMeetings > getMaxResults()) {
            c = createCell();
            addText(c,
                    "**Warning: More than " + getMaxResults()
                            + " events match your search criteria. Only the first " + getMaxResults()
                            + " events are displayed. Please, redefine the search criteria in your filter.",
                    true, Element.ALIGN_LEFT);
            c.setColspan(mainContact ? 6 : 5);
            iPdfTable.addCell(c);
        }
        iBgColor = new Color(224, 224, 224);
        //first line
        c = createCell();
        addText(c, LABEL, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, ENROLLMENT, true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, EVENT_CAPACITY, true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, SPONSORING_ORG, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, EVENT_TYPE, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        if (mainContact) {
            c = createCell();
            addText(c, MAIN_CONTACT, true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
        //second line
        iBgColor = new Color(244, 244, 244);
        iUnderline = true;
        c = createCell();
        iPdfTable.addCell(c);
        c = createCell();
        c.setColspan(2);
        addText(c, MEETING_DATE, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, MEETING_TIME, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, MEETING_LOCATION, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        if (mainContact) {
            c = createCell();
            addText(c, APPROVED_DATE, true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
        if (numEventsOrMeetings <= getMaxResults()) {
            iPdfTable.setHeaderRows(2);
        } else {
            iPdfTable.setHeaderRows(3);
        }
    } else {
        PdfPCell c;
        if (numEventsOrMeetings > getMaxResults()) {
            c = createCell();
            addText(c,
                    "**Warning: More than " + getMaxResults()
                            + " meetings match your search criteria. Only the first " + getMaxResults()
                            + " meetings are displayed. Please, redefine the search criteria in your filter.",
                    true, Element.ALIGN_LEFT);
            c.setColspan(mainContact ? 10 : 9);
            iPdfTable.addCell(c);
        }
        iBgColor = new Color(224, 224, 224);
        //first line
        iUnderline = true;
        c = createCell();
        addText(c, LABEL, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, EVENT_TYPE, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, (mainContact ? "Enrl." : ENROLLMENT), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, (mainContact ? "Cap." : EVENT_CAPACITY), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, SPONSORING_ORG, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, MEETING_DATE, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, MEETING_TIME, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        c = createCell();
        addText(c, MEETING_LOCATION, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
        if (mainContact) {
            c = createCell();
            addText(c, MAIN_CONTACT, true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
            c = createCell();
            addText(c, APPROVED_DATE, true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
        if (numEventsOrMeetings <= getMaxResults()) {
            iPdfTable.setHeaderRows(1);
        } else {
            iPdfTable.setHeaderRows(2);
        }

    }
    iBgColor = Color.WHITE;
    iUnderline = false;
}

From source file:org.unitime.timetable.webutil.pdf.PdfEventTableBuilder.java

License:Open Source License

private PdfPCell pdfBuildEventName(Event e) {
    PdfPCell cell = createCell();/* ww  w  . j av  a 2s . c o  m*/
    addText(cell, e.getEventName() == null ? "" : e.getEventName(), true, Element.ALIGN_LEFT);
    return cell;
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

public void addText(PdfPCell cell, String text) {
    addText(cell, text, false, false, Element.ALIGN_LEFT, sEnableColor, true);
}

From source file:org.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

protected void pdfBuildTableHeader(Long sessionId) {
    iBgColor = sBgColorHeader;//  w  ww .  j a va 2 s  .  co m
    //first line
    if (isShowLabel()) {
        PdfPCell c = createCell();
        addText(c, LABEL, true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowDivSec()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnExternalId(), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
    }
    if (isShowDemand()) {
        PdfPCell c = createCell();
        if (StudentClassEnrollment.sessionHasEnrollments(sessionId)) {
            addText(c, MSG.columnDemand(), true, Element.ALIGN_RIGHT);
        } else {
            addText(c, MSG.columnLastDemand(), true, Element.ALIGN_RIGHT);
        }
        iPdfTable.addCell(c);
    }
    if (isShowProjectedDemand()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnProjectedDemand(), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
    }
    if (isShowLimit()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnLimit(), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
    }
    if (isShowRoomRatio()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnRoomRatio(), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
    }
    if (isShowManager()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnManager(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowDatePattern()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnDatePattern(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowMinPerWk()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnMinPerWk(), true, Element.ALIGN_RIGHT);
        iPdfTable.addCell(c);
    }
    if (isShowTimePattern()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnTimePattern(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowPreferences()) {
        PdfPCell c = createCell();
        c.setColspan(PREFERENCE_COLUMN_ORDER.length + (getDisplayDistributionPrefs() ? 0 : -1));
        addText(c, "----" + MSG.columnPreferences() + "----", true, Element.ALIGN_CENTER);
        iPdfTable.addCell(c);
    }
    if (isShowInstructor()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnInstructor(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (getDisplayTimetable() && isShowTimetable()) {
        PdfPCell c = createCell();
        c.setColspan(TIMETABLE_COLUMN_ORDER.length);
        addText(c, "--------" + MSG.columnTimetable() + "--------", true, Element.ALIGN_CENTER);
        iPdfTable.addCell(c);
    }
    if (isShowTitle()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnTitle(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowCredit()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnOfferingCredit(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowSubpartCredit()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnSubpartCredit(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowConsent()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnConsent(), true, Element.ALIGN_CENTER);
        iPdfTable.addCell(c);
    }
    if (isShowSchedulePrintNote()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnSchedulePrintNote(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowNote()) {
        PdfPCell c = createCell();
        addText(c, MSG.columnNote(), true, Element.ALIGN_LEFT);
        iPdfTable.addCell(c);
    }
    if (isShowExam()) {
        PdfPCell c = createCell();
        c.setColspan((isShowExamName() ? 1 : 0) + (isShowExamTimetable() ? 2 : 0));
        addText(c, "--------" + MSG.columnExam() + "--------", true, Element.ALIGN_CENTER);
        iPdfTable.addCell(c);
    }

    //second line
    if (isShowLabel()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowDivSec()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowDemand()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowProjectedDemand()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowLimit()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowRoomRatio()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowManager()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowDatePattern()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowMinPerWk()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowTimePattern()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowPreferences()) {
        for (int j = 0; j < PREFERENCE_COLUMN_ORDER.length + (getDisplayDistributionPrefs() ? 0 : -1); j++) {
            PdfPCell c = createCell();
            c.setBorderWidthBottom(1);
            addText(c, PREFERENCE_COLUMN_ORDER[j], true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
    }
    if (isShowInstructor()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (getDisplayTimetable() && isShowTimetable()) {
        for (int j = 0; j < TIMETABLE_COLUMN_ORDER.length; j++) {
            PdfPCell c = createCell();
            c.setBorderWidthBottom(1);
            addText(c, TIMETABLE_COLUMN_ORDER[j], true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
    }
    if (isShowTitle()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowCredit()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowSubpartCredit()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowConsent()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowSchedulePrintNote()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowNote()) {
        PdfPCell c = createCell();
        c.setBorderWidthBottom(1);
        iPdfTable.addCell(c);
    }
    if (isShowExam()) {
        if (isShowExamName()) {
            PdfPCell c = createCell();
            c.setBorderWidthBottom(1);
            addText(c, MSG.columnExamName(), true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
        if (isShowExamTimetable()) {
            PdfPCell c = createCell();
            c.setBorderWidthBottom(1);
            addText(c, MSG.columnExamPeriod(), true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
            c = createCell();
            c.setBorderWidthBottom(1);
            addText(c, MSG.columnExamRoom(), true, Element.ALIGN_LEFT);
            iPdfTable.addCell(c);
        }
    }
    iPdfTable.setHeaderRows(2);
}