API  0.9.10
CPCibBindingConnector.j
Go to the documentation of this 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 
24 var CPCibBindingConnectorBindingKey = @"CPCibBindingConnectorBindingKey",
25  CPCibBindingConnectorKeyPathKey = @"CPCibBindingConnectorKeyPathKey",
26  CPCibBindingConnectorOptionsKey = @"CPCibBindingConnectorOptionsKey";
27 
28 @implementation CPCibBindingConnector : CPCibConnector
29 {
30  id _binding;
31  id _keyPath;
32  id _options;
33 }
34 
35 - (id)initWithCoder:(CPCoder)aCoder
36 {
37  if (self = [super initWithCoder:aCoder])
38  {
39  _binding = [aCoder decodeObjectForKey:CPCibBindingConnectorBindingKey];
40  _keyPath = [aCoder decodeObjectForKey:CPCibBindingConnectorKeyPathKey];
41  _options = [aCoder decodeObjectForKey:CPCibBindingConnectorOptionsKey];
42  }
43 
44  return self;
45 }
46 
47 - (void)encodeWithCoder:(CPCoder)aCoder
48 {
49  [super encodeWithCoder:aCoder];
50 
51  [aCoder encodeObject:_binding forKey:CPCibBindingConnectorBindingKey];
52  [aCoder encodeObject:_keyPath forKey:CPCibBindingConnectorKeyPathKey];
53  [aCoder encodeObject:_options forKey:CPCibBindingConnectorOptionsKey];
54 }
55 
57 {
58  [_source bind:_binding toObject:_destination withKeyPath:_keyPath options:_options];
59 }
60 
61 @end
var CPCibBindingConnectorBindingKey
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
var CPCibBindingConnectorOptionsKey
void encodeWithCoder:(CPCoder aCoder)
var CPCibBindingConnectorKeyPathKey