/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. @import <Foundation/CPObject.j>
  9. @implementation AppController : CPObject
  10. {
  11. CPTableView table;
  12. CPTableColumn columnA;
  13. CPTableColumn columnB;
  14. CPTableColumn columnC;
  15. CPTableColumn columnD;
  16. }
  17. - (void)applicationDidFinishLaunching:(CPNotification)aNotification
  18. {
  19. var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
  20. contentView = [theWindow contentView];
  21. var scroll = [[CPScrollView alloc] initWithFrame:CGRectMake(100,100,700,400)];
  22. table = [[CPTableView alloc] initWithFrame:CGRectMakeZero()];
  23. [table setDataSource:self];
  24. columnA = [[CPTableColumn alloc] initWithIdentifier:"A"];
  25. [table addTableColumn:columnA];
  26. [[columnA headerView] setStringValue:"A"];
  27. [columnA setWidth:175];
  28. columnB = [[CPTableColumn alloc] initWithIdentifier:"B"];
  29. [table addTableColumn:columnB];
  30. [[columnB headerView] setStringValue:"B"];
  31. [columnB setWidth:175]
  32. columnC = [[CPTableColumn alloc] initWithIdentifier:"C"];
  33. [table addTableColumn:columnC];
  34. [[columnC headerView] setStringValue:"C"];
  35. [columnC setWidth:175];
  36. columnD = [[CPTableColumn alloc] initWithIdentifier:"D"];
  37. [table addTableColumn:columnD];
  38. [[columnD headerView] setStringValue:"D"];
  39. [columnD setWidth:175];
  40. columnE = [[CPTableColumn alloc] initWithIdentifier:"E"];
  41. [table addTableColumn:columnE];
  42. [[columnE headerView] setStringValue:"E"];
  43. [columnE setWidth:175];
  44. [scroll setDocumentView:table];
  45. [contentView addSubview:scroll];
  46. [theWindow orderFront:self];
  47. }
  48. - (int)numberOfRowsInTableView:(id)tableView
  49. {
  50. return 10000;
  51. }
  52. - (id)tableView:(id)tableView objectValueForTableColumn:(CPTableColumn)aColumn row:(CPInteger)aRow
  53. {
  54. return "Column " + [aColumn identifier] + " Row " + aRow;
  55. }
  56. @end