6663b6c9
adorian
projet complet av...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#include "store_parameter_controller.h"
#include "app.h"
#include "store_controller.h"
#include <assert.h>
namespace Regression {
StoreParameterController::StoreParameterController(Responder * parentResponder, Store * store, StoreController * storeController) :
Shared::StoreParameterController(parentResponder, store, storeController),
m_changeRegressionCell(I18n::Message::Regression),
m_lastSelectionIsRegression(false)
{
static_cast<ExpressionView *>(m_changeRegressionCell.subAccessoryView())->setHorizontalMargin(Metric::ExpressionViewHorizontalMargin);
}
void StoreParameterController::viewWillAppear() {
m_selectableTableView.reloadData();
Shared::StoreParameterController::viewWillAppear();
}
bool StoreParameterController::handleEvent(Ion::Events::Event event) {
if ((event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) && selectedRow() == numberOfRows() - 1) {
RegressionController * regressionController = static_cast<Regression::App *>(app())->regressionController();
regressionController->setSeries(m_series);
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
stack->push(regressionController);
m_lastSelectionIsRegression = true;
return true;
}
return Shared::StoreParameterController::handleEvent(event);
}
void StoreParameterController::didBecomeFirstResponder() {
if (m_lastSelectionIsRegression) {
selectCellAtLocation(0, 2);
} else {
selectCellAtLocation(0, 0);
}
m_lastSelectionIsRegression = false;
app()->setFirstResponder(&m_selectableTableView);
}
HighlightCell * StoreParameterController::reusableCell(int index, int type) {
assert(index >= 0);
assert(index < reusableCellCount(type));
if (type == k_regressionCellType) {
assert(index == 0);
return &m_changeRegressionCell;
}
return Shared::StoreParameterController::reusableCell(index, type);
}
KDCoordinate StoreParameterController::rowHeight(int j) {
if (j == numberOfRows() - 1) {
if (static_cast<Store *>(m_store)->seriesRegressionType(m_series) == Model::Type::Logistic) {
return RegressionController::k_logisticCellHeight;
}
return Metric::ParameterCellHeight;
}
return Shared::StoreParameterController::rowHeight(j);
}
int StoreParameterController::reusableCellCount(int type) {
if (type == k_regressionCellType) {
return 1;
}
return Shared::StoreParameterController::reusableCellCount(type);
}
int StoreParameterController::typeAtLocation(int i, int j) {
assert(i == 0);
if (j == numberOfRows() -1) {
return k_regressionCellType;
}
return Shared::StoreParameterController::typeAtLocation(i, j);
}
void StoreParameterController::willDisplayCellForIndex(HighlightCell * cell, int index) {
if (index == numberOfRows() -1) {
m_changeRegressionCell.setExpressionLayout(static_cast<Store *>(m_store)->modelForSeries(m_series)->layout());
}
Shared::StoreParameterController::willDisplayCellForIndex(cell, index);
}
}
|