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) classComparable object representing one project in the summary on report.(package private) classComparable object representing one task in the summary on report. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HistoryChartprivate Vectorprivate Fileprivate AbstractTaskFilterprivate booleanprivate booleanprivate booleanprivate booleanprivate static intprivate static intprivate Stringprivate Vectorprivate booleanprivate booleanprivate Stringprivate 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 VectorfilterTasks(Vector tasks) Filters given vector of tasks trough all used filters and returns vector of tasks satisfying all filters.voidGenerates 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 voidwriteChart(OutputStreamWriter writer) private voidwriteFilters(OutputStreamWriter writer) private voidwriteFooter(OutputStreamWriter writer) private voidwriteHeader(OutputStreamWriter writer) private voidwriteHTMLFilters(OutputStreamWriter writer) private voidwriteHTMLFooter(OutputStreamWriter writer) private voidwriteHTMLHeader(OutputStreamWriter writer) private voidwriteHTMLProjects(OutputStreamWriter writer) private voidwriteHTMLTasks(OutputStreamWriter writer) private voidwriteProjects(OutputStreamWriter writer) private voidwriteTasks(OutputStreamWriter writer) private voidwriteTXTCSVFilters(OutputStreamWriter writer, String prefix, String delimiter) private voidwriteTXTCSVFooter(OutputStreamWriter writer, String prefix) private voidwriteTXTCSVHeader(OutputStreamWriter writer, String prefix) private voidwriteTXTCSVProjects(OutputStreamWriter writer, int output) private voidwriteTXTCSVTasks(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:
FileNotFoundExceptionIOException
-
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.
-