GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
TableModel.h
Go to the documentation of this file.
1#line 2 "src/Gui/BillPay/TableModel.h"
2
3#ifndef __GUI_BILLPAY_TABLEMODEL_H___
4#define __GUI_BILLPAY_TABLEMODEL_H___
5
6#include <Wt/WLength.h>
7#include <Wt/WStandardItemModel.h>
8
9#include "Item.h"
10#include "Status.h"
11
12namespace GCW {
13 namespace Gui {
14 namespace BillPay {
15
16/*!
17** \Brief Model Column Definitions
18**
19** This holds the column definitions for the Model and Table. It
20** includes the field name, field width (for the table), alignment
21** (also for the table). The tool tip is derived from the 'name'
22** value and is applied to the table accordingly.
23**
24*/
25typedef struct COLUMNDEF
26{
27 /// field name
28 const char * name;
29
30 /// column width for the table view
32
33 /// alignment flag for the table view
35
37
38/*!
39** \brief Data Model
40**
41** Contains paid, unpaid and disabled accounts.
42**
43** When constructing the Model, the parameters control the subset
44** of items that will appear in the model. Therefore, the final
45** model contains only 'paid', 'unpaid' or 'disabled' items for
46** the month selected.
47**
48*/
51{
52 public:
53
54 /*!
55 ** \brief ctor
56 **
57 ** During construction, the model examines all the billpay-items
58 ** to detemine if the item meets the parameter criteria. This
59 ** allows a TableView to be constructed to present the items
60 ** that meet this criteria as a grouped set of items.
61 **
62 ** To return all the items in the month of February that are
63 ** 'paid', the constructor would appear as follows;
64 **
65 ** \code
66 ** auto model = std::make_shared< Model >( 2, BillPay::Status::Paid );
67 ** \endcode
68 **
69 */
71 (
72 /// Select a 'calendar month' to compare status
73 int _selectedMonth,
74
75 /// Select a BillPay::Status to evaluate to
76 Status _status
77 );
78
79 /*!
80 ** \brief Column Definition
81 **
82 ** Return the column definition for the selected column.
83 **
84 */
85 auto columnDef( int _col )-> ColumnDef_t ;
86
87 /*!
88 ** \brief Reload the data based on the selected month.
89 **
90 ** This will drop all the data in the model and reload it with
91 ** the month selected.
92 **
93 */
94 auto loadData( int _selectedMonth )-> void ;
95
96 private:
97
98 /*!
99 ** \brief Sorter
100 **
101 ** This sorter produces a sorted list of bills-to-pay sorted
102 ** by first 'group' then 'dueDay'. This produces a number
103 ** that might be like 20.22, meaning group=20, day=22. The
104 ** result in the view is all the "due next" items at the top
105 ** of the list, and so on. The group-value is to just help
106 ** clean the display. The result makes it very clear what bills
107 ** are due next in line.
108 **
109 */
110 auto sort( std::vector< GCW::Gui::BillPay::Item > & _bpItems )-> void ;
111
112 /*!
113 ** \brief Model Status
114 **
115 ** Each model represents items of a partcular status. The model set
116 ** contains, therefore, only items that match the selected status
117 ** and the selected month.
118 **
119 */
121
122}; // endclass TableModel
123
124 } // endnamespace BillPay {
125 } // endnamespace Gui {
126} // endnamespace GCW {
127
128#endif // __GUI_BILLPAY_TABLEMODEL_H___
129
130
auto columnDef(int _col) -> ColumnDef_t
Column Definition.
auto loadData(int _selectedMonth) -> void
Reload the data based on the selected month.
Status m_status
Model Status.
Definition TableModel.h:120
auto sort(std::vector< GCW::Gui::BillPay::Item > &_bpItems) -> void
Sorter.
Status
Bill Status.
Definition Status.h:27
struct GCW::Gui::BillPay::COLUMNDEF ColumnDef_t
Definition App.h:18
AlignmentFlag
Wt::AlignmentFlag alignment
alignment flag for the table view
Definition TableModel.h:34
const char * name
field name
Definition TableModel.h:28
Wt::WLength width
column width for the table view
Definition TableModel.h:31