/Tests/Manual/TableTest/BorderTableTest/AppController.j

http://github.com/cacaodev/cappuccino · Unknown · 60 lines · 46 code · 14 blank · 0 comment · 0 complexity · c6842e738689ddc240feeb57c6a1faef MD5 · raw file

  1. /*
  2. * AppController.j
  3. * TableCibTest
  4. *
  5. * Created by Francisco Tolmasky on July 5, 2009.
  6. * Copyright 2009, 280 North, Inc. All rights reserved.
  7. */
  8. @import <Foundation/CPObject.j>
  9. CPLogRegister(CPLogConsole);
  10. @implementation AppController : CPObject
  11. {
  12. CPWindow theWindow; //this "outlet" is connected automatically by the Cib
  13. CPScrollView theScrollView;
  14. CPTableView theTableView;
  15. CPPopupButton theBorderTypePopup;
  16. }
  17. - (void)applicationDidFinishLaunching:(CPNotification)aNotification
  18. {
  19. // This is called when the application is done loading.
  20. }
  21. - (void)awakeFromCib
  22. {
  23. // This is called when the cib is done loading.
  24. // You can implement this method on any object instantiated from a Cib.
  25. // It's a useful hook for setting up current UI values, and other things.
  26. // In this case, we want the window from Cib to become our full browser window
  27. [theWindow setFullPlatformWindow:YES];
  28. [theWindow setBackgroundColor:[CPColor colorWithHexString:@"f3f4f5"]];
  29. [theBorderTypePopup selectItemWithTag:[theScrollView borderType]];
  30. }
  31. - (int)numberOfRowsInTableView:(CPTableView)tableView
  32. {
  33. return 10;
  34. }
  35. - (id)tableView:(CPTableView)tableView objectValueForTableColumn:(CPTableColumn)tableColumn row:(CPInteger)row
  36. {
  37. return String((row + 1) * [[tableColumn identifier] intValue]);
  38. }
  39. // Actions
  40. - (void)setBorder:(id)sender
  41. {
  42. var type = [[sender selectedItem] tag];
  43. console.log('type=%d', type);
  44. [theScrollView setBorderType:type];
  45. }
  46. @end