From 8e2afde3e412256d25c8532ec7f404b9d42b8903 Mon Sep 17 00:00:00 2001 From: cacaodev Date: Fri, 29 Jun 2012 19:29:53 +0200 Subject: [PATCH] CPKeyValueBinding -reverseSetValueFor: -> extract a method for getting the source value for a given binding. the goal is to facilitate subclassing. --- AppKit/CPKeyValueBinding.j | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AppKit/CPKeyValueBinding.j b/AppKit/CPKeyValueBinding.j index 608f7ae4a..f7ac25126 100644 --- a/AppKit/CPKeyValueBinding.j +++ b/AppKit/CPKeyValueBinding.j @@ -190,7 +190,7 @@ var CPBindingOperationAnd = 0, var destination = [_info objectForKey:CPObservedObjectKey], keyPath = [_info objectForKey:CPObservedKeyPathKey], options = [_info objectForKey:CPOptionsKey], - newValue = [_source valueForKeyPath:aBinding]; + newValue = [self valueForBinding:aBinding]; newValue = [self reverseTransformValue:newValue withOptions:options]; @@ -199,6 +199,11 @@ var CPBindingOperationAnd = 0, [self unsuppressSpecificNotificationFromObject:destination keyPath:keyPath]; } +- (id)valueForBinding:(CPString)aBinding +{ + return [_source valueForKeyPath:aBinding]; +} + - (void)observeValueForKeyPath:(CPString)aKeyPath ofObject:(id)anObject change:(CPDictionary)changes context:(id)context { if (!changes)