mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-07 17:38:02 +00:00
Allow array controllers as table sources in cibs.
When an array controller is loaded from a cib, the data source may be connected before the bindings are. Hence, we can't check for required data source methods at the time because we do not know if we are using bindings yet. The new behaviour is to only warn when the methods are actually required, which matches Cocoa.
This commit is contained in:
1 parent
f36d8224a6
commit
f2b2852b76
1 file changed
+15
-13
+15
-13
@@ -372,15 +372,9 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if ([_dataSource respondsToSelector:@selector(numberOfRowsInTableView:)])
|
||||
_implementedDataSourceMethods |= CPTableViewDataSource_numberOfRowsInTableView_;
|
||||
else if (!hasContentBinding)
|
||||
[CPException raise:CPInternalInconsistencyException
|
||||
reason:[aDataSource description] + " does not implement numberOfRowsInTableView:."];
|
||||
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:objectValueForTableColumn:row:)])
|
||||
_implementedDataSourceMethods |= CPTableViewDataSource_tableView_objectValueForTableColumn_row_;
|
||||
else if (!hasContentBinding)
|
||||
[CPException raise:CPInternalInconsistencyException
|
||||
reason:[aDataSource description] + " does not implement tableView:objectValueForTableColumn:row:"];
|
||||
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:setObjectValue:forTableColumn:row:)])
|
||||
_implementedDataSourceMethods |= CPTableViewDataSource_tableView_setObjectValue_forTableColumn_row_;
|
||||
@@ -1149,10 +1143,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
_numberOfRows = [[destination valueForKeyPath:keyPath] count];
|
||||
}
|
||||
else if (_dataSource)
|
||||
else if (_dataSource && (_implementedDataSourceMethods & CPTableViewDataSource_numberOfRowsInTableView_))
|
||||
_numberOfRows = [_dataSource numberOfRowsInTableView:self];
|
||||
else
|
||||
{
|
||||
CPLog(@"no content binding established and data source " + [_dataSource description] + " does not implement numberOfRowsInTableView:");
|
||||
_numberOfRows = 0;
|
||||
}
|
||||
|
||||
return _numberOfRows;
|
||||
}
|
||||
@@ -1497,8 +1494,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
topInset = FLOOR(_intercellSpacing.height / 2.0);
|
||||
|
||||
return _CGRectMake(tableColumnRange.location + leftInset, _CGRectGetMinY(rectOfRow) + topInset, tableColumnRange.length - _intercellSpacing.width, _CGRectGetHeight(rectOfRow) - _intercellSpacing.height);
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)resizeWithOldSuperviewSize:(CGSize)aSize
|
||||
@@ -2389,10 +2384,17 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var objectValue = tableColumnObjectValues[aRowIndex];
|
||||
|
||||
// tableView:objectValueForTableColumn:row: is optional if content bindings are in place.
|
||||
if (objectValue === undefined && (_implementedDataSourceMethods & CPTableViewDataSource_tableView_objectValueForTableColumn_row_))
|
||||
if (objectValue === undefined)
|
||||
{
|
||||
objectValue = [_dataSource tableView:self objectValueForTableColumn:aTableColumn row:aRowIndex];
|
||||
tableColumnObjectValues[aRowIndex] = objectValue;
|
||||
if (_implementedDataSourceMethods & CPTableViewDataSource_tableView_objectValueForTableColumn_row_)
|
||||
{
|
||||
objectValue = [_dataSource tableView:self objectValueForTableColumn:aTableColumn row:aRowIndex];
|
||||
tableColumnObjectValues[aRowIndex] = objectValue;
|
||||
}
|
||||
else if (![self infoForBinding:@"content"])
|
||||
{
|
||||
CPLog(@"no content binding established and data source " + [_dataSource description] + " does not implement tableView:objectValueForTableColumn:row:");
|
||||
}
|
||||
}
|
||||
|
||||
return objectValue;
|
||||
@@ -2404,7 +2406,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
{
|
||||
var superview = [self superview];
|
||||
|
||||
// FIXME: Should we be rect intersecting in case
|
||||
// FIXME: Should we be rect intersecting in case
|
||||
// there are multiple views in the clip view?
|
||||
if ([superview isKindOfClass:[CPClipView class]])
|
||||
_exposedRect = [superview bounds];
|
||||
|
||||
Reference in new issue
Block a user