Example #1
0
    //TODOODOT : implement correct version
    void updateFromTransactionsQueryForRow(QueryEntry *qe, Array<int> numTransactions, int row, bool dView, bool edit)
    {
        setDetailedView(dView);
        setEdit(edit);
        resized();
        this->row = row;
        if(qe) {
            // summary
			const int numFields = 3;
            for (int i=0; i<getNumChildComponents(); i++) {
                TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i));
				if (te && te->getName().startsWith("#")) {
					const int ord = te->getName().substring(1).getIntValue();
					const int row = ord/numFields;
					const int field = ord%numFields;

					if (row < numTransactions.size()) {
						te->setText(qe->getFieldFromRow(row, field));
						te->setEnabled(edit);
						te->setVisible(true);
					}
					else {
						te->setVisible(false);
					}
				}
            }
        }
    }
Example #2
0
 //TODO : implement correct version
 void updateFromTransactionsMapForRow(QueryEntry *qe, std::map<String, String> rowUpdates, int row, bool dView, bool edit)
 {
     setDetailedView(dView);
     resized();
     this->row = row;
     
     for (int i=0; i<getNumChildComponents(); i++) {
         TextEditor *te = dynamic_cast<TextEditor*>(getChildComponent(i));
         if (te) {
             const StringArray key = (qe != nullptr) ? qe->getFieldFromRow(row, owner.getKeyField()) : StringArray();
             if (key.size() && (rowUpdates.find(te->getName()) != rowUpdates.end())) {
                 te->setText(rowUpdates[te->getName()]);
             }
             else {
                 te->setText(qe->getFieldFromRow(row, owner.fieldNames.indexOf(te->getName())));
             }
             te->setEnabled(edit);
         }
     }
 }