hourparser
Class Report

java.lang.Object
  extended by hourparser.Report

public class Report
extends Object

Formats the data of persons to HTML format.

Author:
Esko Luontola, http://www.orfjackal.net/

Field Summary
private  HashMap<String,Vector<Double>> codeHours
          How many hours of each work code has made per week.
private  String footer
           
private  String header
           
static int INDEX_PAGE_NUMBER
          Index of the index page for getPage() and getPageName().
private  Vector<Double>[] personHours
          How many hours each person has made per week.
private  Person[] persons
          The Persons who are included in this report.
private  Vector<Date> weeks
          The beginnings of each week.
 
Constructor Summary
Report(Person[] persons)
          Creates a report from an array of Persons.
Report(Vector<Person> persons)
          Creates a report from a Vector of Persons.
 
Method Summary
 String getFooter()
           
 String getHeader()
           
private  String getIndexPage()
          Returns the HTML code for the page with the hours listed by person and week.
private  String getIndexPageName()
          Returns the file name for the index page.
 String getPage(int page)
          Returns the HTML code for the given page.
 String getPageName(int page)
          Returns the file name for the given page.
 int getPages()
          Returns how many pages this report will generate.
private  String getPersonPage(int person)
          Returns the HTML code for a person's summary page.
private  String getSummaryPage()
          Returns the HTML code for the page with the hours listed by code and week.
private  void process()
          Collects the data from the persons and saves it for later use in the reports.
private  void processWeek(Date weekStart, Date weekEnd)
          Collects the data from the persons for one week and saves it for later use in the reports.
 void setFooter(String footer)
           
 void setHeader(String header)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_PAGE_NUMBER

public static final int INDEX_PAGE_NUMBER
Index of the index page for getPage() and getPageName().

See Also:
Constant Field Values

persons

private final Person[] persons
The Persons who are included in this report.


personHours

private final Vector<Double>[] personHours
How many hours each person has made per week. The data format is personHours[personsIndex].get(weeksIndex).


codeHours

private final HashMap<String,Vector<Double>> codeHours
How many hours of each work code has made per week. The data format is codeHours.get(code).get(weeksIndex).


weeks

private final Vector<Date> weeks
The beginnings of each week.


header

private String header

footer

private String footer
Constructor Detail

Report

public Report(Vector<Person> persons)
Creates a report from a Vector of Persons.

Parameters:
persons - persons to be included in the report; must be at least one.

Report

public Report(Person[] persons)
Creates a report from an array of Persons.

Parameters:
persons - persons to be included in the report; must be at least one.
Method Detail

process

private void process()
Collects the data from the persons and saves it for later use in the reports.


processWeek

private void processWeek(Date weekStart,
                         Date weekEnd)
Collects the data from the persons for one week and saves it for later use in the reports.

Parameters:
weekStart - the beginning of the week, must this week's first day at 00:00:00.
weekEnd - the end of the week, must be next week's first day at 00:00:00.

getPages

public int getPages()
Returns how many pages this report will generate.


getPage

public String getPage(int page)
Returns the HTML code for the given page.

Parameters:
page - index of the page, from 0 to getPages()-1.
Returns:
HTML code for the page, including the header and footer.

getPageName

public String getPageName(int page)
Returns the file name for the given page.

Parameters:
page - index of the page, from 0 to getPages()-1.
Returns:
file name for the page.

getIndexPageName

private String getIndexPageName()
Returns the file name for the index page.


getIndexPage

private String getIndexPage()
Returns the HTML code for the page with the hours listed by person and week.

Returns:
HTML code for the page. Does not include the header or footer.

getSummaryPage

private String getSummaryPage()
Returns the HTML code for the page with the hours listed by code and week.

Returns:
HTML code for the page. Does not include the header or footer.

getPersonPage

private String getPersonPage(int person)
Returns the HTML code for a person's summary page.

Parameters:
person - index of the person
Returns:
HTML code for the page. Does not include the header or footer.

getHeader

public String getHeader()

setHeader

public void setHeader(String header)

getFooter

public String getFooter()

setFooter

public void setFooter(String footer)