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.unitime.timetable.webutil.pdf.PdfInstructionalOfferingTableBuilder.java

License:Open Source License

private PdfPCell pdfSubjectAndCourseInfo(InstructionalOffering io, CourseOffering co) {
    PdfPCell cell = createCell();/*from  w  ww.  j  a  v  a2  s.  c om*/
    addText(cell, (co != null ? co.getSubjectAreaAbbv() + " " + co.getCourseNbr() : "")
            + (co != null && co.getCourseType() != null ? " (" + co.getCourseType().getReference() + ")" : ""),
            true, false, Element.ALIGN_LEFT, (co.isIsControl().booleanValue() ? sEnableColor : sDisableColor),
            true);
    for (Iterator it = io
            .courseOfferingsMinusSortCourseOfferingForSubjectArea(co.getSubjectArea().getUniqueId())
            .iterator(); it.hasNext();) {
        CourseOffering tempCo = (org.unitime.timetable.model.CourseOffering) it.next();
        addText(cell, indent + "" + tempCo.getSubjectAreaAbbv() + " " + tempCo.getCourseNbr() + " "
                + (tempCo.getCourseType() != null ? " (" + tempCo.getCourseType().getReference() + ")" : ""),
                false, false, Element.ALIGN_LEFT, sDisableColor, true);
    }
    return cell;
}

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

License:Open Source License

protected PdfPCell pdfBuildPrefGroupLabel(CourseOffering co, PreferenceGroup prefGroup, String indentSpaces,
        boolean isEditable, String prevLabel) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    String label = prefGroup.toString();
    if (prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        label = aClass.getClassLabel(co);
    }//from  w  ww.j a  v a  2s. c o m
    if (prevLabel != null && label.equals(prevLabel)) {
        label = "";
    }
    PdfPCell cell = createCell();
    addText(cell, indentSpaces + label, false, false, Element.ALIGN_LEFT, color, true);
    return cell;
}

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

License:Open Source License

private PdfPCell pdfBuildTimePrefCell(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    Assignment a = null;//  w  w w .j  a v  a  2s  . c o  m
    if (getDisplayTimetable() && isShowTimetable() && classAssignment != null && prefGroup instanceof Class_) {
        try {
            a = classAssignment.getAssignment((Class_) prefGroup);
        } catch (Exception e) {
            Debug.error(e);
        }
    }

    PdfPCell cell = createCell();

    for (Iterator i = prefGroup.effectivePreferences(TimePref.class).iterator(); i.hasNext();) {
        TimePref tp = (TimePref) i.next();
        RequiredTimeTable rtt = tp.getRequiredTimeTable(a == null ? null : a.getTimeLocation());
        if (getGridAsText()) {
            addText(cell, rtt.getModel().toString().replaceAll(", ", "\n"), false, false, Element.ALIGN_LEFT,
                    color, true);
        } else {
            try {
                rtt.getModel().setDefaultSelection(getDefaultTimeGridSize());
                if (rtt.getModel().isExactTime()) {
                    addText(cell, rtt.exactTime(false), false, false, Element.ALIGN_LEFT, color, true);
                } else {
                    java.awt.Image awtImage = rtt.createBufferedImage(getTimeVertival());
                    Image img = Image.getInstance(awtImage, Color.WHITE);
                    Chunk ck = new Chunk(img, 0, 0);
                    if (cell.getPhrase() == null) {
                        cell.setPhrase(new Paragraph(ck));
                        cell.setVerticalAlignment(Element.ALIGN_TOP);
                        cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    } else {
                        cell.getPhrase().add(ck);
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    return cell;

}

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

License:Open Source License

private PdfPCell pdfBuildPreferenceCell(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        Class prefType, boolean isEditable) {
    if (!isEditable)
        return createCell();
    Color color = (isEditable ? sEnableColor : sDisableColor);

    if (TimePref.class.equals(prefType)) {
        return pdfBuildTimePrefCell(classAssignment, prefGroup, isEditable);
    } else if (DistributionPref.class.equals(prefType)) {
        PdfPCell cell = createCell();/*from   w  ww .ja v  a  2 s .  c om*/
        for (Iterator i = prefGroup.effectivePreferences(prefType).iterator(); i.hasNext();) {
            DistributionPref pref = (DistributionPref) i.next();
            addText(cell,
                    PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog()) + " "
                            + pref.preferenceText(true, true, " (", ", ", ")").replaceAll("&lt;", "<")
                                    .replaceAll("&gt;", ">"),
                    false, false, Element.ALIGN_LEFT,
                    (!isEditable ? color : pref.getPrefLevel().awtPrefcolor()), true);
        }
        return cell;
    } else {
        PdfPCell cell = createCell();
        for (Iterator i = prefGroup.effectivePreferences(prefType).iterator(); i.hasNext();) {
            Preference pref = (Preference) i.next();
            addText(cell,
                    PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog()) + " "
                            + pref.preferenceText(),
                    false, false, Element.ALIGN_LEFT,
                    (!isEditable ? color : pref.getPrefLevel().awtPrefcolor()), true);
        }
        return cell;
    }

}

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

License:Open Source License

private PdfPCell pdfBuildPreferenceCell(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup,
        Class[] prefTypes, boolean isEditable) {
    if (!isEditable)
        return createCell();
    Color color = (isEditable ? sEnableColor : sDisableColor);

    PdfPCell cell = createCell();//from  w ww .j  a v  a2 s  .c o  m
    boolean noRoomPrefs = false;
    if (prefGroup instanceof Class_ && ((Class_) prefGroup).getNbrRooms().intValue() == 0) {
        noRoomPrefs = true;
    }
    if (prefGroup instanceof SchedulingSubpart
            && ((SchedulingSubpart) prefGroup).getInstrOfferingConfig().isUnlimitedEnrollment().booleanValue())
        noRoomPrefs = true;
    for (int i = 0; i < prefTypes.length; i++) {
        Class prefType = prefTypes[i];
        if (noRoomPrefs) {
            if (//prefType.equals(RoomPref.class) || 
            prefType.equals(RoomGroupPref.class) || prefType.equals(RoomFeaturePref.class)
                    || prefType.equals(BuildingPref.class))
                continue;
        }
        for (Iterator j = prefGroup.effectivePreferences(prefType).iterator(); j.hasNext();) {
            Preference pref = (Preference) j.next();
            addText(cell,
                    PreferenceLevel.prolog2abbv(pref.getPrefLevel().getPrefProlog()) + " "
                            + pref.preferenceText(),
                    false, false, Element.ALIGN_LEFT,
                    (!isEditable ? color : pref.getPrefLevel().awtPrefcolor()), true);
        }
    }
    if (noRoomPrefs && cell.getPhrase() == null)
        addText(cell, "N/A", false, true, Element.ALIGN_LEFT, color, true);
    return cell;
}

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

License:Open Source License

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

    if (prefGroup instanceof Class_) {
        Class_ aClass = (Class_) prefGroup;
        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());
            boolean italic = !aClass.isDisplayInstructor().booleanValue();
            boolean bold = ci.isLead().booleanValue();
            addText(cell, label, bold, italic, Element.ALIGN_LEFT, color, true);
        }
    }

    return cell;
}

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

License:Open Source License

private PdfPCell pdfBuildCredit(PreferenceGroup prefGroup, boolean isEditable) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();// w  w w  . j av  a2s .c  o  m

    if (prefGroup instanceof SchedulingSubpart) {
        SchedulingSubpart ss = (SchedulingSubpart) prefGroup;
        if (ss.getCredit() != null) {
            addText(cell, ss.getCredit().creditAbbv(), false, false, Element.ALIGN_LEFT, color, true);
        }
    }

    return cell;
}

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

License:Open Source License

private PdfPCell pdfBuildSchedulePrintNote(PreferenceGroup prefGroup, boolean isEditable, UserContext user) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();/*from  w  w  w  .  j  a  va 2 s  .  c o m*/

    if (prefGroup instanceof Class_) {
        Class_ c = (Class_) prefGroup;
        if (c.getSchedulePrintNote() != null) {
            if (c.getSchedulePrintNote().length() <= 20 || user == null || CommonValues.NoteAsFullText
                    .eq(user.getProperty(UserProperty.SchedulePrintNoteDisplay))) {
                addText(cell, c.getSchedulePrintNote(), false, false, Element.ALIGN_LEFT, color, true);
            } else {
                addText(cell, c.getSchedulePrintNote().substring(0, 20) + "...", false, false,
                        Element.ALIGN_LEFT, color, true);
            }
        }
    }

    return cell;
}

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

License:Open Source License

private PdfPCell pdfBuildSchedulePrintNote(InstructionalOffering io, boolean isEditable, UserContext user) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();// w w  w  .  j av  a2  s. c o  m

    StringBuffer note = new StringBuffer("");
    Set s = io.getCourseOfferings();
    for (Iterator i = s.iterator(); i.hasNext();) {
        CourseOffering coI = (CourseOffering) i.next();
        if (coI.getScheduleBookNote() != null && coI.getScheduleBookNote().trim().length() > 0) {
            if (note.length() > 0)
                note.append("\n");
            if (coI.getScheduleBookNote().length() <= 20 || Constants.showCrsOffrAsFullText(user)) {
                note.append(coI.getScheduleBookNote());
            } else {
                note.append(coI.getScheduleBookNote().substring(0, 20) + "...");
            }
        }
    }

    addText(cell, note.toString(), false, false, Element.ALIGN_LEFT, color, true);
    return (cell);
}

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

License:Open Source License

private PdfPCell pdfBuildNote(PreferenceGroup prefGroup, boolean isEditable, UserContext user) {
    Color color = (isEditable ? sEnableColor : sDisableColor);
    PdfPCell cell = createCell();/*from w  w w.  ja  v a  2 s.  c  o m*/

    if (prefGroup instanceof Class_) {
        Class_ c = (Class_) prefGroup;
        if (c.getNotes() != null) {
            if (c.getNotes().length() <= 30 || user == null
                    || CommonValues.NoteAsFullText.eq(user.getProperty(UserProperty.ManagerNoteDisplay))) {
                addText(cell, c.getNotes(), false, false, Element.ALIGN_LEFT, color, true);
            } else {
                addText(cell, c.getNotes().substring(0, 30) + "...", false, false, Element.ALIGN_LEFT, color,
                        true);
            }
        }
    }

    return cell;
}