mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-29 11:28:49 +00:00
Fix for the objectValue/value thing in bindings. Removed unnecessary code in CPControl
This commit is contained in:
1 parent
417b5c8b97
commit
b63e50dacb
2 files changed
+10
-15
No files matched your search
@@ -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.
|
||||
|
||||
@@ -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";
|
||||
|
||||
Reference in new issue
Block a user