Today's Menu  Portugal
journal and plan nutrition
Instance Methods | List of all members
Z6ParamEditTotalView Class Reference

#import <Z6ParamEditTotalView.h>

Inheritance diagram for Z6ParamEditTotalView:
Inheritance graph
[legend]
Collaboration diagram for Z6ParamEditTotalView:
Collaboration graph
[legend]

Instance Methods

(instancetype) - initWithDelegate:
 
(void) - configureToState:
 
(TotalEditStateEnum- getTotalEditState
 
(void) - showRemoveOption:
 
(void) - originate [implementation]
 
(void) - placeControlViews [implementation]
 
(float) - heightRequirement [implementation]
 
(void) - appear: [implementation]
 
(CGRect) - screenBound [implementation]
 
(NSDictionary *) - selectedParameterList [implementation]
 
(void) - addParameter: [implementation]
 
(float) - viewWidth [implementation]
 
(void) - showPickerView: [implementation]
 
(void) - specializePickerView: [implementation]
 
(void) - clickPlusButton90 [implementation]
 
(void) - clickRemoveButton [implementation]
 
(void) - clickCancelButton [implementation]
 
(void) - clickAcceptButton [implementation]
 
(void) - showWithinEdit: [implementation]
 

Detailed Description

Definition at line 17 of file Z6ParamEditTotalView.h.

Method Documentation

◆ addParameter:()

- (void) addParameter: (NSDictionary *)  newComponentSpecDict
implementation

Definition at line 134 of file Z6ParamEditTotalView.m.

134  :(NSDictionary *)newComponentSpecDict {
135  // TODO: add code
136 }
NSMutableDictionary * newComponentSpecDict

◆ appear:()

- (void) appear: (CGRect)  bound
implementation

Definition at line 86 of file Z6ParamEditTotalView.m.

86  :(CGRect)bound
87 {
88  NSLog(@"ParamEditTotalView.appear: bound: %3.2f/%3.2f, %3.2f/%3.2f",
89  bound.origin.x, bound.origin.y, bound.size.width, bound.size.height);
90  [valueEditPickerView appear:bound];
91  [controlBarView appear:bound];
92  [self placeControlViews];
93 }

◆ clickAcceptButton()

- (void) clickAcceptButton
implementation

add to USDA dictionary at this point to add that quantity of that nutrient to menu item. Value appears on table, picker disappears, control bar retruns to initial state. controlbar -> initial-state picker -> value read, disappears parameter info added to model within local-data redisplay of menu=item in table

Definition at line 191 of file Z6ParamEditTotalView.m.

192 {
193  NSDictionary *freshParameter = [valueEditPickerView originateParameter];
194  [delegate addParameter:freshParameter];
195 
196  [self configureToState:INITIAL_STATE];
197 }

◆ clickCancelButton()

- (void) clickCancelButton
implementation

Definition at line 177 of file Z6ParamEditTotalView.m.

178 {
179  NSLog(@"ParamEditTotalView.clickCancelButton");
180  [self configureToState:INITIAL_STATE];
181 }

◆ clickPlusButton90()

- (void) clickPlusButton90
implementation

Definition at line 167 of file Z6ParamEditTotalView.m.

168 {
169  NSLog(@"ParamEditTotalView.clickPlusButton");
170 }

◆ clickRemoveButton()

- (void) clickRemoveButton
implementation

Definition at line 171 of file Z6ParamEditTotalView.m.

172 {
173  NSLog(@"ParamEditTotalView.clickRemoveButton");
174  [delegate clickRemoveButton];
175 }

◆ configureToState:()

- (void) configureToState: (TotalEditStateEnum state

Definition at line 100 of file Z6ParamEditTotalView.m.

100  :(TotalEditStateEnum) state
101 {
102  NSLog(@"ParamEditTotalView.configureToState: state: %d", state);
103  // NSDictionary *focus = [delegate selectedParameterList];
104  CGRect totalEditBounds;
105  totalEditState = state; // --> pick-componenet
106  switch(totalEditState) {
107  case INITIAL_STATE:
108  {
109  totalEditBounds = CGRectMake(0, 0, [self viewWidth], 44);
110  [valueEditPickerView initializeSelection];
111  }
112  break;
113  case PICK_COMPONENT:
114  case PICK_QUANTITY:
115  {
116  totalEditBounds = CGRectMake(0, 0, [self viewWidth], 144);
117  }
118  break;
119  }
120  [self setFrame:totalEditBounds];
121  [self appear:self.bounds];
122  [delegate showUpdatedHeaderFooter];
123  [delegate scrollForControlPanel];
124 }
TotalEditStateEnum totalEditState
TotalEditStateEnum

◆ getTotalEditState()

- (TotalEditStateEnum) getTotalEditState

Definition at line 125 of file Z6ParamEditTotalView.m.

126 {
127  return totalEditState;
128 }
TotalEditStateEnum totalEditState

◆ heightRequirement()

- (float) heightRequirement
implementation

Definition at line 79 of file Z6ParamEditTotalView.m.

80 {
81  NSLog(@"ParamEditTotalView.heightRequirement: %3.2f", totalStateHeight);
82  float returnHeight = totalStateHeight;
83 
84  return returnHeight;
85 }
float totalStateHeight

◆ initWithDelegate:()

- (instancetype) initWithDelegate: (id<Z6ParamEditTotalDelegate>)  dele

Definition at line 27 of file Z6ParamEditTotalView.m.

27  : (id<Z6ParamEditTotalDelegate>) dele
28 {
29  self = [super init];
30  if (self) {
31  delegate = dele;
32  [self originate];
33  }
34  return self;
35 }
id< U7ParamEditControlDelegate > delegate

◆ originate()

- (void) originate
implementation

Definition at line 36 of file Z6ParamEditTotalView.m.

37 {
39  self.userInteractionEnabled = YES;
40  // [self setBackgroundColor:[UIColor redColor]];
41  [self setClipsToBounds:YES];
42 
43  controlBarView = [[U7ParamEditControlbarView alloc] initWithDelegate:self];
44  valueEditPickerView = [[Z6ParamValueEditView alloc] initWithDelegate:self];
45 
46  [self configureToState:INITIAL_STATE];
47  [self placeControlViews];
48 
49  [self addSubview:controlBarView];
50  [self addSubview:valueEditPickerView];
51 }
Z6ParamValueEditView * valueEditPickerView
TotalEditStateEnum totalEditState
U7ParamEditControlbarView * controlBarView

◆ placeControlViews()

- (void) placeControlViews
implementation

Definition at line 53 of file Z6ParamEditTotalView.m.

54 {
55  switch(totalEditState) {
56  case INITIAL_STATE:
57  {
58  valueEditPickerFrame = CGRectMake(0.0, 0.0, delegate.screenBound.size.width - 4.0, 0);
59  [valueEditPickerView setHidden:YES];
60  controlBarFrame = CGRectMake(2.0, 2.0, delegate.screenBound.size.width - 4.0, USDAparameterEditConrolbarHeight);
61  totalStateHeight = 42;
62  }
63  break;
64  case PICK_COMPONENT:
65  case PICK_QUANTITY:
66  {
67  usdaParameterEditPickerHeight = [valueEditPickerView heightRequirement];
68  valueEditPickerFrame = CGRectMake(2.0, 2.0, delegate.screenBound.size.width - 4.0, usdaParameterEditPickerHeight);
69  [valueEditPickerView setHidden:NO];
70  controlBarFrame = CGRectMake(2.0, 92.0, delegate.screenBound.size.width - 4.0, USDAparameterEditConrolbarHeight);
71  totalStateHeight = 132;
72  }
73  break;
74  }
75  [valueEditPickerView setFrame:valueEditPickerFrame];
76  [controlBarView setFrame:controlBarFrame];
77 }
float usdaParameterEditPickerHeight
TotalEditStateEnum totalEditState
id< U7ParamEditControlDelegate > delegate
float USDAparameterEditConrolbarHeight
float totalStateHeight
CGRect controlBarFrame
CGRect valueEditPickerFrame

◆ screenBound()

- (CGRect) screenBound
implementation

Definition at line 95 of file Z6ParamEditTotalView.m.

96 {
97  return self.bounds;
98 }

◆ selectedParameterList()

- (NSDictionary *) selectedParameterList
implementation

Definition at line 129 of file Z6ParamEditTotalView.m.

130 {
131  return [delegate selectedParameterList];
132 }

◆ showPickerView:()

- (void) showPickerView: (Boolean)  flag
implementation

Definition at line 143 of file Z6ParamEditTotalView.m.

143  : (Boolean) flag
144 {
145  if (flag) {
146  // [controlBarView setFrame:controlBarFrame];
147  // [valueEditPickerView appear:self.bounds];
148 
149  NSLog(@"ParamEditTotalView.showPickerView: set picker view to appear");
150  [self configureToState:PICK_COMPONENT];
151 
152  [delegate showUpdatedHeaderFooter];
153 
154  } else {
155  // [valueEditPickerView setHidden:YES];
156  NSLog(@"ParamEditTotalView.showPickerView: set picker view hidden");
157  }
158 }

◆ showRemoveOption:()

- (void) showRemoveOption: (Boolean)  flag

Definition at line 207 of file Z6ParamEditTotalView.m.

207  : (Boolean) flag
208 {
209  [controlBarView showRemoveOption:flag];
210  // NSLog(@"ParamEditTotalView.showRemoveOption: NO-OP NO-OP NO-OP");
211 }

◆ showWithinEdit:()

- (void) showWithinEdit: (NSInteger)  parameterIndexRow
implementation

Definition at line 201 of file Z6ParamEditTotalView.m.

201  : (NSInteger) parameterIndexRow
202 {
203  NSDictionary *editSource = [nutritionComponents objectAtIndex:parameterIndexRow];
204 
205  [valueEditPickerView specializePickerView:editSource];
206 }

◆ specializePickerView:()

- (void) specializePickerView: (NSInteger)  rowNum
implementation

Definition at line 159 of file Z6ParamEditTotalView.m.

159  : (NSInteger) rowNum
160 {
161  NSLog(@"ParamEditTotalView.specializePickerView");
162  NSArray *nutrComp = [delegate nutritionComponents];
163  NSDictionary *parameterData = [nutrComp objectAtIndex:rowNum];
164  [valueEditPickerView specializePickerView:parameterData];
165 }

◆ viewWidth()

- (float) viewWidth
implementation

Definition at line 139 of file Z6ParamEditTotalView.m.

140 {
141  return [self screenBound].size.width;
142 }

The documentation for this class was generated from the following files: