00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 @import "CPCibConnector.j"
00024
00025
00026 @implementation CPCibControlConnector : CPCibConnector
00027 {
00028 }
00029
00030 - (void)establishConnection
00031 {
00032 var selectorName = _label,
00033 selectorNameLength = [selectorName length];
00034
00035 if (selectorNameLength && selectorName.charAt(selectorNameLength - 1) !== ':')
00036 selectorName += ':';
00037
00038 var selector = CPSelectorFromString(selectorName);
00039
00040
00041 if (!selector)
00042 [CPException
00043 raise:CPInvalidArgumentException
00044 reason:@"-[" + [self className] + ' ' + _cmd + @"] selector " + selectorName + @" does not exist."];
00045
00046
00047 if (_destination && ![_destination respondsToSelector:selector])
00048 {
00049 CPLog.warn(@"Could not connect the action " + selector + @" to target of class " + [_destination className]);
00050
00051 return;
00052 }
00053
00054
00055 if ([_source respondsToSelector:@selector(setAction:)])
00056 objj_msgSend(_source, @selector(setAction:), selector);
00057
00058 else
00059 [CPException
00060 raise:CPInvalidArgumentException
00061 reason:@"-[" + [self className] + ' ' + _cmd + @"] " + [_source description] + " does not respond to setAction:"];
00062
00063
00064 if ([_source respondsToSelector:@selector(setTarget:)])
00065 objj_msgSend(_source, @selector(setTarget:), _destination);
00066
00067 else
00068 [CPException
00069 raise:CPInvalidArgumentException
00070 reason:@"-[" + [self className] + ' ' + _cmd + @"] " + [_source description] + " does not respond to setTarget:"];
00071 }
00072
00073 @end
00074
00075 @implementation _CPCibControlConnector : CPCibControlConnector { } @end
00076