Permalink
Browse files

Fixed PDF exporter for colored flags

  • Loading branch information...
1 parent 348a8d3 commit b5cfedc7c18da7381df5f7060016acb2c9874fb6 @dyadix committed Jul 9, 2011
Showing with 15 additions and 9 deletions.
  1. +15 −9 main/src/net/sf/timecult/export/pdf/PdfTaskListExporter.java
View
24 main/src/net/sf/timecult/export/pdf/PdfTaskListExporter.java
@@ -34,19 +34,18 @@
public class PdfTaskListExporter {
-
- private static BaseFont baseFont;
+
private static Font titleFont;
private static Font sectionFont;
private static Font textFont;
private static Font commentFont;
static {
try {
- baseFont = BaseFont.createFont(
- "/net/sf/timecult/fonts/LiberationSans-Regular.ttf",
- BaseFont.IDENTITY_H,
- BaseFont.NOT_EMBEDDED);
+ BaseFont baseFont = BaseFont.createFont(
+ "/net/sf/timecult/fonts/LiberationSans-Regular.ttf",
+ BaseFont.IDENTITY_H,
+ BaseFont.NOT_EMBEDDED);
titleFont = new Font(baseFont, 14, Font.BOLD);
sectionFont = new Font(baseFont, 12, Font.BOLD);
textFont = new Font(baseFont, 10, Font.NORMAL);
@@ -65,7 +64,11 @@ public static void export(Workspace ws, String fileName) throws IOException {
Paragraph title = new Paragraph(ResourceHelper.getString("tasklist.title"), titleFont);
title.setSpacingAfter(10);
document.add(title);
- createTaskList(document, new TaskStatus(TaskStatus.FLAGGED), Task.class);
+ createTaskList(document, new TaskStatus(TaskStatus.FlagColor.RED), Task.class);
+ createTaskList(document, new TaskStatus(TaskStatus.FlagColor.ORANGE), Task.class);
+ createTaskList(document, new TaskStatus(TaskStatus.FlagColor.BLUE), Task.class);
+ createTaskList(document, new TaskStatus(TaskStatus.FlagColor.GREEN), Task.class);
+ createTaskList(document, new TaskStatus(TaskStatus.FlagColor.MAGENTA), Task.class);
createTaskList(document, new TaskStatus(TaskStatus.NOT_STARTED), Task.class);
createTaskList(document, new TaskStatus(TaskStatus.IN_PROGRESS), Task.class);
createTaskList(document, new TaskStatus(TaskStatus.WAITING), Task.class);
@@ -77,8 +80,11 @@ public static void export(Workspace ws, String fileName) throws IOException {
}
private static void createTaskList(Document doc, TaskStatus taskStatus, Class<Task> taskSubtype) throws DocumentException, IOException {
- String tag = taskStatus.toString();
- String titleText = ResourceHelper.getString("button.tasklist." + tag + ".tooltip");
+ String tag = "tasklist." + taskStatus.toString();
+ if (taskStatus.getId() == TaskStatus.FLAGGED) {
+ tag = taskStatus.getFlagColor().toString().toLowerCase() + "Flag";
+ }
+ String titleText = ResourceHelper.getString("button." + tag + ".tooltip");
Paragraph subTitle = new Paragraph(titleText, sectionFont);
subTitle.setSpacingAfter(10);
subTitle.setSpacingBefore(10);

0 comments on commit b5cfedc

Please sign in to comment.