本文整理匯總了Java中com.lowagie.text.Element類的典型用法代碼示例。如果您正苦於以下問題:Java Element類的具體用法?Java Element怎麽用?Java Element使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Element類屬於com.lowagie.text包,在下文中一共展示了Element類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: drawLine
import com.lowagie.text.Element; //導入依賴的package包/類
/**
* Draws a horizontal line.
* @param canvas the canvas to draw on
* @param leftX the left x coordinate
* @param rightX the right x coordindate
* @param y the y coordinate
*/
public void drawLine(PdfContentByte canvas, float leftX, float rightX, float y) {
float w;
if (getPercentage() < 0)
w = -getPercentage();
else
w = (rightX - leftX) * getPercentage() / 100.0f;
float s;
switch (getAlignment()) {
case Element.ALIGN_LEFT:
s = 0;
break;
case Element.ALIGN_RIGHT:
s = rightX - leftX - w;
break;
default:
s = (rightX - leftX - w) / 2;
break;
}
canvas.setLineWidth(getLineWidth());
if (getLineColor() != null)
canvas.setColorStroke(getLineColor());
canvas.moveTo(s + leftX, y + offset);
canvas.lineTo(s + w + leftX, y + offset);
canvas.stroke();
}
示例2: createCell
import com.lowagie.text.Element; //導入依賴的package包/類
public PdfPCell createCell() {
PdfPCell cell = new PdfPCell();
cell.setBorderColor(sBorderColor);
cell.setPadding(3);
cell.setBorderWidth(0);
cell.setVerticalAlignment(Element.ALIGN_TOP);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorderWidthTop(1);
cell.setBorderWidthBottom(1);
cell.setBorderWidthLeft(1);
cell.setBorderWidthRight(1);
return cell;
}
示例3: createCell
import com.lowagie.text.Element; //導入依賴的package包/類
public PdfPCell createCell() {
PdfPCell cell = new PdfPCell();
cell.setBorderColor(sBorderColor);
cell.setPadding(3);
cell.setBorderWidth(0);
cell.setVerticalAlignment(Element.ALIGN_TOP);
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
cell.setBorderWidthTop(1);
cell.setBorderWidthBottom(1);
cell.setBorderWidthLeft(1);
cell.setBorderWidthRight(1);
return cell;
}
示例4: pdfBuildPrefGroupLabel
import com.lowagie.text.Element; //導入依賴的package包/類
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 = "";
}
PdfPCell cell = createCell();
addText(cell, indentSpaces+label, co.isIsControl(), false, Element.ALIGN_LEFT, color, true);
InstructionalMethod im = aClass.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalMethod();
if (im != null)
addText(cell, " (" + im.getReference() + ")", false, false, Element.ALIGN_LEFT, color, false);
return cell;
} else return super.pdfBuildPrefGroupLabel(co, prefGroup, indentSpaces, isEditable, null);
}
示例5: pdfBuildNote
import com.lowagie.text.Element; //導入依賴的package包/類
@Override
protected PdfPCell pdfBuildNote(PreferenceGroup prefGroup, boolean isEditable, UserContext user){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
if (prefGroup instanceof Class_) {
Class_ c = (Class_) prefGroup;
String offeringNote = c.getSchedulingSubpart().getInstrOfferingConfig().getInstructionalOffering().getNotes();
String classNote = c.getNotes();
String note = (offeringNote == null || offeringNote.isEmpty() ? classNote : offeringNote + (classNote == null || classNote.isEmpty() ? "" : "\n" + classNote));
if (note != null && !note.isEmpty()) {
if (note.length() <= 30 || user == null || CommonValues.NoteAsFullText.eq(user.getProperty(UserProperty.ManagerNoteDisplay))){
addText(cell, note, false, false, Element.ALIGN_LEFT, color, true);
} else {
if (classNote != null && !classNote.isEmpty()) note = classNote;
addText(cell, (note.length() <= 30 ? note : note.substring(0, 30) + "..."), false, false, Element.ALIGN_LEFT, color, true);
}
}
}
return cell;
}
示例6: pdfBuildDatePatternCell
import com.lowagie.text.Element; //導入依賴的package包/類
@Override
protected PdfPCell pdfBuildDatePatternCell(ClassAssignmentProxy classAssignment, PreferenceGroup prefGroup, boolean isEditable){
Assignment a = null;
if (getDisplayTimetable() && isShowTimetable() && classAssignment!=null && prefGroup instanceof Class_) {
try {
a = classAssignment.getAssignment((Class_)prefGroup);
} catch (Exception e) {
Debug.error(e);
}
}
DatePattern dp = (a != null ? a.getDatePattern() : prefGroup.effectiveDatePattern());
PdfPCell cell = createCell();
if (dp!=null) {
Color color = (isEditable?sEnableColor:sDisableColor);
addText(cell,dp.getName(), false, false, Element.ALIGN_CENTER, color, true);
}
return cell;
}
示例7: pdfBuildInstructor
import com.lowagie.text.Element; //導入依賴的package包/類
@Override
protected PdfPCell pdfBuildInstructor(PreferenceGroup prefGroup, boolean isEditable){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
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;
}
示例8: pdfSubjectAndCourseInfo
import com.lowagie.text.Element; //導入依賴的package包/類
private PdfPCell pdfSubjectAndCourseInfo(InstructionalOffering io, CourseOffering co) {
PdfPCell cell = createCell();
addText(cell, (co != null ? co.getSubjectAreaAbbv()+" "+co.getCourseNbr():""), true, false, Element.ALIGN_LEFT, (co.isIsControl().booleanValue()?sEnableColor:sDisableColor), true);
InstructionalMethod im = (co != null && co.getInstructionalOffering().getInstrOfferingConfigs().size() == 1 ? co.getInstructionalOffering().getInstrOfferingConfigs().iterator().next().getInstructionalMethod() : null);
if (im != null) {
if (co.getCourseType() != null) {
addText(cell, " (" + co.getCourseType().getReference() + ", " + im.getReference() + ")", false, false, Element.ALIGN_LEFT, (co.isIsControl().booleanValue()?sEnableColor:sDisableColor), false);
} else {
addText(cell, " (" + im.getReference() + ")", false, false, Element.ALIGN_LEFT, (co.isIsControl().booleanValue()?sEnableColor:sDisableColor), false);
}
} else if (co.getCourseType() != null) {
addText(cell, " (" + co.getCourseType().getReference() + ")", false, false, Element.ALIGN_LEFT, (co.isIsControl().booleanValue()?sEnableColor:sDisableColor), false);
}
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;
}
示例9: pdfBuildTimePatternCell
import com.lowagie.text.Element; //導入依賴的package包/類
private PdfPCell pdfBuildTimePatternCell(PreferenceGroup prefGroup, boolean isEditable){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
for (Iterator i=prefGroup.effectiveTimePatterns().iterator(); i.hasNext();) {
TimePattern tp = (TimePattern)i.next();
addText(cell, tp.getName(), false, false, Element.ALIGN_CENTER, color, true);
}
if (prefGroup instanceof Class_ && prefGroup.effectiveTimePatterns().isEmpty()) {
Class_ clazz = (Class_)prefGroup;
DurationModel dm = clazz.getSchedulingSubpart().getInstrOfferingConfig().getDurationModel();
Integer ah = dm.getArrangedHours(clazz.getSchedulingSubpart().getMinutesPerWk(), clazz.effectiveDatePattern());
if (ah == null) {
addText(cell, "Arr Hrs", false, false, Element.ALIGN_CENTER, color, true);
} else {
addText(cell, "Arr "+ah+" Hrs", false, false, Element.ALIGN_CENTER, color, true);
}
}
return cell;
}
示例10: pdfBuildPrefGroupDemand
import com.lowagie.text.Element; //導入依賴的package包/類
private PdfPCell pdfBuildPrefGroupDemand(PreferenceGroup prefGroup, boolean isEditable){
if (prefGroup instanceof Class_) {
Class_ c = (Class_) prefGroup;
if (StudentClassEnrollment.sessionHasEnrollments(c.getSessionId())){
PdfPCell tc = createCell();
if (c.getEnrollment() != null){
addText(tc, c.getEnrollment().toString());
} else {
addText(tc, "0");
}
tc.setHorizontalAlignment(Element.ALIGN_RIGHT);
return(tc);
}
}
return createCell();
}
示例11: pdfBuildSnapshotLimit
import com.lowagie.text.Element; //導入依賴的package包/類
private PdfPCell pdfBuildSnapshotLimit(PreferenceGroup prefGroup, boolean isEditable){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
if (prefGroup instanceof Class_){
Class_ aClass = (Class_) prefGroup;
boolean unlimited = aClass.getSchedulingSubpart().getInstrOfferingConfig().isUnlimitedEnrollment().booleanValue();
if (!unlimited) {
String limitString = null;
if (aClass.getSnapshotLimit() == null) {
limitString = "";
} else {
limitString = aClass.getSnapshotLimit().toString();
}
addText(cell, limitString, false, false, Element.ALIGN_RIGHT, color, true);
}
}
return cell;
}
示例12: pdfBuildInstructorAssignment
import com.lowagie.text.Element; //導入依賴的package包/類
protected PdfPCell pdfBuildInstructorAssignment(PreferenceGroup prefGroup, boolean isEditable){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
if (prefGroup instanceof Class_) {
Class_ c = (Class_) prefGroup;
if (c.isInstructorAssignmentNeeded()) {
addText(cell, (c.effectiveNbrInstructors() > 1 ? c.effectiveNbrInstructors() + " \u00d7 " : "") +
Formats.getNumberFormat("0.##").format(c.effectiveTeachingLoad()) + " " + MSG.teachingLoadUnits(),
false, false, Element.ALIGN_RIGHT, color, false);
} else if (c.getSchedulingSubpart().isInstructorAssignmentNeeded()) {
addText(cell, MSG.cellNoInstructorAssignment(), false, false, Element.ALIGN_RIGHT, color, false);
}
} else if (prefGroup instanceof SchedulingSubpart) {
SchedulingSubpart ss = (SchedulingSubpart)prefGroup;
if (ss.isInstructorAssignmentNeeded()) {
addText(cell, (ss.getNbrInstructors() > 1 ? ss.getNbrInstructors() + " \u00d7 " : "") +
Formats.getNumberFormat("0.##").format(ss.getTeachingLoad()) + " " + MSG.teachingLoadUnits(),
false, false, Element.ALIGN_RIGHT, color, false);
}
}
return cell;
}
示例13: pdfBuildInstructor
import com.lowagie.text.Element; //導入依賴的package包/類
protected PdfPCell pdfBuildInstructor(PreferenceGroup prefGroup, boolean isEditable){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
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());
if (ci.getResponsibility() != null && ci.getResponsibility().getAbbreviation() != null && !ci.getResponsibility().getAbbreviation().isEmpty())
label += " (" + ci.getResponsibility().getAbbreviation() + ")";
boolean italic = !aClass.isDisplayInstructor().booleanValue();
boolean bold = ci.isLead().booleanValue();
addText(cell, label, bold, italic, Element.ALIGN_LEFT, color, true);
}
}
return cell;
}
示例14: pdfBuildSchedulePrintNote
import com.lowagie.text.Element; //導入依賴的package包/類
private PdfPCell pdfBuildSchedulePrintNote(PreferenceGroup prefGroup, boolean isEditable, UserContext user) {
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
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;
}
示例15: pdfBuildNote
import com.lowagie.text.Element; //導入依賴的package包/類
protected PdfPCell pdfBuildNote(PreferenceGroup prefGroup, boolean isEditable, UserContext user){
Color color = (isEditable?sEnableColor:sDisableColor);
PdfPCell cell = createCell();
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;
}