-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAppController.j
73 lines (58 loc) · 1.76 KB
/
AppController.j
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
/*
* AppController.j
* PersonBindingDemo
*
* Created by You on April 5, 2011.
* Copyright 2011, Your Company All rights reserved.
*/
@import <Foundation/CPObject.j>
@import "Person.j"
@import "PersonValueTransformer.j"
@implementation AppController : CPObject
{
CPWindow theWindow; //this "outlet" is connected automatically by the Cib
CPMutableArray persons;
}
-(id)init
{
persons = [[CPMutableArray alloc] init];
for (var i = 100 - 1; i >= 0; i--){
// This is called when the application is done loading.
var me = [[Person alloc] init];
[me setValue:@"John" + i forKey:@"firstName"];
[me setValue:@"Brown" + i forKey:@"lastName"];
[me setValue:[CPNumber numberWithFloat:i] forKey:@"age"];
[me setValue:[CPNumber numberWithBool:(i % 2 == 0)] forKey:@"isMarried"];
switch(i % 3){
case 0:
[me setValue:CPOnState forKey:@"isFemale"];
[me setValue:CPOffState forKey:@"isMale"];
[me setValue:CPOffState forKey:@"isTBD"];
break;
case 1:
[me setValue:CPOffState forKey:@"isFemale"];
[me setValue:CPOnState forKey:@"isMale"];
[me setValue:CPOffState forKey:@"isTBD"];
break;
case 2:
[me setValue:CPOffState forKey:@"isFemale"];
[me setValue:CPOffState forKey:@"isMale"];
[me setValue:CPOnState forKey:@"isTBD"];
break;
}
[persons addObject:me];
};
return self;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
}
- (void)awakeFromCib
{
// This is called when the cib is done loading.
// You can implement this method on any object instantiated from a Cib.
// It's a useful hook for setting up current UI values, and other things.
// In this case, we want the window from Cib to become our full browser window
[theWindow setFullBridge:YES];
}
@end