Package org.cesilko.rachota.gui
Class ReportGenerator
java.lang.Object
org.cesilko.rachota.gui.ReportGenerator
Helper class for generation of HTML/TXT/CSV reports.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
Comparable object representing one project in the summary on report.(package private) class
Comparable object representing one task in the summary on report. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HistoryChart
private Vector
private File
private AbstractTaskFilter
private boolean
private boolean
private boolean
private boolean
private static int
private static int
private String
private Vector
private boolean
private boolean
private String
private String
-
Constructor Summary
ConstructorsConstructorDescriptionReportGenerator
(File file, String title, boolean showChart, boolean showFilters, String rowsRepresent, boolean includeDuration, boolean includeProjectsTasks, boolean includeOccurrences, boolean includeNotes, String sortBy, Vector days, HistoryChart chart, AbstractTaskFilter highlightFilter, Vector selectFilters) -
Method Summary
Modifier and TypeMethodDescriptionprivate Vector
filterTasks
(Vector tasks) Filters given vector of tasks trough all used filters and returns vector of tasks satisfying all filters.void
Generates report based on data provided in constructor of ReportGenerator class.private ReportGenerator.ProjectRow[]
Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates projects statistic (@see ProjectRow).private ReportGenerator.TaskRow[]
Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates its statistic (@see TaskRow).private void
writeChart
(OutputStreamWriter writer) private void
writeFilters
(OutputStreamWriter writer) private void
writeFooter
(OutputStreamWriter writer) private void
writeHeader
(OutputStreamWriter writer) private void
writeHTMLFilters
(OutputStreamWriter writer) private void
writeHTMLFooter
(OutputStreamWriter writer) private void
writeHTMLHeader
(OutputStreamWriter writer) private void
writeHTMLProjects
(OutputStreamWriter writer) private void
writeHTMLTasks
(OutputStreamWriter writer) private void
writeProjects
(OutputStreamWriter writer) private void
writeTasks
(OutputStreamWriter writer) private void
writeTXTCSVFilters
(OutputStreamWriter writer, String prefix, String delimiter) private void
writeTXTCSVFooter
(OutputStreamWriter writer, String prefix) private void
writeTXTCSVHeader
(OutputStreamWriter writer, String prefix) private void
writeTXTCSVProjects
(OutputStreamWriter writer, int output) private void
writeTXTCSVTasks
(OutputStreamWriter writer, int output)
-
Field Details
-
file
-
title
-
showChart
private boolean showChart -
showFilters
private boolean showFilters -
rowsRepresent
-
includeDuration
private boolean includeDuration -
includeProjectsTasks
private boolean includeProjectsTasks -
includeOccurrences
private boolean includeOccurrences -
includeNotes
private boolean includeNotes -
sortBy
-
days
-
chart
-
highlightFilter
-
selectFilters
-
OUTPUT_TXT
private static int OUTPUT_TXT -
OUTPUT_CSV
private static int OUTPUT_CSV
-
-
Constructor Details
-
ReportGenerator
public ReportGenerator(File file, String title, boolean showChart, boolean showFilters, String rowsRepresent, boolean includeDuration, boolean includeProjectsTasks, boolean includeOccurrences, boolean includeNotes, String sortBy, Vector days, HistoryChart chart, AbstractTaskFilter highlightFilter, Vector selectFilters)
-
-
Method Details
-
generateReport
public void generateReport()Generates report based on data provided in constructor of ReportGenerator class. -
writeHeader
- Throws:
IOException
-
writeHTMLHeader
- Throws:
IOException
-
writeTXTCSVHeader
- Throws:
IOException
-
writeChart
- Throws:
FileNotFoundException
IOException
-
writeFilters
- Throws:
IOException
-
writeHTMLFilters
- Throws:
IOException
-
writeTXTCSVFilters
private void writeTXTCSVFilters(OutputStreamWriter writer, String prefix, String delimiter) throws IOException - Throws:
IOException
-
writeTasks
- Throws:
IOException
-
writeHTMLTasks
- Throws:
IOException
-
writeTXTCSVTasks
- Throws:
IOException
-
writeProjects
- Throws:
IOException
-
writeHTMLProjects
- Throws:
IOException
-
writeTXTCSVProjects
- Throws:
IOException
-
getTaskRows
Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates its statistic (@see TaskRow). Finally, sorts all entries according to user's preference.- Returns:
- Sorted array of task rows to be included on the report.
-
getProjectRows
Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates projects statistic (@see ProjectRow). Finally, sorts all entries according to user's preference.- Returns:
- Sorted array of project rows to be included on the report.
-
filterTasks
Filters given vector of tasks trough all used filters and returns vector of tasks satisfying all filters.- Parameters:
tasks
- Vector of tasks to be filtered.- Returns:
- Vector of tasks that satisfied all filters.
-