001: package net.sf.jmoney.charts;
002:
003: import java.text.DateFormat;
004: import java.text.ParseException;
005: import java.text.SimpleDateFormat;
006: import java.util.Date;
007: import java.util.Vector;
008:
009: /**
010: * @author Faucheux
011: * This class is only a container to collect all the parameters of
012: * a LineChart.
013: */
014: public class LineChartParameters {
015:
016: // Differents typs
017: public static final int SALDO_ABSOLUT = 1;
018: public static final int SALDO_RELATIV = 2;
019: public static final int MOUVEMENT = 3;
020: public static final int BALANCE = 4;
021:
022: public/*String*/Vector accountList;
023: public Date fromDate, toDate;
024:
025: // Frequences of the dates
026: public boolean daily;
027: public boolean average30;
028: public boolean average120;
029: public boolean average365;
030:
031: // Type of the graph (for the time, SALDO or MOUVEMENT)
032: public int type = SALDO_ABSOLUT;
033:
034: // Do we include the subaccounts for each account?
035: public boolean withSubaccounts;
036:
037: /**
038: *
039: */
040: public LineChartParameters() {
041: accountList = new Vector();
042: fromDate = new Date(0); // 01.01.1970
043: toDate = new Date(); // today
044: }
045:
046: /**
047: * @param accountList The accountList to set.
048: */
049: public void setAccountList(Vector accountList) {
050: this .accountList = accountList;
051: }
052:
053: /**
054: * @param fromDate The fromDate to set.
055: */
056: public void setFromDate(Date fromDate) {
057: this .fromDate = fromDate;
058: }
059:
060: /**
061: * @param toDate The toDate to set.
062: */
063: public void setToDate(Date toDate) {
064: this .toDate = toDate;
065: }
066:
067: /**
068: * @param average120 The average120 to set.
069: */
070: public void setAverage120(boolean average120) {
071: this .average120 = average120;
072: }
073:
074: /**
075: * @param average30 The average30 to set.
076: */
077: public void setAverage30(boolean average30) {
078: this .average30 = average30;
079: }
080:
081: public void setDates(String fromDate, String toDate) {
082: DateFormat df = new SimpleDateFormat();
083: try {
084: setFromDate(df.parse(fromDate));
085: setToDate(df.parse(toDate));
086: } catch (ParseException e) {
087: e.printStackTrace();
088: }
089: ;
090: }
091:
092: /**
093: * @param type The type to set.
094: */
095: public void setType(int type) {
096: this .type = type;
097: }
098:
099: /**
100: * @param daily The daily to set.
101: */
102: public void setDaily(boolean daily) {
103: this .daily = daily;
104: }
105:
106: /**
107: * @param withSubaccounts The withSubaccounts to set.
108: */
109: public void setWithSubaccounts(boolean withSubaccounts) {
110: this .withSubaccounts = withSubaccounts;
111: }
112:
113: /**
114: * @param average365 The average365 to set.
115: */
116: public void setAverage365(boolean average365) {
117: this.average365 = average365;
118: }
119: }
|