Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
  2. {
  3.     if (tableView == tableShowingByNetworkPages) {
  4.         NSInteger       totalLinksSoFarAcrossAllPages = 0;
  5.         NSInteger       linksCountInPage;
  6.         id              identifier;
  7.        
  8.         identifier = [tableColumn identifier];
  9.        
  10.         NSString *currentPageKey;
  11.         for (currentPageKey in [self dictionaryOfAllOnSitePages])
  12.         {
  13.             NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];
  14.  
  15.             NetworkPage *currentPage = [[self dictionaryOfAllOnSitePages]valueForKey:currentPageKey];
  16.             NSSet *linksSetInCurrentPage = [[NSSet alloc]initWithArray:[currentPage arrayOfAllLinksOnPage]];
  17.             if ([self showOnlyBadLinks] == NSOnState) {
  18.                 NSPredicate *predicate = [NSPredicate predicateWithFormat:@"statusCode != 200"];
  19.                 linksSetInCurrentPage = [linksSetInCurrentPage filteredSetUsingPredicate:predicate];
  20.             }
  21.             linksCountInPage = [linksSetInCurrentPage count];
  22.            
  23.             if (rowIndex < totalLinksSoFarAcrossAllPages + linksCountInPage)
  24.             {
  25.                 if ([identifier isEqual:@"page"])
  26.                 {
  27.                     NSString *stringToReturn = [NSString stringWithFormat:@"%@\n%@", [currentPage pageTitle], [currentPage pageURL]];
  28.                     [linksSetInCurrentPage release];
  29.                     return stringToReturn;
  30.                 }
  31.                 else {
  32.                     NSArray *linksInPage = [[NSArray alloc]initWithArray:[linksSetInCurrentPage allObjects]];
  33.                     [linksSetInCurrentPage release];
  34.                    
  35.                     NetworkLink *currentLink = [linksInPage objectAtIndex:rowIndex - totalLinksSoFarAcrossAllPages];
  36.                     [linksInPage release];
  37.                    
  38.                     if ([identifier isEqual:@"status"])
  39.                     {
  40.                         return currentLink;
  41.                     }
  42.                     else if ([identifier isEqual:@"link"])
  43.                     {
  44.                         return [currentLink link];                 
  45.                     }
  46.                 }
  47.             }
  48.             else {
  49.                 [linksSetInCurrentPage release];               
  50.                 totalLinksSoFarAcrossAllPages += linksCountInPage;
  51.                 [pool release];
  52.                 continue;
  53.             }
  54.  
  55.         }
  56.         return nil;    
  57.     }
  58.    
  59.     return nil;
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement