Fix for the objectValue/value thing in bindings. Removed unnecessary code in CPControl

This commit is contained in:
Ross Boucher committed 2009-09-20 19:33:03 -07:00
1 parent 417b5c8b97
commit b63e50dacb
2 files changed
+10 -15

No files matched your search

-11
View File
@@ -149,17 +149,6 @@ var CPControlBlackColor = [CPColor blackColor];
return self;
}
- (void)bind:(CPString)binding toObject:(id)anObject withKeyPath:(CPString)keyPath options:(CPDictionary)options
{
if ([binding isEqual: CPValueBinding])
{
[self unbind: binding];
[[CPKeyValueBinding alloc] initWithBinding: @"objectValue" name:CPValueBinding to:anObject keyPath:keyPath options:options from:self];
}
else
[super bind:binding toObject:anObject withKeyPath:keyPath options:options];
}
/*!
Sets the receiver's target action
@param anAction Sets the action message that gets sent to the target.
+10 -4
View File
@@ -119,8 +119,6 @@ var CPBindingOperationAnd = 0,
if (options)
[_info setObject:options forKey:CPOptionsKey];
//_replacementKeyPathForBinding
[aDestination addObserver:self forKeyPath:aKeyPath options:CPKeyValueObservingOptionNew context:aBinding];
var bindings = [bindingsMap objectForKey:[_source hash]];
@@ -259,7 +257,7 @@ var CPBindingOperationAnd = 0,
CPLog.warn("No binding exposed on "+self+" for "+aBinding);
[self unbind:aBinding];
[[CPKeyValueBinding alloc] initWithBinding:aBinding name:aBinding to:anObject keyPath:aKeyPath options:options from:self];
[[CPKeyValueBinding alloc] initWithBinding:[anObject _replacementKeyPathForBinding:aBinding] name:aBinding to:anObject keyPath:aKeyPath options:options from:self];
}
- (CPDictionary)infoForBinding:(CPString)aBinding
@@ -272,6 +270,14 @@ var CPBindingOperationAnd = 0,
[CPKeyValueBinding unbind:aBinding forObject:self];
}
- (id)_replacementKeyPathForBinding:(CPString)binding
{
if ([binding isEqual:@"value"])
return @"objectValue";
return binding;
}
@end
@implementation _CPKeyValueOrBinding : CPKeyValueBinding
@@ -398,7 +404,7 @@ CPHiddenBinding = @"CPHiddenBinding";
CPSelectedIndexBinding = @"CPSelectedIndexBinding";
CPTextColorBinding = @"CPTextColorBinding";
CPToolTipBinding = @"CPToolTipBinding";
CPValueBinding = @"objectValue";
CPValueBinding = @"value";
//Binding options constants
CPAllowsEditingMultipleValuesSelectionBindingOption = @"CPAllowsEditingMultipleValuesSelectionBindingOption";