PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/AppKit/Cib/CPCibBindingConnector.j

http://github.com/cacaodev/cappuccino
Unknown | 62 lines | 53 code | 9 blank | 0 comment | 0 complexity | 421994e08d4e59231a4d6dafedcc39f1 MD5 | raw file
 1/*
 2 * CPCibBindingConnector.j
 3 * AppKit
 4 *
 5 * Created by Ross Boucher.
 6 * Copyright 2010, 280 North, Inc.
 7 *
 8 * This library is free software; you can redistribute it and/or
 9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23@import "CPCibConnector.j"
24
25var CPCibBindingConnectorBindingKey = @"CPCibBindingConnectorBindingKey",
26    CPCibBindingConnectorKeyPathKey = @"CPCibBindingConnectorKeyPathKey",
27    CPCibBindingConnectorOptionsKey = @"CPCibBindingConnectorOptionsKey";
28
29@implementation CPCibBindingConnector : CPCibConnector
30{
31    id _binding;
32    id _keyPath;
33    id _options;
34}
35
36- (id)initWithCoder:(CPCoder)aCoder
37{
38    if (self = [super initWithCoder:aCoder])
39    {
40        _binding = [aCoder decodeObjectForKey:CPCibBindingConnectorBindingKey];
41        _keyPath = [aCoder decodeObjectForKey:CPCibBindingConnectorKeyPathKey];
42        _options = [aCoder decodeObjectForKey:CPCibBindingConnectorOptionsKey];
43    }
44
45    return self;
46}
47
48- (void)encodeWithCoder:(CPCoder)aCoder
49{
50    [super encodeWithCoder:aCoder];
51
52    [aCoder encodeObject:_binding forKey:CPCibBindingConnectorBindingKey];
53    [aCoder encodeObject:_keyPath forKey:CPCibBindingConnectorKeyPathKey];
54    [aCoder encodeObject:_options forKey:CPCibBindingConnectorOptionsKey];
55}
56
57- (void)establishConnection
58{
59    [_source bind:_binding toObject:_destination withKeyPath:_keyPath options:_options];
60}
61
62@end