<commit_before>@import <Foundation/CPObject.j>

tableTestDragType = @"CPTableViewTestDragType";

@implementation AppController : CPObject
{
    CPTableView tableView;
    CPTableView tableView2;
    CPTableView tableView3;
    CPImage     iconImage;
    CPArray     dataSet1;
    CPArray     dataSet2;
}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
    
    dataSet1 = [],
    dataSet2 = [],
    dataSet3 = [];
    
    for(var i = 1; i < 100; i++)
    {
        dataSet1[i - 1] = [CPNumber numberWithInt:i];
        dataSet2[i - 1] = [CPNumber numberWithInt:i+10];
        dataSet3[i - 1] = [CPNumber numberWithInt:i+20];
    }

    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(50,50,700,500) styleMask:CPClosableWindowMask],
        contentView = [theWindow contentView];

    tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)];

    [tableView setAllowsMultipleSelection:YES];
    [tableView setAllowsColumnSelection:YES];
    [tableView setUsesAlternatingRowBackgroundColors:YES];
    [tableView setAlternatingRowBackgroundColors:[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"], [CPColor colorWithHexString:@"f4e7ff"]]];
    [tableView setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask];    
    [tableView setVerticalMotionCanBeginDrag:NO];
    [tableView setDraggingDestinationFeedbackStyle:CPTableViewDropOn];
    [tableView registerForDraggedTypes:[CPArray arrayWithObject:tableTestDragType]];
    [tableView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
    [tableView setDelegate:self];
    [tableView setDataSource:self];

    
    var iconView = [[CPImageView alloc] initWithFrame:CGRectMake(16,16,0,0)];
    [iconView setImageScaling:CPScaleNone];
    var iconColumn = [[CPTableColumn alloc] initWithIdentifier:"icons"];
    [iconColumn setWidth:32.0];
    [iconColumn setMinWidth:32.0];
    [iconColumn setDataView:iconView];
    [tableView addTableColumn:iconColumn];
    iconImage = [[CPImage alloc] initWithContentsOfFile:"http://cappuccino.org/images/favicon.png" size:CGSizeMake(16,16)];


    var desc = [CPSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
    for (var i = 1; i <= 5; i++)
    {
        var column = [[CPTableColumn alloc] initWithIdentifier:String(i)];
        [column setSortDescriptorPrototype:desc];
        [[column headerView] setStringValue:"Number " + i];

        [column setMinWidth:50.0];
        [column setMaxWidth:500.0];
        [column setWidth:75.0];
        
        [column setEditable:YES];
        [tableView addTableColumn:column];
    }

    // we offset this scrollview to make sure all the coordinates are calculated correctly
    // bad things can happen when the tableview doesn't sit at (0,0)
    var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(200, 50, CGRectGetWidth([contentView bounds]) - 200, CGRectGetHeight([contentView bounds]) -200)];
   
    [scrollView setDocumentView:tableView];
    [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
    
    [contentView addSubview:scrollView];

    [theWindow orderFront:self];
    [self newWindow];
    [self sourceList];
}

- (void)newWindow
{

    var window2 = [[CPWindow alloc] initWithContentRect:CGRectMake(450, 50, 500, 400) styleMask:CPTitledWindowMask | CPResizableWindowMask];
    
    tableView2 = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 500.0, 500.0)];

    [tableView2 setAllowsMultipleSelection:YES];
    [tableView2 setUsesAlternatingRowBackgroundColors:YES];
    [tableView2 setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask];
    [tableView2 setVerticalMotionCanBeginDrag:NO];
    [tableView2 registerForDraggedTypes:[CPArray arrayWithObject:tableTestDragType]];
    [tableView2 setDraggingDestinationFeedbackStyle:CPTableViewDropAbove];
    [tableView2 setDelegate:self];
    [tableView2 setDataSource:self];

    var desc = [CPSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
    for (var i = 1; i <= 3; i++)
    {
        var column = [[CPTableColumn alloc] initWithIdentifier:String(i)];
        [column setSortDescriptorPrototype:desc];
        [[column headerView] setStringValue:"Number "+i];

        [column setWidth:i*75];
        [column setMinWidth:50.0];

        [column setEditable:YES];
        
        [tableView2 addTableColumn:column];
    }

    [tableView2 setColumnAutoresizingStyle:CPTableViewUniformColumnAutoresizingStyle];

    var scrollView = [[CPScrollView alloc] initWithFrame:[[window2 contentView] bounds]];
    [tableView2 setRowHeight:32.0];
    [scrollView setDocumentView:tableView2];
    [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
    
    [[window2 contentView] addSubview:scrollView];

    //[scrollView setAutohidesScrollers:YES];

    
    [window2 orderFront:self];<commit_msg>Updated TableTest adding a checkbox as a dataview for a column.<commit_after>@import <Foundation/CPObject.j>

tableTestDragType = @"CPTableViewTestDragType";

@implementation AppController : CPObject
{
    CPTableView tableView;
    CPTableView tableView2;
    CPTableView tableView3;
    CPImage     iconImage;
    CPArray     dataSet1;
    CPArray     dataSet2;
}

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
    
    dataSet1 = [],
    dataSet2 = [],
    dataSet3 = [];
    
    for(var i = 1; i < 100; i++)
    {
        dataSet1[i - 1] = [CPNumber numberWithInt:i];
        dataSet2[i - 1] = [CPNumber numberWithInt:i+10];
        dataSet3[i - 1] = [CPNumber numberWithInt:i+20];
    }

    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(50,50,700,500) styleMask:CPClosableWindowMask],
        contentView = [theWindow contentView];

    tableView = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 400.0)];

    [tableView setAllowsMultipleSelection:YES];
    [tableView setAllowsColumnSelection:YES];
    [tableView setUsesAlternatingRowBackgroundColors:YES];
    [tableView setAlternatingRowBackgroundColors:[[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"], [CPColor colorWithHexString:@"f4e7ff"]]];
    [tableView setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask];    
    [tableView setVerticalMotionCanBeginDrag:NO];
    [tableView setDraggingDestinationFeedbackStyle:CPTableViewDropOn];
    [tableView registerForDraggedTypes:[CPArray arrayWithObject:tableTestDragType]];
    [tableView setColumnAutoresizingStyle:CPTableViewLastColumnOnlyAutoresizingStyle];
    [tableView setDelegate:self];
    [tableView setDataSource:self];

    
    var iconView = [[CPImageView alloc] initWithFrame:CGRectMake(16,16,0,0)];
    [iconView setImageScaling:CPScaleNone];
    var iconColumn = [[CPTableColumn alloc] initWithIdentifier:"icons"];
    [iconColumn setWidth:32.0];
    [iconColumn setMinWidth:32.0];
    [iconColumn setDataView:iconView];
    [tableView addTableColumn:iconColumn];
    iconImage = [[CPImage alloc] initWithContentsOfFile:"http://cappuccino.org/images/favicon.png" size:CGSizeMake(16,16)];


    var desc = [CPSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
    for (var i = 1; i <= 5; i++)
    {
        var column = [[CPTableColumn alloc] initWithIdentifier:String(i)];
        [column setSortDescriptorPrototype:desc];
        [[column headerView] setStringValue:"Number " + i];

        [column setMinWidth:50.0];
        [column setMaxWidth:500.0];
        [column setWidth:75.0];
        
        [column setEditable:YES];
        [tableView addTableColumn:column];
    }

    // we offset this scrollview to make sure all the coordinates are calculated correctly
    // bad things can happen when the tableview doesn't sit at (0,0)
    var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(200, 50, CGRectGetWidth([contentView bounds]) - 200, CGRectGetHeight([contentView bounds]) -200)];
   
    [scrollView setDocumentView:tableView];
    [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
    
    [contentView addSubview:scrollView];

    [theWindow orderFront:self];
    [self newWindow];
    [self sourceList];
}

- (void)newWindow
{

    var window2 = [[CPWindow alloc] initWithContentRect:CGRectMake(450, 50, 500, 400) styleMask:CPTitledWindowMask | CPResizableWindowMask];
    
    tableView2 = [[CPTableView alloc] initWithFrame:CGRectMake(0.0, 0.0, 500.0, 500.0)];

    [tableView2 setAllowsMultipleSelection:YES];
    [tableView2 setUsesAlternatingRowBackgroundColors:YES];
    [tableView2 setGridStyleMask:CPTableViewSolidHorizontalGridLineMask | CPTableViewSolidVerticalGridLineMask];
    [tableView2 setVerticalMotionCanBeginDrag:NO];
    [tableView2 registerForDraggedTypes:[CPArray arrayWithObject:tableTestDragType]];
    [tableView2 setDraggingDestinationFeedbackStyle:CPTableViewDropAbove];
    [tableView2 setDelegate:self];
    [tableView2 setDataSource:self];


    var checkBox = [[CPCheckBox alloc] initWithFrame:CGRectMake(5,3,24,24)],
        checkBoxColumn = [[CPTableColumn alloc] initWithIdentifier:@"checkBox"];
    [checkBoxColumn setDataView:checkBox];

    [tableView2 addTableColumn:checkBoxColumn];

    var desc = [CPSortDescriptor sortDescriptorWithKey:@"self" ascending:YES];
    for (var i = 1; i <= 3; i++)
    {
        var column = [[CPTableColumn alloc] initWithIdentifier:String(i)];
        [column setSortDescriptorPrototype:desc];
        [[column headerView] setStringValue:"Number "+i];

        [column setWidth:i*75];
        [column setMinWidth:50.0];

        [column setEditable:YES];
        
        [tableView2 addTableColumn:column];
    }

    [tableView2 setColumnAutoresizingStyle:CPTableViewUniformColumnAutoresizingStyle];

    var scrollView = [[CPScrollView alloc] initWithFrame:[[window2 contentView] bounds]];
    [tableView2 setRowHeight:32.0];
    [scrollView setDocumentView:tableView2];
    [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
    
    [[window2 contentView] addSubview:scrollView];

    //[scrollView setAutohidesScrollers:YES];

    
    [window2 orderFront:self];
{'fraction_non_alphanumeric': 0.10728231159703241, 'fraction_numerical': 0.027625927372120267, 'mean_word_length': 4.573993471164309, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4538966', 'n_tokens_mistral': 3347, 'n_tokens_neox': 3077, 'n_words': 588}