GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
|
Data Model. More...
#include <TableModel.h>
Public Member Functions | |
TableModel (int _selectedMonth, Status _status) | |
ctor | |
auto | columnDef (int _col) -> ColumnDef_t |
Column Definition. | |
auto | loadData (int _selectedMonth) -> void |
Reload the data based on the selected month. | |
![]() | |
WStandardItemModel () | |
WStandardItemModel (int rows, int columns) | |
~WStandardItemModel () | |
void | clear () |
WStandardItem * | invisibleRootItem () const |
WModelIndex | indexFromItem (const WStandardItem *item) const |
WStandardItem * | itemFromIndex (const WModelIndex &index) const |
void | appendColumn (std::vector< std::unique_ptr< WStandardItem > > items) |
void | insertColumn (int column, std::vector< std::unique_ptr< WStandardItem > > items) |
void | appendRow (std::vector< std::unique_ptr< WStandardItem > > items) |
void | insertRow (int row, std::vector< std::unique_ptr< WStandardItem > > items) |
void | appendRow (std::unique_ptr< WStandardItem > item) |
void | insertRow (int row, std::unique_ptr< WStandardItem > item) |
WStandardItem * | item (int row, int column=0) const |
void | setItem (int row, int column, std::unique_ptr< WStandardItem > item) |
WStandardItem * | itemPrototype () const |
void | setItemPrototype (std::unique_ptr< WStandardItem > item) |
std::vector< std::unique_ptr< WStandardItem > > | takeColumn (int column) |
std::vector< std::unique_ptr< WStandardItem > > | takeRow (int row) |
std::unique_ptr< WStandardItem > | takeItem (int row, int column=0) |
void | setHeaderFlags (int section, Orientation orientation, WFlags< HeaderFlag > flags) |
void | setSortRole (ItemDataRole role) |
ItemDataRole | sortRole () const |
virtual void | sort (int column, SortOrder order=SortOrder::Ascending) override |
Signal< WStandardItem * > & | itemChanged () |
bool | insertRow (int row, const WModelIndex &parent=WModelIndex()) |
bool | insertColumn (int column, const WModelIndex &parent=WModelIndex()) |
![]() | |
WAbstractItemModel () | |
virtual int | columnCount (const WModelIndex &parent=WModelIndex()) const=0 |
virtual int | rowCount (const WModelIndex &parent=WModelIndex()) const=0 |
virtual WFlags< ItemFlag > | flags (const WModelIndex &index) const |
virtual WFlags< HeaderFlag > | headerFlags (int section, Orientation orientation=Orientation::Horizontal) const |
virtual bool | hasChildren (const WModelIndex &index) const |
virtual WModelIndex | parent (const WModelIndex &index) const=0 |
virtual cpp17::any | data (const WModelIndex &index, ItemDataRole role=ItemDataRole::Display) const=0 |
virtual DataMap | itemData (const WModelIndex &index) const |
virtual cpp17::any | headerData (int section, Orientation orientation=Orientation::Horizontal, ItemDataRole role=ItemDataRole::Display) const |
virtual WModelIndex | index (int row, int column, const WModelIndex &parent=WModelIndex()) const=0 |
virtual WModelIndexList | match (const WModelIndex &start, ItemDataRole role, const cpp17::any &value, int hits=-1, WFlags< MatchFlag > flags=WFlags< MatchFlag >(MatchFlag::StartsWith|MatchFlag::Wrap)) const |
cpp17::any | data (int row, int column, ItemDataRole role=ItemDataRole::Display, const WModelIndex &parent=WModelIndex()) const |
virtual bool | hasIndex (int row, int column, const WModelIndex &parent=WModelIndex()) const |
virtual bool | insertColumns (int column, int count, const WModelIndex &parent=WModelIndex()) |
virtual bool | insertRows (int row, int count, const WModelIndex &parent=WModelIndex()) |
virtual bool | removeColumns (int column, int count, const WModelIndex &parent=WModelIndex()) |
virtual bool | removeRows (int row, int count, const WModelIndex &parent=WModelIndex()) |
virtual bool | setData (const WModelIndex &index, const cpp17::any &value, ItemDataRole role=ItemDataRole::Edit) |
virtual bool | setItemData (const WModelIndex &index, const DataMap &values) |
virtual bool | setHeaderData (int section, Orientation orientation, const cpp17::any &value, ItemDataRole role=ItemDataRole::Edit) |
bool | setHeaderData (int section, const cpp17::any &value) |
virtual void | expandColumn (int column) |
virtual void | collapseColumn (int column) |
virtual void * | toRawIndex (const WModelIndex &index) const |
virtual WModelIndex | fromRawIndex (void *rawIndex) const |
virtual std::string | mimeType () const |
virtual std::vector< std::string > | acceptDropMimeTypes () const |
virtual void | dropEvent (const WDropEvent &e, DropAction action, int row, int column, const WModelIndex &parent) |
virtual void | dropEvent (const WDropEvent &e, DropAction action, const WModelIndex &index, Wt::Side side) |
bool | insertColumn (int column, const WModelIndex &parent=WModelIndex()) |
bool | insertRow (int row, const WModelIndex &parent=WModelIndex()) |
bool | removeColumn (int column, const WModelIndex &parent=WModelIndex()) |
bool | removeRow (int row, const WModelIndex &parent=WModelIndex()) |
bool | setData (int row, int column, const cpp17::any &value, ItemDataRole role=ItemDataRole::Edit, const WModelIndex &parent=WModelIndex()) |
virtual Signal< WModelIndex, int, int > & | columnsAboutToBeInserted () |
virtual Signal< WModelIndex, int, int > & | columnsAboutToBeRemoved () |
virtual Signal< WModelIndex, int, int > & | columnsInserted () |
virtual Signal< WModelIndex, int, int > & | columnsRemoved () |
virtual Signal< WModelIndex, int, int > & | rowsAboutToBeInserted () |
virtual Signal< WModelIndex, int, int > & | rowsAboutToBeRemoved () |
virtual Signal< WModelIndex, int, int > & | rowsInserted () |
virtual Signal< WModelIndex, int, int > & | rowsRemoved () |
virtual Signal< WModelIndex, WModelIndex > & | dataChanged () |
virtual Signal< Orientation, int, int > & | headerDataChanged () |
virtual Signal & | layoutAboutToBeChanged () |
virtual Signal & | layoutChanged () |
virtual Signal & | modelReset () |
![]() | |
void | addChild (std::unique_ptr< WObject > child) |
Child * | addChild (std::unique_ptr< Child > child) |
std::unique_ptr< WObject > | removeChild (WObject *child) |
std::unique_ptr< Child > | removeChild (Child *child) |
virtual const std::string | id () const |
virtual void | setObjectName (const std::string &name) |
virtual std::string | objectName () const |
void | resetLearnedSlots () |
void | resetLearnedSlot (void(T::*method)()) |
WStatelessSlot * | implementStateless (void(T::*method)()) |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
void | isNotStateless () |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
![]() | |
observable () noexcept | |
virtual | ~observable () |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
auto | bindSafe (const Function &function) noexcept |
Private Member Functions | |
auto | sort (std::vector< GCW::Gui::BillPay::Item > &_bpItems) -> void |
Sorter. | |
Private Attributes | |
Status | m_status |
Model Status. | |
Additional Inherited Members | |
![]() | |
typedef std::map< ItemDataRole, cpp17::any > | DataMap |
![]() | |
typedef void(WObject::* | Method) () |
![]() | |
virtual void | copyData (const WModelIndex &sIndex, const WModelIndex &dIndex) override |
![]() | |
void | reset () |
WModelIndex | createIndex (int row, int column, void *ptr) const |
WModelIndex | createIndex (int row, int column, ::uint64_t id) const |
void | beginInsertColumns (const WModelIndex &parent, int first, int last) |
void | beginInsertRows (const WModelIndex &parent, int first, int last) |
void | beginRemoveColumns (const WModelIndex &parent, int first, int last) |
void | beginRemoveRows (const WModelIndex &parent, int first, int last) |
void | endInsertColumns () |
void | endInsertRows () |
void | endRemoveColumns () |
void | endRemoveRows () |
![]() | |
virtual WStatelessSlot * | getStateless (Method method) |
Data Model.
Contains paid, unpaid and disabled accounts.
When constructing the Model, the parameters control the subset of items that will appear in the model. Therefore, the final model contains only 'paid', 'unpaid' or 'disabled' items for the month selected.
Definition at line 49 of file TableModel.h.
GCW::Gui::BillPay::TableModel::TableModel | ( | int | _selectedMonth, |
Status | _status | ||
) |
ctor
During construction, the model examines all the billpay-items to detemine if the item meets the parameter criteria. This allows a TableView to be constructed to present the items that meet this criteria as a grouped set of items.
To return all the items in the month of February that are 'paid', the constructor would appear as follows;
_selectedMonth | Select a 'calendar month' to compare status |
_status | Select a BillPay::Status to evaluate to |
Definition at line 41 of file TableModel.cpp.
References COLUMN_COUNT, Wt::ItemDataRole::Display, loadData(), m_status, Wt::WAbstractItemModel::setHeaderData(), Wt::ItemDataRole::ToolTip, TR, and GCW::Gui::BillPay::Unpaid.
auto GCW::Gui::BillPay::TableModel::columnDef | ( | int | _col | ) | -> ColumnDef_t |
Column Definition.
Return the column definition for the selected column.
Definition at line 276 of file TableModel.cpp.
auto GCW::Gui::BillPay::TableModel::loadData | ( | int | _selectedMonth | ) | -> void |
Reload the data based on the selected month.
This will drop all the data in the model and reload it with the month selected.
On load, the first column-label is set to indicate the model type as well as the month selected.
On load, all existing data in the model is first dumped.
Get all the var items that are for the 'managed bill pay item' (mbpi) in to a resultList that will then be used to load the resulting model.
Run the resultList collection through an analyzer that will extract billpay items that match the selection criteria of paid/unpaid/disabled/yes/no accordingly.
Sort all the items by the account group.dueDay. (The user is not allowed to sort these views so we do it) This sorts the items with the items that are due first, above those that are due next.
Each item is processed out of the sorted vector and placed in to the item model.
While building the 'month columns', apply a style class to the column of items according to the month selected. This causes the current selected column to be highlighted within the table view in the browser.
Definition at line 79 of file TableModel.cpp.
References GCW::app(), GCW::Gui::BillPay::asString(), GCW::Gui::BillPay::bpItem(), GCW::Gui::BillPay::bpItems(), GCW::Dbo::Accounts::byGuid(), Wt::ItemDataRole::Display, GCW::Dbo::Accounts::fullName(), GCW_GUI_BILLPAY_ITEM_CFY, GCW::Dbo::Vars::getByCfy(), GCW::Gui::BillPay::Inactive, GCW::Gui::BillPay::Paid, GCW::Gui::BillPay::Pending, GCW::Gui::BillPay::toString(), GCW::Gui::BillPay::Unpaid, and Wt::ItemDataRole::User.
Referenced by TableModel().
|
private |
Sorter.
This sorter produces a sorted list of bills-to-pay sorted by first 'group' then 'dueDay'. This produces a number that might be like 20.22, meaning group=20, day=22. The result in the view is all the "due next" items at the top of the list, and so on. The group-value is to just help clean the display. The result makes it very clear what bills are due next in line.
Sort the vector of bpItems by group.dueDay
Definition at line 283 of file TableModel.cpp.
|
private |
Model Status.
Each model represents items of a partcular status. The model set contains, therefore, only items that match the selected status and the selected month.
Definition at line 120 of file TableModel.h.
Referenced by TableModel().