PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/Tests/Manual/TableTest/TestTemplate_AppController.j

http://github.com/cacaodev/cappuccino
Unknown | 75 lines | 56 code | 19 blank | 0 comment | 0 complexity | b6299ccb51a70c7fa4d312a33906a7c9 MD5 | raw file
 1/*
 2 * AppController.j
 3 * TestTemplate
 4 *
 5 * Created by You on August 10, 2010.
 6 * Copyright 2010, Your Company All rights reserved.
 7 */
 8
 9@import <Foundation/CPObject.j>
10
11
12@implementation AppController : CPObject
13{
14    CPTableView table;
15    CPTableColumn columnA;
16    CPTableColumn columnB;
17    CPTableColumn columnC;
18    CPTableColumn columnD;
19
20}
21
22- (void)applicationDidFinishLaunching:(CPNotification)aNotification
23{
24    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
25        contentView = [theWindow contentView];
26
27    var scroll = [[CPScrollView alloc] initWithFrame:CGRectMake(100,100,700,400)];
28
29    table = [[CPTableView alloc] initWithFrame:CGRectMakeZero()];
30    [table setDataSource:self];
31
32    columnA = [[CPTableColumn alloc] initWithIdentifier:"A"];
33    [table addTableColumn:columnA];
34    [[columnA headerView] setStringValue:"A"];
35    [columnA setWidth:175];
36
37    columnB = [[CPTableColumn alloc] initWithIdentifier:"B"];
38    [table addTableColumn:columnB];
39    [[columnB headerView] setStringValue:"B"];
40    [columnB setWidth:175]
41
42    columnC = [[CPTableColumn alloc] initWithIdentifier:"C"];
43    [table addTableColumn:columnC];
44    [[columnC headerView] setStringValue:"C"];
45    [columnC setWidth:175];
46
47    columnD = [[CPTableColumn alloc] initWithIdentifier:"D"];
48    [table addTableColumn:columnD];
49    [[columnD headerView] setStringValue:"D"];
50    [columnD setWidth:175];
51
52    columnE = [[CPTableColumn alloc] initWithIdentifier:"E"];
53    [table addTableColumn:columnE];
54    [[columnE headerView] setStringValue:"E"];
55    [columnE setWidth:175];
56
57    [scroll setDocumentView:table];
58
59    [contentView addSubview:scroll];
60
61    [theWindow orderFront:self];
62
63}
64
65- (int)numberOfRowsInTableView:(id)tableView
66{
67    return 10000;
68}
69
70- (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow
71{
72    return "Column " + [aColumn identifier] + " Row " + aRow;
73}
74
75@end